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 <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/thread_task_runner_handle.h" |
16 #include "ui/compositor/compositor.h" | 16 #include "ui/compositor/compositor.h" |
17 #include "ui/gfx/rect.h" | 17 #include "ui/gfx/rect.h" |
18 #include "ui/gfx/x/x11_types.h" | 18 #include "ui/gfx/x/x11_types.h" |
19 | 19 |
20 namespace ui { | 20 namespace ui { |
21 | 21 |
22 class TestCompositorHostX11 : public TestCompositorHost { | 22 class TestCompositorHostX11 : public TestCompositorHost { |
23 public: | 23 public: |
24 TestCompositorHostX11(const gfx::Rect& bounds, | 24 TestCompositorHostX11(const gfx::Rect& bounds, |
25 ui::ContextFactory* context_factory); | 25 ui::ContextFactory* context_factory); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 XMapWindow(display, window_); | 70 XMapWindow(display, window_); |
71 | 71 |
72 while (1) { | 72 while (1) { |
73 XEvent event; | 73 XEvent event; |
74 XNextEvent(display, &event); | 74 XNextEvent(display, &event); |
75 if (event.type == MapNotify && event.xmap.window == window_) | 75 if (event.type == MapNotify && event.xmap.window == window_) |
76 break; | 76 break; |
77 } | 77 } |
78 compositor_.reset(new ui::Compositor(window_, | 78 compositor_.reset(new ui::Compositor(window_, |
79 context_factory_, | 79 context_factory_, |
80 base::MessageLoopProxy::current())); | 80 base::ThreadTaskRunnerHandle::Get())); |
81 compositor_->SetScaleAndSize(1.0f, bounds_.size()); | 81 compositor_->SetScaleAndSize(1.0f, bounds_.size()); |
82 } | 82 } |
83 | 83 |
84 ui::Compositor* TestCompositorHostX11::GetCompositor() { | 84 ui::Compositor* TestCompositorHostX11::GetCompositor() { |
85 return compositor_.get(); | 85 return compositor_.get(); |
86 } | 86 } |
87 | 87 |
88 void TestCompositorHostX11::Draw() { | 88 void TestCompositorHostX11::Draw() { |
89 if (compositor_.get()) | 89 if (compositor_.get()) |
90 compositor_->Draw(); | 90 compositor_->Draw(); |
91 } | 91 } |
92 | 92 |
93 // static | 93 // static |
94 TestCompositorHost* TestCompositorHost::Create( | 94 TestCompositorHost* TestCompositorHost::Create( |
95 const gfx::Rect& bounds, | 95 const gfx::Rect& bounds, |
96 ui::ContextFactory* context_factory) { | 96 ui::ContextFactory* context_factory) { |
97 return new TestCompositorHostX11(bounds, context_factory); | 97 return new TestCompositorHostX11(bounds, context_factory); |
98 } | 98 } |
99 | 99 |
100 } // namespace ui | 100 } // namespace ui |
OLD | NEW |