| 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/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "cc/debug/rendering_stats.h" | 12 #include "cc/debug/rendering_stats.h" |
| 13 #include "cc/input/top_controls_state.h" | 13 #include "cc/input/top_controls_state.h" |
| 14 #include "cc/trees/layer_tree_host_client.h" | 14 #include "cc/trees/layer_tree_host_client.h" |
| 15 #include "cc/trees/layer_tree_host_single_thread_client.h" |
| 15 #include "cc/trees/layer_tree_settings.h" | 16 #include "cc/trees/layer_tree_settings.h" |
| 16 #include "third_party/WebKit/public/platform/WebLayerTreeView.h" | 17 #include "third_party/WebKit/public/platform/WebLayerTreeView.h" |
| 17 #include "third_party/skia/include/core/SkBitmap.h" | 18 #include "third_party/skia/include/core/SkBitmap.h" |
| 18 #include "ui/gfx/rect.h" | 19 #include "ui/gfx/rect.h" |
| 19 | 20 |
| 20 namespace ui { | 21 namespace ui { |
| 21 struct LatencyInfo; | 22 struct LatencyInfo; |
| 22 } | 23 } |
| 23 | 24 |
| 24 namespace cc { | 25 namespace cc { |
| 25 class InputHandler; | 26 class InputHandler; |
| 26 class Layer; | 27 class Layer; |
| 27 class LayerTreeHost; | 28 class LayerTreeHost; |
| 28 } | 29 } |
| 29 | 30 |
| 30 namespace content { | 31 namespace content { |
| 31 class RenderWidget; | 32 class RenderWidget; |
| 32 | 33 |
| 33 class RenderWidgetCompositor : public WebKit::WebLayerTreeView, | 34 class RenderWidgetCompositor : public WebKit::WebLayerTreeView, |
| 34 public cc::LayerTreeHostClient { | 35 public cc::LayerTreeHostClient, |
| 36 public cc::LayerTreeHostSingleThreadClient { |
| 35 public: | 37 public: |
| 36 // Attempt to construct and initialize a compositor instance for the widget | 38 // Attempt to construct and initialize a compositor instance for the widget |
| 37 // with the given settings. Returns NULL if initialization fails. | 39 // with the given settings. Returns NULL if initialization fails. |
| 38 static scoped_ptr<RenderWidgetCompositor> Create(RenderWidget* widget, | 40 static scoped_ptr<RenderWidgetCompositor> Create(RenderWidget* widget, |
| 39 bool threaded); | 41 bool threaded); |
| 40 | 42 |
| 41 virtual ~RenderWidgetCompositor(); | 43 virtual ~RenderWidgetCompositor(); |
| 42 | 44 |
| 43 const base::WeakPtr<cc::InputHandler>& GetInputHandler(); | 45 const base::WeakPtr<cc::InputHandler>& GetInputHandler(); |
| 44 void SetSuppressScheduleComposite(bool suppress); | 46 void SetSuppressScheduleComposite(bool suppress); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 virtual void Layout() OVERRIDE; | 118 virtual void Layout() OVERRIDE; |
| 117 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, | 119 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, |
| 118 float page_scale) OVERRIDE; | 120 float page_scale) OVERRIDE; |
| 119 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback) | 121 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback) |
| 120 OVERRIDE; | 122 OVERRIDE; |
| 121 virtual void DidInitializeOutputSurface(bool success) OVERRIDE; | 123 virtual void DidInitializeOutputSurface(bool success) OVERRIDE; |
| 122 virtual void WillCommit() OVERRIDE; | 124 virtual void WillCommit() OVERRIDE; |
| 123 virtual void DidCommit() OVERRIDE; | 125 virtual void DidCommit() OVERRIDE; |
| 124 virtual void DidCommitAndDrawFrame() OVERRIDE; | 126 virtual void DidCommitAndDrawFrame() OVERRIDE; |
| 125 virtual void DidCompleteSwapBuffers() OVERRIDE; | 127 virtual void DidCompleteSwapBuffers() OVERRIDE; |
| 126 virtual void ScheduleComposite() OVERRIDE; | |
| 127 virtual scoped_refptr<cc::ContextProvider> | 128 virtual scoped_refptr<cc::ContextProvider> |
| 128 OffscreenContextProvider() OVERRIDE; | 129 OffscreenContextProvider() OVERRIDE; |
| 129 virtual void RateLimitSharedMainThreadContext() OVERRIDE; | 130 virtual void RateLimitSharedMainThreadContext() OVERRIDE; |
| 130 | 131 |
| 132 // cc::LayerTreeHostSingleThreadClient implementation. |
| 133 virtual void ScheduleComposite() OVERRIDE; |
| 134 virtual void DidPostSwapBuffers() OVERRIDE {} |
| 135 virtual void DidAbortSwapBuffers() OVERRIDE {} |
| 136 |
| 131 private: | 137 private: |
| 132 RenderWidgetCompositor(RenderWidget* widget, bool threaded); | 138 RenderWidgetCompositor(RenderWidget* widget, bool threaded); |
| 133 | 139 |
| 134 bool initialize(cc::LayerTreeSettings settings); | 140 bool Initialize(cc::LayerTreeSettings settings); |
| 135 | 141 |
| 136 bool threaded_; | 142 bool threaded_; |
| 137 bool suppress_schedule_composite_; | 143 bool suppress_schedule_composite_; |
| 138 RenderWidget* widget_; | 144 RenderWidget* widget_; |
| 139 scoped_ptr<cc::LayerTreeHost> layer_tree_host_; | 145 scoped_ptr<cc::LayerTreeHost> layer_tree_host_; |
| 140 }; | 146 }; |
| 141 | 147 |
| 142 } // namespace content | 148 } // namespace content |
| 143 | 149 |
| 144 #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ | 150 #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ |
| OLD | NEW |