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 #ifndef MOJO_EXAMPLES_COMPOSITOR_APP_COMPOSITOR_HOST_H_ | 5 #ifndef MOJO_EXAMPLES_COMPOSITOR_APP_COMPOSITOR_HOST_H_ |
6 #define MOJO_EXAMPLES_COMPOSITOR_APP_COMPOSITOR_HOST_H_ | 6 #define MOJO_EXAMPLES_COMPOSITOR_APP_COMPOSITOR_HOST_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | |
9 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
10 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
11 #include "cc/trees/layer_tree_host_client.h" | 10 #include "cc/trees/layer_tree_host_client.h" |
12 #include "mojo/public/cpp/system/core.h" | 11 #include "mojo/public/cpp/system/core.h" |
13 #include "ui/gfx/size.h" | 12 #include "ui/gfx/size.h" |
14 | 13 |
15 namespace cc { | 14 namespace cc { |
16 class Layer; | 15 class Layer; |
17 class LayerTreeHost; | 16 class LayerTreeHost; |
18 } // namespace cc | 17 } // namespace cc |
19 | 18 |
20 namespace mojo { | 19 namespace mojo { |
21 namespace examples { | 20 namespace examples { |
22 class GLES2ClientImpl; | 21 class GLES2ClientImpl; |
23 | 22 |
24 class CompositorHost : public cc::LayerTreeHostClient { | 23 class CompositorHost : public cc::LayerTreeHostClient { |
25 public: | 24 public: |
26 explicit CompositorHost(ScopedMessagePipeHandle command_buffer_handle); | 25 explicit CompositorHost(ScopedMessagePipeHandle command_buffer_handle); |
27 virtual ~CompositorHost(); | 26 virtual ~CompositorHost(); |
28 | 27 |
29 void SetSize(const gfx::Size& viewport_size); | 28 void SetSize(const gfx::Size& viewport_size); |
30 | 29 |
31 // cc::LayerTreeHostClient implementation. | 30 // cc::LayerTreeHostClient implementation. |
32 virtual void WillBeginMainFrame(int frame_id) OVERRIDE; | 31 virtual void WillBeginMainFrame(int frame_id) override; |
33 virtual void DidBeginMainFrame() OVERRIDE; | 32 virtual void DidBeginMainFrame() override; |
34 virtual void BeginMainFrame(const cc::BeginFrameArgs& args) OVERRIDE; | 33 virtual void BeginMainFrame(const cc::BeginFrameArgs& args) override; |
35 virtual void Layout() OVERRIDE; | 34 virtual void Layout() override; |
36 virtual void ApplyViewportDeltas(const gfx::Vector2d& inner_delta, | 35 virtual void ApplyViewportDeltas(const gfx::Vector2d& inner_delta, |
37 const gfx::Vector2d& outer_delta, | 36 const gfx::Vector2d& outer_delta, |
38 float page_scale, | 37 float page_scale, |
39 float top_controls_delta) OVERRIDE; | 38 float top_controls_delta) override; |
40 virtual void ApplyViewportDeltas(const gfx::Vector2d& scroll_delta, | 39 virtual void ApplyViewportDeltas(const gfx::Vector2d& scroll_delta, |
41 float page_scale, | 40 float page_scale, |
42 float top_controls_delta) OVERRIDE; | 41 float top_controls_delta) override; |
43 virtual void RequestNewOutputSurface(bool fallback) OVERRIDE; | 42 virtual void RequestNewOutputSurface(bool fallback) override; |
44 virtual void DidInitializeOutputSurface() OVERRIDE; | 43 virtual void DidInitializeOutputSurface() override; |
45 virtual void WillCommit() OVERRIDE; | 44 virtual void WillCommit() override; |
46 virtual void DidCommit() OVERRIDE; | 45 virtual void DidCommit() override; |
47 virtual void DidCommitAndDrawFrame() OVERRIDE; | 46 virtual void DidCommitAndDrawFrame() override; |
48 virtual void DidCompleteSwapBuffers() OVERRIDE; | 47 virtual void DidCompleteSwapBuffers() override; |
49 | 48 |
50 private: | 49 private: |
51 void SetupScene(); | 50 void SetupScene(); |
52 | 51 |
53 ScopedMessagePipeHandle command_buffer_handle_; | 52 ScopedMessagePipeHandle command_buffer_handle_; |
54 scoped_ptr<cc::LayerTreeHost> tree_; | 53 scoped_ptr<cc::LayerTreeHost> tree_; |
55 scoped_refptr<cc::Layer> child_layer_; | 54 scoped_refptr<cc::Layer> child_layer_; |
56 base::Thread compositor_thread_; | 55 base::Thread compositor_thread_; |
57 }; | 56 }; |
58 | 57 |
59 } // namespace examples | 58 } // namespace examples |
60 } // namespace mojo | 59 } // namespace mojo |
61 | 60 |
62 #endif // MOJO_EXAMPLES_COMPOSITOR_APP_COMPOSITOR_HOST_H_ | 61 #endif // MOJO_EXAMPLES_COMPOSITOR_APP_COMPOSITOR_HOST_H_ |
OLD | NEW |