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 struct LatencyInfo; | 22 struct LatencyInfo; |
21 } | 23 } |
22 | 24 |
23 namespace content { | 25 namespace content { |
24 class RenderWidget; | 26 class RenderWidget; |
25 | 27 |
26 class RenderWidgetCompositor : public WebKit::WebLayerTreeView, | 28 class RenderWidgetCompositor : public WebKit::WebLayerTreeView, |
27 public cc::LayerTreeHostClient { | 29 public cc::LayerTreeHostClient { |
28 public: | 30 public: |
29 // Attempt to construct and initialize a compositor instance for the widget | 31 // Attempt to construct and initialize a compositor instance for the widget |
30 // with the given settings. Returns NULL if initialization fails. | 32 // with the given settings. Returns NULL if initialization fails. |
31 static scoped_ptr<RenderWidgetCompositor> Create(RenderWidget* widget); | 33 static scoped_ptr<RenderWidgetCompositor> Create(RenderWidget* widget); |
32 | 34 |
33 virtual ~RenderWidgetCompositor(); | 35 virtual ~RenderWidgetCompositor(); |
34 | 36 |
| 37 const base::WeakPtr<cc::InputHandler>& GetInputHandler(); |
35 void SetSuppressScheduleComposite(bool suppress); | 38 void SetSuppressScheduleComposite(bool suppress); |
36 void Animate(base::TimeTicks time); | 39 void Animate(base::TimeTicks time); |
37 void Composite(base::TimeTicks frame_begin_time); | 40 void Composite(base::TimeTicks frame_begin_time); |
38 void SetNeedsDisplayOnAllLayers(); | 41 void SetNeedsDisplayOnAllLayers(); |
39 void SetRasterizeOnlyVisibleContent(); | 42 void SetRasterizeOnlyVisibleContent(); |
40 void GetRenderingStats(cc::RenderingStats* stats); | 43 void GetRenderingStats(cc::RenderingStats* stats); |
41 skia::RefPtr<SkPicture> CapturePicture(); | 44 skia::RefPtr<SkPicture> CapturePicture(); |
42 void UpdateTopControlsState(bool enable_hiding, | 45 void UpdateTopControlsState(bool enable_hiding, |
43 bool enable_showing, | 46 bool enable_showing, |
44 bool animate); | 47 bool animate); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 88 |
86 // cc::LayerTreeHostClient implementation. | 89 // cc::LayerTreeHostClient implementation. |
87 virtual void WillBeginFrame() OVERRIDE; | 90 virtual void WillBeginFrame() OVERRIDE; |
88 virtual void DidBeginFrame() OVERRIDE; | 91 virtual void DidBeginFrame() OVERRIDE; |
89 virtual void Animate(double frame_begin_time) OVERRIDE; | 92 virtual void Animate(double frame_begin_time) OVERRIDE; |
90 virtual void Layout() OVERRIDE; | 93 virtual void Layout() OVERRIDE; |
91 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, | 94 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, |
92 float page_scale) OVERRIDE; | 95 float page_scale) OVERRIDE; |
93 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface() OVERRIDE; | 96 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface() OVERRIDE; |
94 virtual void DidInitializeOutputSurface(bool success) OVERRIDE; | 97 virtual void DidInitializeOutputSurface(bool success) OVERRIDE; |
95 virtual scoped_ptr<cc::InputHandlerClient> CreateInputHandlerClient() | |
96 OVERRIDE; | |
97 virtual void WillCommit() OVERRIDE; | 98 virtual void WillCommit() OVERRIDE; |
98 virtual void DidCommit() OVERRIDE; | 99 virtual void DidCommit() OVERRIDE; |
99 virtual void DidCommitAndDrawFrame() OVERRIDE; | 100 virtual void DidCommitAndDrawFrame() OVERRIDE; |
100 virtual void DidCompleteSwapBuffers() OVERRIDE; | 101 virtual void DidCompleteSwapBuffers() OVERRIDE; |
101 virtual void ScheduleComposite() OVERRIDE; | 102 virtual void ScheduleComposite() OVERRIDE; |
102 virtual scoped_refptr<cc::ContextProvider> | 103 virtual scoped_refptr<cc::ContextProvider> |
103 OffscreenContextProviderForMainThread() OVERRIDE; | 104 OffscreenContextProviderForMainThread() OVERRIDE; |
104 virtual scoped_refptr<cc::ContextProvider> | 105 virtual scoped_refptr<cc::ContextProvider> |
105 OffscreenContextProviderForCompositorThread() OVERRIDE; | 106 OffscreenContextProviderForCompositorThread() OVERRIDE; |
106 | 107 |
107 private: | 108 private: |
108 explicit RenderWidgetCompositor(RenderWidget* widget); | 109 explicit RenderWidgetCompositor(RenderWidget* widget); |
109 | 110 |
110 bool initialize(cc::LayerTreeSettings settings); | 111 bool initialize(cc::LayerTreeSettings settings); |
111 | 112 |
112 bool threaded_; | 113 bool threaded_; |
113 bool suppress_schedule_composite_; | 114 bool suppress_schedule_composite_; |
114 RenderWidget* widget_; | 115 RenderWidget* widget_; |
115 scoped_ptr<cc::LayerTreeHost> layer_tree_host_; | 116 scoped_ptr<cc::LayerTreeHost> layer_tree_host_; |
116 }; | 117 }; |
117 | 118 |
118 } // namespace content | 119 } // namespace content |
119 | 120 |
120 #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ | 121 #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ |
OLD | NEW |