| 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" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient) { | 42 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient) { |
| 43 public: | 43 public: |
| 44 // Attempt to construct and initialize a compositor instance for the widget | 44 // Attempt to construct and initialize a compositor instance for the widget |
| 45 // with the given settings. Returns NULL if initialization fails. | 45 // with the given settings. Returns NULL if initialization fails. |
| 46 static scoped_ptr<RenderWidgetCompositor> Create( | 46 static scoped_ptr<RenderWidgetCompositor> Create( |
| 47 RenderWidget* widget, | 47 RenderWidget* widget, |
| 48 CompositorDependencies* compositor_deps); | 48 CompositorDependencies* compositor_deps); |
| 49 | 49 |
| 50 ~RenderWidgetCompositor() override; | 50 ~RenderWidgetCompositor() override; |
| 51 | 51 |
| 52 void SetNeverVisible(); |
| 52 const base::WeakPtr<cc::InputHandler>& GetInputHandler(); | 53 const base::WeakPtr<cc::InputHandler>& GetInputHandler(); |
| 53 bool BeginMainFrameRequested() const; | 54 bool BeginMainFrameRequested() const; |
| 54 void SetNeedsDisplayOnAllLayers(); | 55 void SetNeedsDisplayOnAllLayers(); |
| 55 void SetRasterizeOnlyVisibleContent(); | 56 void SetRasterizeOnlyVisibleContent(); |
| 56 void SetNeedsRedrawRect(gfx::Rect damage_rect); | 57 void SetNeedsRedrawRect(gfx::Rect damage_rect); |
| 57 // Like setNeedsRedraw but forces the frame to be drawn, without early-outs. | 58 // Like setNeedsRedraw but forces the frame to be drawn, without early-outs. |
| 58 // Redraw will be forced after the next commit | 59 // Redraw will be forced after the next commit |
| 59 void SetNeedsForcedRedraw(); | 60 void SetNeedsForcedRedraw(); |
| 60 // Calling CreateLatencyInfoSwapPromiseMonitor() to get a scoped | 61 // Calling CreateLatencyInfoSwapPromiseMonitor() to get a scoped |
| 61 // LatencyInfoSwapPromiseMonitor. During the life time of the | 62 // LatencyInfoSwapPromiseMonitor. During the life time of the |
| 62 // LatencyInfoSwapPromiseMonitor, if SetNeedsCommit() or | 63 // LatencyInfoSwapPromiseMonitor, if SetNeedsCommit() or |
| 63 // SetNeedsUpdateLayers() is called on LayerTreeHost, the original latency | 64 // SetNeedsUpdateLayers() is called on LayerTreeHost, the original latency |
| 64 // info will be turned into a LatencyInfoSwapPromise. | 65 // info will be turned into a LatencyInfoSwapPromise. |
| 65 scoped_ptr<cc::SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor( | 66 scoped_ptr<cc::SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor( |
| 66 ui::LatencyInfo* latency); | 67 ui::LatencyInfo* latency); |
| 67 // Calling QueueSwapPromise() to directly queue a SwapPromise into | 68 // Calling QueueSwapPromise() to directly queue a SwapPromise into |
| 68 // LayerTreeHost. | 69 // LayerTreeHost. |
| 69 void QueueSwapPromise(scoped_ptr<cc::SwapPromise> swap_promise); | 70 void QueueSwapPromise(scoped_ptr<cc::SwapPromise> swap_promise); |
| 70 int GetSourceFrameNumber() const; | 71 int GetSourceFrameNumber() const; |
| 71 void SetNeedsUpdateLayers(); | 72 void SetNeedsUpdateLayers(); |
| 72 void SetNeedsCommit(); | 73 void SetNeedsCommit(); |
| 73 void NotifyInputThrottledUntilCommit(); | 74 void NotifyInputThrottledUntilCommit(); |
| 74 const cc::Layer* GetRootLayer() const; | 75 const cc::Layer* GetRootLayer() const; |
| 75 int ScheduleMicroBenchmark( | 76 int ScheduleMicroBenchmark( |
| 76 const std::string& name, | 77 const std::string& name, |
| 77 scoped_ptr<base::Value> value, | 78 scoped_ptr<base::Value> value, |
| 78 const base::Callback<void(scoped_ptr<base::Value>)>& callback); | 79 const base::Callback<void(scoped_ptr<base::Value>)>& callback); |
| 79 bool SendMessageToMicroBenchmark(int id, scoped_ptr<base::Value> value); | 80 bool SendMessageToMicroBenchmark(int id, scoped_ptr<base::Value> value); |
| 80 void StartCompositor(); | |
| 81 void SetSurfaceIdNamespace(uint32_t surface_id_namespace); | 81 void SetSurfaceIdNamespace(uint32_t surface_id_namespace); |
| 82 cc::ManagedMemoryPolicy GetGpuMemoryPolicy( | 82 cc::ManagedMemoryPolicy GetGpuMemoryPolicy( |
| 83 const cc::ManagedMemoryPolicy& policy); | 83 const cc::ManagedMemoryPolicy& policy); |
| 84 | 84 |
| 85 // WebLayerTreeView implementation. | 85 // WebLayerTreeView implementation. |
| 86 void setRootLayer(const blink::WebLayer& layer) override; | 86 void setRootLayer(const blink::WebLayer& layer) override; |
| 87 void clearRootLayer() override; | 87 void clearRootLayer() override; |
| 88 void attachCompositorAnimationTimeline( | 88 void attachCompositorAnimationTimeline( |
| 89 blink::WebCompositorAnimationTimeline* compositor_timeline) override; | 89 blink::WebCompositorAnimationTimeline* compositor_timeline) override; |
| 90 void detachCompositorAnimationTimeline( | 90 void detachCompositorAnimationTimeline( |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 private: | 182 private: |
| 183 void LayoutAndUpdateLayers(); | 183 void LayoutAndUpdateLayers(); |
| 184 void InvokeLayoutAndPaintCallback(); | 184 void InvokeLayoutAndPaintCallback(); |
| 185 bool CompositeIsSynchronous() const; | 185 bool CompositeIsSynchronous() const; |
| 186 void SynchronouslyComposite(); | 186 void SynchronouslyComposite(); |
| 187 | 187 |
| 188 int num_failed_recreate_attempts_; | 188 int num_failed_recreate_attempts_; |
| 189 RenderWidget* widget_; | 189 RenderWidget* widget_; |
| 190 CompositorDependencies* compositor_deps_; | 190 CompositorDependencies* compositor_deps_; |
| 191 scoped_ptr<cc::LayerTreeHost> layer_tree_host_; | 191 scoped_ptr<cc::LayerTreeHost> layer_tree_host_; |
| 192 bool never_visible_; |
| 192 | 193 |
| 193 blink::WebLayoutAndPaintAsyncCallback* layout_and_paint_async_callback_; | 194 blink::WebLayoutAndPaintAsyncCallback* layout_and_paint_async_callback_; |
| 194 scoped_ptr<cc::CopyOutputRequest> temporary_copy_output_request_; | 195 scoped_ptr<cc::CopyOutputRequest> temporary_copy_output_request_; |
| 195 | 196 |
| 196 base::WeakPtrFactory<RenderWidgetCompositor> weak_factory_; | 197 base::WeakPtrFactory<RenderWidgetCompositor> weak_factory_; |
| 197 }; | 198 }; |
| 198 | 199 |
| 199 } // namespace content | 200 } // namespace content |
| 200 | 201 |
| 201 #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ | 202 #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ |
| OLD | NEW |