Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: ui/gfx/compositor/test/test_compositor_host_linux.cc

Issue 10258006: Remove dispatcher in test compositor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/gfx/compositor/test/test_compositor_host.h" 5 #include "ui/gfx/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.h"
14 #include "ui/base/x/x11_util.h" 13 #include "ui/base/x/x11_util.h"
15 #include "ui/gfx/compositor/compositor.h" 14 #include "ui/gfx/compositor/compositor.h"
16 #include "ui/gfx/rect.h" 15 #include "ui/gfx/rect.h"
17 16
18 #include <X11/Xlib.h> 17 #include <X11/Xlib.h>
19 18
20 #if defined(USE_AURA)
21 #include "base/message_pump_x.h"
22 #endif
23
24 namespace ui { 19 namespace ui {
25 20
26 class TestCompositorHostLinux : public TestCompositorHost, 21 class TestCompositorHostLinux : public TestCompositorHost,
27 public CompositorDelegate { 22 public CompositorDelegate {
28 public: 23 public:
29 TestCompositorHostLinux(const gfx::Rect& bounds); 24 TestCompositorHostLinux(const gfx::Rect& bounds);
30 virtual ~TestCompositorHostLinux(); 25 virtual ~TestCompositorHostLinux();
31 26
32 private: 27 private:
33 // Overridden from TestCompositorHost: 28 // Overridden from TestCompositorHost:
34 virtual void Show() OVERRIDE; 29 virtual void Show() OVERRIDE;
35 virtual ui::Compositor* GetCompositor() OVERRIDE; 30 virtual ui::Compositor* GetCompositor() OVERRIDE;
36 31
37 // Overridden from CompositorDelegate: 32 // Overridden from CompositorDelegate:
38 virtual void ScheduleDraw() OVERRIDE; 33 virtual void ScheduleDraw() OVERRIDE;
39 34
40 // Overridden from MessagePumpDispatcher:
41 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE;
42
43 void Draw(); 35 void Draw();
44 36
45 gfx::Rect bounds_; 37 gfx::Rect bounds_;
46 38
47 scoped_ptr<ui::Compositor> compositor_; 39 scoped_ptr<ui::Compositor> compositor_;
48 40
49 XID window_; 41 XID window_;
50 42
51 base::WeakPtrFactory<TestCompositorHostLinux> method_factory_; 43 base::WeakPtrFactory<TestCompositorHostLinux> method_factory_;
52 44
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 84
93 void TestCompositorHostLinux::ScheduleDraw() { 85 void TestCompositorHostLinux::ScheduleDraw() {
94 if (!method_factory_.HasWeakPtrs()) { 86 if (!method_factory_.HasWeakPtrs()) {
95 MessageLoopForUI::current()->PostTask( 87 MessageLoopForUI::current()->PostTask(
96 FROM_HERE, 88 FROM_HERE,
97 base::Bind(&TestCompositorHostLinux::Draw, 89 base::Bind(&TestCompositorHostLinux::Draw,
98 method_factory_.GetWeakPtr())); 90 method_factory_.GetWeakPtr()));
99 } 91 }
100 } 92 }
101 93
102 bool TestCompositorHostLinux::Dispatch(const base::NativeEvent& event) {
103 return true;
104 }
105
106 void TestCompositorHostLinux::Draw() { 94 void TestCompositorHostLinux::Draw() {
107 if (compositor_.get()) 95 if (compositor_.get())
108 compositor_->Draw(false); 96 compositor_->Draw(false);
109 } 97 }
110 98
111 // static 99 // static
112 TestCompositorHost* TestCompositorHost::Create(const gfx::Rect& bounds) { 100 TestCompositorHost* TestCompositorHost::Create(const gfx::Rect& bounds) {
113 return new TestCompositorHostLinux(bounds); 101 return new TestCompositorHostLinux(bounds);
114 } 102 }
115 103
116 } // namespace ui 104 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gfx/compositor/test/test_compositor_host.h ('k') | ui/gfx/compositor/test/test_compositor_host_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698