| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 class ColorSpace; | 43 class ColorSpace; |
| 44 } | 44 } |
| 45 | 45 |
| 46 namespace ui { | 46 namespace ui { |
| 47 class LatencyInfo; | 47 class LatencyInfo; |
| 48 } | 48 } |
| 49 | 49 |
| 50 namespace content { | 50 namespace content { |
| 51 | 51 |
| 52 class RenderWidgetCompositorDelegate; | 52 class RenderWidgetCompositorDelegate; |
| 53 struct ScreenInfo; |
| 53 | 54 |
| 54 class CONTENT_EXPORT RenderWidgetCompositor | 55 class CONTENT_EXPORT RenderWidgetCompositor |
| 55 : NON_EXPORTED_BASE(public blink::WebLayerTreeView), | 56 : NON_EXPORTED_BASE(public blink::WebLayerTreeView), |
| 56 NON_EXPORTED_BASE(public cc::LayerTreeHostClient), | 57 NON_EXPORTED_BASE(public cc::LayerTreeHostClient), |
| 57 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient), | 58 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient), |
| 58 public RemoteProtoChannel { | 59 public RemoteProtoChannel { |
| 59 public: | 60 public: |
| 60 // Attempt to construct and initialize a compositor instance for the widget | 61 // Attempt to construct and initialize a compositor instance for the widget |
| 61 // with the given settings. Returns NULL if initialization fails. | 62 // with the given settings. Returns NULL if initialization fails. |
| 62 static std::unique_ptr<RenderWidgetCompositor> Create( | 63 static std::unique_ptr<RenderWidgetCompositor> Create( |
| 63 RenderWidgetCompositorDelegate* delegate, | 64 RenderWidgetCompositorDelegate* delegate, |
| 64 float device_scale_factor, | 65 float device_scale_factor, |
| 66 const ScreenInfo& screen_info, |
| 65 CompositorDependencies* compositor_deps); | 67 CompositorDependencies* compositor_deps); |
| 66 | 68 |
| 67 ~RenderWidgetCompositor() override; | 69 ~RenderWidgetCompositor() override; |
| 68 | 70 |
| 69 static cc::LayerTreeSettings GenerateLayerTreeSettings( | 71 static cc::LayerTreeSettings GenerateLayerTreeSettings( |
| 70 const base::CommandLine& cmd, | 72 const base::CommandLine& cmd, |
| 71 CompositorDependencies* compositor_deps, | 73 CompositorDependencies* compositor_deps, |
| 72 float device_scale_factor); | 74 float device_scale_factor, |
| 75 const ScreenInfo& screen_info); |
| 73 static cc::ManagedMemoryPolicy GetGpuMemoryPolicy( | 76 static cc::ManagedMemoryPolicy GetGpuMemoryPolicy( |
| 74 const cc::ManagedMemoryPolicy& policy); | 77 const cc::ManagedMemoryPolicy& policy); |
| 75 | 78 |
| 76 void SetNeverVisible(); | 79 void SetNeverVisible(); |
| 77 const base::WeakPtr<cc::InputHandler>& GetInputHandler(); | 80 const base::WeakPtr<cc::InputHandler>& GetInputHandler(); |
| 78 bool BeginMainFrameRequested() const; | 81 bool BeginMainFrameRequested() const; |
| 79 void SetNeedsDisplayOnAllLayers(); | 82 void SetNeedsDisplayOnAllLayers(); |
| 80 void SetRasterizeOnlyVisibleContent(); | 83 void SetRasterizeOnlyVisibleContent(); |
| 81 void SetNeedsRedrawRect(gfx::Rect damage_rect); | 84 void SetNeedsRedrawRect(gfx::Rect damage_rect); |
| 82 // Like setNeedsRedraw but forces the frame to be drawn, without early-outs. | 85 // Like setNeedsRedraw but forces the frame to be drawn, without early-outs. |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 COMPOSITOR_FRAME_SINK_RETRIES_BEFORE_FALLBACK = 4, | 205 COMPOSITOR_FRAME_SINK_RETRIES_BEFORE_FALLBACK = 4, |
| 203 MAX_COMPOSITOR_FRAME_SINK_RETRIES = 5, | 206 MAX_COMPOSITOR_FRAME_SINK_RETRIES = 5, |
| 204 }; | 207 }; |
| 205 | 208 |
| 206 protected: | 209 protected: |
| 207 friend class RenderViewImplScaleFactorTest; | 210 friend class RenderViewImplScaleFactorTest; |
| 208 | 211 |
| 209 RenderWidgetCompositor(RenderWidgetCompositorDelegate* delegate, | 212 RenderWidgetCompositor(RenderWidgetCompositorDelegate* delegate, |
| 210 CompositorDependencies* compositor_deps); | 213 CompositorDependencies* compositor_deps); |
| 211 | 214 |
| 212 void Initialize(float device_scale_factor); | 215 void Initialize(float device_scale_factor, const ScreenInfo& screen_info); |
| 213 cc::LayerTreeHost* layer_tree_host() { return layer_tree_host_.get(); } | 216 cc::LayerTreeHost* layer_tree_host() { return layer_tree_host_.get(); } |
| 214 | 217 |
| 215 private: | 218 private: |
| 216 void LayoutAndUpdateLayers(); | 219 void LayoutAndUpdateLayers(); |
| 217 void InvokeLayoutAndPaintCallback(); | 220 void InvokeLayoutAndPaintCallback(); |
| 218 bool CompositeIsSynchronous() const; | 221 bool CompositeIsSynchronous() const; |
| 219 void SynchronouslyComposite(); | 222 void SynchronouslyComposite(); |
| 220 | 223 |
| 221 int num_failed_recreate_attempts_; | 224 int num_failed_recreate_attempts_; |
| 222 RenderWidgetCompositorDelegate* const delegate_; | 225 RenderWidgetCompositorDelegate* const delegate_; |
| 223 CompositorDependencies* const compositor_deps_; | 226 CompositorDependencies* const compositor_deps_; |
| 224 const bool threaded_; | 227 const bool threaded_; |
| 225 std::unique_ptr<cc::AnimationHost> animation_host_; | 228 std::unique_ptr<cc::AnimationHost> animation_host_; |
| 226 std::unique_ptr<cc::LayerTreeHost> layer_tree_host_; | 229 std::unique_ptr<cc::LayerTreeHost> layer_tree_host_; |
| 227 bool never_visible_; | 230 bool never_visible_; |
| 228 | 231 |
| 229 blink::WebLayoutAndPaintAsyncCallback* layout_and_paint_async_callback_; | 232 blink::WebLayoutAndPaintAsyncCallback* layout_and_paint_async_callback_; |
| 230 | 233 |
| 231 RemoteProtoChannel::ProtoReceiver* remote_proto_channel_receiver_; | 234 RemoteProtoChannel::ProtoReceiver* remote_proto_channel_receiver_; |
| 232 | 235 |
| 233 base::WeakPtrFactory<RenderWidgetCompositor> weak_factory_; | 236 base::WeakPtrFactory<RenderWidgetCompositor> weak_factory_; |
| 234 }; | 237 }; |
| 235 | 238 |
| 236 } // namespace content | 239 } // namespace content |
| 237 | 240 |
| 238 #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ | 241 #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ |
| OLD | NEW |