OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/thread_task_runner_handle.h" |
14 #include "ui/compositor/compositor.h" | 14 #include "ui/compositor/compositor.h" |
15 #include "ui/gfx/rect.h" | 15 #include "ui/gfx/rect.h" |
16 | 16 |
17 namespace ui { | 17 namespace ui { |
18 | 18 |
19 class TestCompositorHostOzone : public TestCompositorHost { | 19 class TestCompositorHostOzone : public TestCompositorHost { |
20 public: | 20 public: |
21 TestCompositorHostOzone(const gfx::Rect& bounds, | 21 TestCompositorHostOzone(const gfx::Rect& bounds, |
22 ui::ContextFactory* context_factory); | 22 ui::ContextFactory* context_factory); |
23 virtual ~TestCompositorHostOzone(); | 23 virtual ~TestCompositorHostOzone(); |
(...skipping 25 matching lines...) Expand all Loading... |
49 void TestCompositorHostOzone::Show() { | 49 void TestCompositorHostOzone::Show() { |
50 // Ozone should rightly have a backing native framebuffer | 50 // Ozone should rightly have a backing native framebuffer |
51 // An in-memory array draw into by OSMesa is a reasonble | 51 // An in-memory array draw into by OSMesa is a reasonble |
52 // fascimile of a dumb framebuffer at present. | 52 // fascimile of a dumb framebuffer at present. |
53 // GLSurface will allocate the array so long as it is provided | 53 // GLSurface will allocate the array so long as it is provided |
54 // with a non-0 widget. | 54 // with a non-0 widget. |
55 // TODO(rjkroege): Use a "real" ozone widget when it is | 55 // TODO(rjkroege): Use a "real" ozone widget when it is |
56 // available: http://crbug.com/255128 | 56 // available: http://crbug.com/255128 |
57 compositor_.reset(new ui::Compositor(1, | 57 compositor_.reset(new ui::Compositor(1, |
58 context_factory_, | 58 context_factory_, |
59 base::MessageLoopProxy::current())); | 59 base::ThreadTaskRunnerHandle::Get())); |
60 compositor_->SetScaleAndSize(1.0f, bounds_.size()); | 60 compositor_->SetScaleAndSize(1.0f, bounds_.size()); |
61 } | 61 } |
62 | 62 |
63 ui::Compositor* TestCompositorHostOzone::GetCompositor() { | 63 ui::Compositor* TestCompositorHostOzone::GetCompositor() { |
64 return compositor_.get(); | 64 return compositor_.get(); |
65 } | 65 } |
66 | 66 |
67 void TestCompositorHostOzone::Draw() { | 67 void TestCompositorHostOzone::Draw() { |
68 if (compositor_.get()) | 68 if (compositor_.get()) |
69 compositor_->Draw(); | 69 compositor_->Draw(); |
70 } | 70 } |
71 | 71 |
72 // static | 72 // static |
73 TestCompositorHost* TestCompositorHost::Create( | 73 TestCompositorHost* TestCompositorHost::Create( |
74 const gfx::Rect& bounds, | 74 const gfx::Rect& bounds, |
75 ui::ContextFactory* context_factory) { | 75 ui::ContextFactory* context_factory) { |
76 return new TestCompositorHostOzone(bounds, context_factory); | 76 return new TestCompositorHostOzone(bounds, context_factory); |
77 } | 77 } |
78 | 78 |
79 } // namespace ui | 79 } // namespace ui |
OLD | NEW |