OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ | 5 #ifndef CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ |
6 #define CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ | 6 #define CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ |
7 | 7 |
| 8 #include "base/memory/weak_ptr.h" |
8 #include "base/time.h" | 9 #include "base/time.h" |
9 #include "cc/debug/rendering_stats.h" | 10 #include "cc/debug/rendering_stats.h" |
10 #include "cc/trees/layer_tree_host_client.h" | 11 #include "cc/trees/layer_tree_host_client.h" |
11 #include "cc/trees/layer_tree_settings.h" | 12 #include "cc/trees/layer_tree_settings.h" |
12 #include "skia/ext/refptr.h" | 13 #include "skia/ext/refptr.h" |
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" | 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" |
14 #include "ui/gfx/rect.h" | 15 #include "ui/gfx/rect.h" |
15 | 16 |
16 class SkPicture; | 17 class SkPicture; |
17 | 18 |
18 namespace cc { | 19 namespace cc { |
| 20 class InputHandler; |
19 class LayerTreeHost; | 21 class LayerTreeHost; |
20 } | 22 } |
21 | 23 |
22 namespace content { | 24 namespace content { |
23 class RenderWidget; | 25 class RenderWidget; |
24 | 26 |
25 class RenderWidgetCompositor : public WebKit::WebLayerTreeView, | 27 class RenderWidgetCompositor : public WebKit::WebLayerTreeView, |
26 public cc::LayerTreeHostClient { | 28 public cc::LayerTreeHostClient { |
27 public: | 29 public: |
28 // Attempt to construct and initialize a compositor instance for the widget | 30 // Attempt to construct and initialize a compositor instance for the widget |
29 // with the given settings. Returns NULL if initialization fails. | 31 // with the given settings. Returns NULL if initialization fails. |
30 static scoped_ptr<RenderWidgetCompositor> Create(RenderWidget* widget); | 32 static scoped_ptr<RenderWidgetCompositor> Create(RenderWidget* widget); |
31 | 33 |
32 virtual ~RenderWidgetCompositor(); | 34 virtual ~RenderWidgetCompositor(); |
33 | 35 |
| 36 const base::WeakPtr<cc::InputHandler>& GetInputHandler(); |
34 void SetSuppressScheduleComposite(bool suppress); | 37 void SetSuppressScheduleComposite(bool suppress); |
35 void Animate(base::TimeTicks time); | 38 void Animate(base::TimeTicks time); |
36 void Composite(base::TimeTicks frame_begin_time); | 39 void Composite(base::TimeTicks frame_begin_time); |
37 void SetNeedsDisplayOnAllLayers(); | 40 void SetNeedsDisplayOnAllLayers(); |
38 void GetRenderingStats(cc::RenderingStats* stats); | 41 void GetRenderingStats(cc::RenderingStats* stats); |
39 skia::RefPtr<SkPicture> CapturePicture(); | 42 skia::RefPtr<SkPicture> CapturePicture(); |
40 void UpdateTopControlsState(bool enable_hiding, | 43 void UpdateTopControlsState(bool enable_hiding, |
41 bool enable_showing, | 44 bool enable_showing, |
42 bool animate); | 45 bool animate); |
43 void SetOverdrawBottomHeight(float overdraw_bottom_height); | 46 void SetOverdrawBottomHeight(float overdraw_bottom_height); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 85 |
83 // cc::LayerTreeHostClient implementation. | 86 // cc::LayerTreeHostClient implementation. |
84 virtual void WillBeginFrame() OVERRIDE; | 87 virtual void WillBeginFrame() OVERRIDE; |
85 virtual void DidBeginFrame() OVERRIDE; | 88 virtual void DidBeginFrame() OVERRIDE; |
86 virtual void Animate(double frame_begin_time) OVERRIDE; | 89 virtual void Animate(double frame_begin_time) OVERRIDE; |
87 virtual void Layout() OVERRIDE; | 90 virtual void Layout() OVERRIDE; |
88 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, | 91 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, |
89 float page_scale) OVERRIDE; | 92 float page_scale) OVERRIDE; |
90 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface() OVERRIDE; | 93 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface() OVERRIDE; |
91 virtual void DidRecreateOutputSurface(bool success) OVERRIDE; | 94 virtual void DidRecreateOutputSurface(bool success) OVERRIDE; |
92 virtual scoped_ptr<cc::InputHandlerClient> CreateInputHandlerClient() | |
93 OVERRIDE; | |
94 virtual void WillCommit() OVERRIDE; | 95 virtual void WillCommit() OVERRIDE; |
95 virtual void DidCommit() OVERRIDE; | 96 virtual void DidCommit() OVERRIDE; |
96 virtual void DidCommitAndDrawFrame() OVERRIDE; | 97 virtual void DidCommitAndDrawFrame() OVERRIDE; |
97 virtual void DidCompleteSwapBuffers() OVERRIDE; | 98 virtual void DidCompleteSwapBuffers() OVERRIDE; |
98 virtual void ScheduleComposite() OVERRIDE; | 99 virtual void ScheduleComposite() OVERRIDE; |
99 virtual scoped_refptr<cc::ContextProvider> | 100 virtual scoped_refptr<cc::ContextProvider> |
100 OffscreenContextProviderForMainThread() OVERRIDE; | 101 OffscreenContextProviderForMainThread() OVERRIDE; |
101 virtual scoped_refptr<cc::ContextProvider> | 102 virtual scoped_refptr<cc::ContextProvider> |
102 OffscreenContextProviderForCompositorThread() OVERRIDE; | 103 OffscreenContextProviderForCompositorThread() OVERRIDE; |
103 | 104 |
104 private: | 105 private: |
105 explicit RenderWidgetCompositor(RenderWidget* widget); | 106 explicit RenderWidgetCompositor(RenderWidget* widget); |
106 | 107 |
107 bool initialize(cc::LayerTreeSettings settings); | 108 bool initialize(cc::LayerTreeSettings settings); |
108 | 109 |
109 bool threaded_; | 110 bool threaded_; |
110 bool suppress_schedule_composite_; | 111 bool suppress_schedule_composite_; |
111 RenderWidget* widget_; | 112 RenderWidget* widget_; |
112 scoped_ptr<cc::LayerTreeHost> layer_tree_host_; | 113 scoped_ptr<cc::LayerTreeHost> layer_tree_host_; |
113 }; | 114 }; |
114 | 115 |
115 } // namespace content | 116 } // namespace content |
116 | 117 |
117 #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ | 118 #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ |
OLD | NEW |