| 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 GetRenderingStats(cc::RenderingStats* stats); | 42 void GetRenderingStats(cc::RenderingStats* stats); |
| 40 skia::RefPtr<SkPicture> CapturePicture(); | 43 skia::RefPtr<SkPicture> CapturePicture(); |
| 41 void UpdateTopControlsState(bool enable_hiding, | 44 void UpdateTopControlsState(bool enable_hiding, |
| 42 bool enable_showing, | 45 bool enable_showing, |
| 43 bool animate); | 46 bool animate); |
| 44 void SetOverdrawBottomHeight(float overdraw_bottom_height); | 47 void SetOverdrawBottomHeight(float overdraw_bottom_height); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 87 |
| 85 // cc::LayerTreeHostClient implementation. | 88 // cc::LayerTreeHostClient implementation. |
| 86 virtual void WillBeginFrame() OVERRIDE; | 89 virtual void WillBeginFrame() OVERRIDE; |
| 87 virtual void DidBeginFrame() OVERRIDE; | 90 virtual void DidBeginFrame() OVERRIDE; |
| 88 virtual void Animate(double frame_begin_time) OVERRIDE; | 91 virtual void Animate(double frame_begin_time) OVERRIDE; |
| 89 virtual void Layout() OVERRIDE; | 92 virtual void Layout() OVERRIDE; |
| 90 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, | 93 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, |
| 91 float page_scale) OVERRIDE; | 94 float page_scale) OVERRIDE; |
| 92 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface() OVERRIDE; | 95 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface() OVERRIDE; |
| 93 virtual void DidInitializeOutputSurface(bool success) OVERRIDE; | 96 virtual void DidInitializeOutputSurface(bool success) OVERRIDE; |
| 94 virtual scoped_ptr<cc::InputHandlerClient> CreateInputHandlerClient() | |
| 95 OVERRIDE; | |
| 96 virtual void WillCommit() OVERRIDE; | 97 virtual void WillCommit() OVERRIDE; |
| 97 virtual void DidCommit() OVERRIDE; | 98 virtual void DidCommit() OVERRIDE; |
| 98 virtual void DidCommitAndDrawFrame() OVERRIDE; | 99 virtual void DidCommitAndDrawFrame() OVERRIDE; |
| 99 virtual void DidCompleteSwapBuffers() OVERRIDE; | 100 virtual void DidCompleteSwapBuffers() OVERRIDE; |
| 100 virtual void ScheduleComposite() OVERRIDE; | 101 virtual void ScheduleComposite() OVERRIDE; |
| 101 virtual scoped_refptr<cc::ContextProvider> | 102 virtual scoped_refptr<cc::ContextProvider> |
| 102 OffscreenContextProviderForMainThread() OVERRIDE; | 103 OffscreenContextProviderForMainThread() OVERRIDE; |
| 103 virtual scoped_refptr<cc::ContextProvider> | 104 virtual scoped_refptr<cc::ContextProvider> |
| 104 OffscreenContextProviderForCompositorThread() OVERRIDE; | 105 OffscreenContextProviderForCompositorThread() OVERRIDE; |
| 105 | 106 |
| 106 private: | 107 private: |
| 107 explicit RenderWidgetCompositor(RenderWidget* widget); | 108 explicit RenderWidgetCompositor(RenderWidget* widget); |
| 108 | 109 |
| 109 bool initialize(cc::LayerTreeSettings settings); | 110 bool initialize(cc::LayerTreeSettings settings); |
| 110 | 111 |
| 111 bool threaded_; | 112 bool threaded_; |
| 112 bool suppress_schedule_composite_; | 113 bool suppress_schedule_composite_; |
| 113 RenderWidget* widget_; | 114 RenderWidget* widget_; |
| 114 scoped_ptr<cc::LayerTreeHost> layer_tree_host_; | 115 scoped_ptr<cc::LayerTreeHost> layer_tree_host_; |
| 115 }; | 116 }; |
| 116 | 117 |
| 117 } // namespace content | 118 } // namespace content |
| 118 | 119 |
| 119 #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ | 120 #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ |
| OLD | NEW |