OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/compositor/test/test_compositor_host.h" | 5 #include "ui/compositor/test/test_compositor_host.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
12 #include "ui/compositor/compositor.h" | 12 #include "ui/compositor/compositor.h" |
13 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
14 | 14 |
15 namespace ui { | 15 namespace ui { |
16 | 16 |
17 class TestCompositorHostAndroid : public TestCompositorHost { | 17 class TestCompositorHostAndroid : public TestCompositorHost { |
18 public: | 18 public: |
19 TestCompositorHostAndroid( | 19 TestCompositorHostAndroid( |
20 const gfx::Rect& bounds, | 20 const gfx::Rect& bounds, |
21 ui::ContextFactory* context_factory, | 21 ui::ContextFactory* context_factory, |
22 ui::ContextFactoryPrivate* context_factory_private) { | 22 ui::ContextFactoryPrivate* context_factory_private) { |
23 compositor_.reset(new ui::Compositor( | 23 compositor_.reset(new ui::Compositor( |
24 context_factory_private->AllocateFrameSinkId(), context_factory, | 24 context_factory_private->AllocateFrameSinkId(), context_factory, |
25 context_factory_private, base::ThreadTaskRunnerHandle::Get(), | 25 context_factory_private, base::ThreadTaskRunnerHandle::Get(), |
26 false /* enable_surface_synchronization */)); | 26 false /* enable_surface_synchronization */, |
| 27 false /* enable_pixel_canvas */)); |
27 // TODO(sievers): Support onscreen here. | 28 // TODO(sievers): Support onscreen here. |
28 compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget); | 29 compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget); |
29 compositor_->SetScaleAndSize(1.0f, | 30 compositor_->SetScaleAndSize(1.0f, |
30 gfx::Size(bounds.width(), bounds.height())); | 31 gfx::Size(bounds.width(), bounds.height())); |
31 } | 32 } |
32 | 33 |
33 // Overridden from TestCompositorHost: | 34 // Overridden from TestCompositorHost: |
34 void Show() override { compositor_->SetVisible(true); } | 35 void Show() override { compositor_->SetVisible(true); } |
35 ui::Compositor* GetCompositor() override { return compositor_.get(); } | 36 ui::Compositor* GetCompositor() override { return compositor_.get(); } |
36 | 37 |
37 private: | 38 private: |
38 std::unique_ptr<ui::Compositor> compositor_; | 39 std::unique_ptr<ui::Compositor> compositor_; |
39 | 40 |
40 DISALLOW_COPY_AND_ASSIGN(TestCompositorHostAndroid); | 41 DISALLOW_COPY_AND_ASSIGN(TestCompositorHostAndroid); |
41 }; | 42 }; |
42 | 43 |
43 TestCompositorHost* TestCompositorHost::Create( | 44 TestCompositorHost* TestCompositorHost::Create( |
44 const gfx::Rect& bounds, | 45 const gfx::Rect& bounds, |
45 ui::ContextFactory* context_factory, | 46 ui::ContextFactory* context_factory, |
46 ui::ContextFactoryPrivate* context_factory_private) { | 47 ui::ContextFactoryPrivate* context_factory_private) { |
47 return new TestCompositorHostAndroid(bounds, context_factory, | 48 return new TestCompositorHostAndroid(bounds, context_factory, |
48 context_factory_private); | 49 context_factory_private); |
49 } | 50 } |
50 | 51 |
51 } // namespace ui | 52 } // namespace ui |
OLD | NEW |