OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/win/window_impl.h" | 13 #include "ui/gfx/win/window_impl.h" |
14 | 14 |
15 namespace ui { | 15 namespace ui { |
16 | 16 |
17 class TestCompositorHostWin : public TestCompositorHost, | 17 class TestCompositorHostWin : public TestCompositorHost, |
18 public gfx::WindowImpl { | 18 public gfx::WindowImpl { |
19 public: | 19 public: |
20 TestCompositorHostWin(const gfx::Rect& bounds, | 20 TestCompositorHostWin(const gfx::Rect& bounds, |
21 ui::ContextFactory* context_factory) { | 21 ui::ContextFactory* context_factory, |
| 22 ui::ContextFactoryPrivate* context_factory_private) { |
22 Init(NULL, bounds); | 23 Init(NULL, bounds); |
23 compositor_.reset(new ui::Compositor(context_factory, | 24 compositor_.reset(new ui::Compositor(context_factory, |
| 25 context_factory_private, |
24 base::ThreadTaskRunnerHandle::Get())); | 26 base::ThreadTaskRunnerHandle::Get())); |
25 compositor_->SetAcceleratedWidget(hwnd()); | 27 compositor_->SetAcceleratedWidget(hwnd()); |
26 compositor_->SetScaleAndSize(1.0f, GetSize()); | 28 compositor_->SetScaleAndSize(1.0f, GetSize()); |
27 } | 29 } |
28 | 30 |
29 ~TestCompositorHostWin() override { DestroyWindow(hwnd()); } | 31 ~TestCompositorHostWin() override { DestroyWindow(hwnd()); } |
30 | 32 |
31 // Overridden from TestCompositorHost: | 33 // Overridden from TestCompositorHost: |
32 void Show() override { | 34 void Show() override { |
33 ShowWindow(hwnd(), SW_SHOWNORMAL); | 35 ShowWindow(hwnd(), SW_SHOWNORMAL); |
(...skipping 17 matching lines...) Expand all Loading... |
51 return gfx::Rect(r).size(); | 53 return gfx::Rect(r).size(); |
52 } | 54 } |
53 | 55 |
54 std::unique_ptr<ui::Compositor> compositor_; | 56 std::unique_ptr<ui::Compositor> compositor_; |
55 | 57 |
56 DISALLOW_COPY_AND_ASSIGN(TestCompositorHostWin); | 58 DISALLOW_COPY_AND_ASSIGN(TestCompositorHostWin); |
57 }; | 59 }; |
58 | 60 |
59 TestCompositorHost* TestCompositorHost::Create( | 61 TestCompositorHost* TestCompositorHost::Create( |
60 const gfx::Rect& bounds, | 62 const gfx::Rect& bounds, |
61 ui::ContextFactory* context_factory) { | 63 ui::ContextFactory* context_factory, |
62 return new TestCompositorHostWin(bounds, context_factory); | 64 ui::ContextFactoryPrivate* context_factory_private) { |
| 65 return new TestCompositorHostWin(bounds, context_factory, |
| 66 context_factory_private); |
63 } | 67 } |
64 | 68 |
65 } // namespace ui | 69 } // namespace ui |
OLD | NEW |