| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 class Layer; | 35 class Layer; |
| 36 class LayerTreeHost; | 36 class LayerTreeHost; |
| 37 | 37 |
| 38 namespace proto { | 38 namespace proto { |
| 39 class CompositorMessage; | 39 class CompositorMessage; |
| 40 } | 40 } |
| 41 | 41 |
| 42 } | 42 } |
| 43 | 43 |
| 44 namespace content { | 44 namespace content { |
| 45 | 45 class RenderWidget; |
| 46 class RenderWidgetCompositorDelegate; | |
| 47 | 46 |
| 48 class CONTENT_EXPORT RenderWidgetCompositor | 47 class CONTENT_EXPORT RenderWidgetCompositor |
| 49 : NON_EXPORTED_BASE(public blink::WebLayerTreeView), | 48 : NON_EXPORTED_BASE(public blink::WebLayerTreeView), |
| 50 NON_EXPORTED_BASE(public cc::LayerTreeHostClient), | 49 NON_EXPORTED_BASE(public cc::LayerTreeHostClient), |
| 51 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient), | 50 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient), |
| 52 NON_EXPORTED_BASE(public cc::RemoteProtoChannel) { | 51 NON_EXPORTED_BASE(public cc::RemoteProtoChannel) { |
| 53 public: | 52 public: |
| 54 // Attempt to construct and initialize a compositor instance for the widget | 53 // Attempt to construct and initialize a compositor instance for the widget |
| 55 // with the given settings. Returns NULL if initialization fails. | 54 // with the given settings. Returns NULL if initialization fails. |
| 56 static scoped_ptr<RenderWidgetCompositor> Create( | 55 static scoped_ptr<RenderWidgetCompositor> Create( |
| 57 RenderWidgetCompositorDelegate* delegate, | 56 RenderWidget* widget, |
| 58 float device_scale_factor, | |
| 59 CompositorDependencies* compositor_deps); | 57 CompositorDependencies* compositor_deps); |
| 60 | 58 |
| 61 ~RenderWidgetCompositor() override; | 59 ~RenderWidgetCompositor() override; |
| 62 | 60 |
| 63 void SetNeverVisible(); | 61 void SetNeverVisible(); |
| 64 const base::WeakPtr<cc::InputHandler>& GetInputHandler(); | 62 const base::WeakPtr<cc::InputHandler>& GetInputHandler(); |
| 65 bool BeginMainFrameRequested() const; | 63 bool BeginMainFrameRequested() const; |
| 66 void SetNeedsDisplayOnAllLayers(); | 64 void SetNeedsDisplayOnAllLayers(); |
| 67 void SetRasterizeOnlyVisibleContent(); | 65 void SetRasterizeOnlyVisibleContent(); |
| 68 void SetNeedsRedrawRect(gfx::Rect damage_rect); | 66 void SetNeedsRedrawRect(gfx::Rect damage_rect); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 // cc::RemoteProtoChannel implementation. | 177 // cc::RemoteProtoChannel implementation. |
| 180 void SetProtoReceiver(ProtoReceiver* receiver) override; | 178 void SetProtoReceiver(ProtoReceiver* receiver) override; |
| 181 void SendCompositorProto(const cc::proto::CompositorMessage& proto) override; | 179 void SendCompositorProto(const cc::proto::CompositorMessage& proto) override; |
| 182 | 180 |
| 183 enum { | 181 enum { |
| 184 OUTPUT_SURFACE_RETRIES_BEFORE_FALLBACK = 4, | 182 OUTPUT_SURFACE_RETRIES_BEFORE_FALLBACK = 4, |
| 185 MAX_OUTPUT_SURFACE_RETRIES = 5, | 183 MAX_OUTPUT_SURFACE_RETRIES = 5, |
| 186 }; | 184 }; |
| 187 | 185 |
| 188 protected: | 186 protected: |
| 189 RenderWidgetCompositor(RenderWidgetCompositorDelegate* delegate, | 187 RenderWidgetCompositor(RenderWidget* widget, |
| 190 CompositorDependencies* compositor_deps); | 188 CompositorDependencies* compositor_deps); |
| 191 | 189 |
| 192 void Initialize(float device_scale_factor); | 190 void Initialize(); |
| 193 cc::LayerTreeHost* layer_tree_host() { return layer_tree_host_.get(); } | 191 cc::LayerTreeHost* layer_tree_host() { return layer_tree_host_.get(); } |
| 194 | 192 |
| 195 private: | 193 private: |
| 196 void LayoutAndUpdateLayers(); | 194 void LayoutAndUpdateLayers(); |
| 197 void InvokeLayoutAndPaintCallback(); | 195 void InvokeLayoutAndPaintCallback(); |
| 198 bool CompositeIsSynchronous() const; | 196 bool CompositeIsSynchronous() const; |
| 199 void SynchronouslyComposite(); | 197 void SynchronouslyComposite(); |
| 200 | 198 |
| 201 int num_failed_recreate_attempts_; | 199 int num_failed_recreate_attempts_; |
| 202 RenderWidgetCompositorDelegate* const delegate_; | 200 RenderWidget* widget_; |
| 203 CompositorDependencies* const compositor_deps_; | 201 CompositorDependencies* compositor_deps_; |
| 204 scoped_ptr<cc::LayerTreeHost> layer_tree_host_; | 202 scoped_ptr<cc::LayerTreeHost> layer_tree_host_; |
| 205 bool never_visible_; | 203 bool never_visible_; |
| 206 | 204 |
| 207 blink::WebLayoutAndPaintAsyncCallback* layout_and_paint_async_callback_; | 205 blink::WebLayoutAndPaintAsyncCallback* layout_and_paint_async_callback_; |
| 208 scoped_ptr<cc::CopyOutputRequest> temporary_copy_output_request_; | 206 scoped_ptr<cc::CopyOutputRequest> temporary_copy_output_request_; |
| 209 | 207 |
| 210 cc::RemoteProtoChannel::ProtoReceiver* remote_proto_channel_receiver_; | 208 cc::RemoteProtoChannel::ProtoReceiver* remote_proto_channel_receiver_; |
| 211 | 209 |
| 212 base::WeakPtrFactory<RenderWidgetCompositor> weak_factory_; | 210 base::WeakPtrFactory<RenderWidgetCompositor> weak_factory_; |
| 213 }; | 211 }; |
| 214 | 212 |
| 215 } // namespace content | 213 } // namespace content |
| 216 | 214 |
| 217 #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ | 215 #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ |
| OLD | NEW |