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