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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 class RenderWidgetCompositorDelegate; | 46 class RenderWidgetCompositorDelegate; |
47 | 47 |
48 class CONTENT_EXPORT RenderWidgetCompositor | 48 class CONTENT_EXPORT RenderWidgetCompositor |
49 : NON_EXPORTED_BASE(public blink::WebLayerTreeView), | 49 : NON_EXPORTED_BASE(public blink::WebLayerTreeView), |
50 NON_EXPORTED_BASE(public cc::LayerTreeHostClient), | 50 NON_EXPORTED_BASE(public cc::LayerTreeHostClient), |
51 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient), | 51 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient), |
52 NON_EXPORTED_BASE(public cc::RemoteProtoChannel) { | 52 NON_EXPORTED_BASE(public cc::RemoteProtoChannel) { |
53 public: | 53 public: |
54 // Attempt to construct and initialize a compositor instance for the widget | 54 // Attempt to construct and initialize a compositor instance for the widget |
55 // with the given settings. Returns NULL if initialization fails. | 55 // with the given settings. Returns NULL if initialization fails. |
56 static scoped_ptr<RenderWidgetCompositor> Create( | 56 static std::unique_ptr<RenderWidgetCompositor> Create( |
57 RenderWidgetCompositorDelegate* delegate, | 57 RenderWidgetCompositorDelegate* delegate, |
58 float device_scale_factor, | 58 float device_scale_factor, |
59 CompositorDependencies* compositor_deps); | 59 CompositorDependencies* compositor_deps); |
60 | 60 |
61 ~RenderWidgetCompositor() override; | 61 ~RenderWidgetCompositor() override; |
62 | 62 |
63 void SetNeverVisible(); | 63 void SetNeverVisible(); |
64 const base::WeakPtr<cc::InputHandler>& GetInputHandler(); | 64 const base::WeakPtr<cc::InputHandler>& GetInputHandler(); |
65 bool BeginMainFrameRequested() const; | 65 bool BeginMainFrameRequested() const; |
66 void SetNeedsDisplayOnAllLayers(); | 66 void SetNeedsDisplayOnAllLayers(); |
67 void SetRasterizeOnlyVisibleContent(); | 67 void SetRasterizeOnlyVisibleContent(); |
68 void SetNeedsRedrawRect(gfx::Rect damage_rect); | 68 void SetNeedsRedrawRect(gfx::Rect damage_rect); |
69 // Like setNeedsRedraw but forces the frame to be drawn, without early-outs. | 69 // Like setNeedsRedraw but forces the frame to be drawn, without early-outs. |
70 // Redraw will be forced after the next commit | 70 // Redraw will be forced after the next commit |
71 void SetNeedsForcedRedraw(); | 71 void SetNeedsForcedRedraw(); |
72 // Calling CreateLatencyInfoSwapPromiseMonitor() to get a scoped | 72 // Calling CreateLatencyInfoSwapPromiseMonitor() to get a scoped |
73 // LatencyInfoSwapPromiseMonitor. During the life time of the | 73 // LatencyInfoSwapPromiseMonitor. During the life time of the |
74 // LatencyInfoSwapPromiseMonitor, if SetNeedsCommit() or | 74 // LatencyInfoSwapPromiseMonitor, if SetNeedsCommit() or |
75 // SetNeedsUpdateLayers() is called on LayerTreeHost, the original latency | 75 // SetNeedsUpdateLayers() is called on LayerTreeHost, the original latency |
76 // info will be turned into a LatencyInfoSwapPromise. | 76 // info will be turned into a LatencyInfoSwapPromise. |
77 scoped_ptr<cc::SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor( | 77 std::unique_ptr<cc::SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor( |
78 ui::LatencyInfo* latency); | 78 ui::LatencyInfo* latency); |
79 // Calling QueueSwapPromise() to directly queue a SwapPromise into | 79 // Calling QueueSwapPromise() to directly queue a SwapPromise into |
80 // LayerTreeHost. | 80 // LayerTreeHost. |
81 void QueueSwapPromise(scoped_ptr<cc::SwapPromise> swap_promise); | 81 void QueueSwapPromise(std::unique_ptr<cc::SwapPromise> swap_promise); |
82 int GetSourceFrameNumber() const; | 82 int GetSourceFrameNumber() const; |
83 void SetNeedsUpdateLayers(); | 83 void SetNeedsUpdateLayers(); |
84 void SetNeedsCommit(); | 84 void SetNeedsCommit(); |
85 void NotifyInputThrottledUntilCommit(); | 85 void NotifyInputThrottledUntilCommit(); |
86 const cc::Layer* GetRootLayer() const; | 86 const cc::Layer* GetRootLayer() const; |
87 int ScheduleMicroBenchmark( | 87 int ScheduleMicroBenchmark( |
88 const std::string& name, | 88 const std::string& name, |
89 scoped_ptr<base::Value> value, | 89 std::unique_ptr<base::Value> value, |
90 const base::Callback<void(scoped_ptr<base::Value>)>& callback); | 90 const base::Callback<void(std::unique_ptr<base::Value>)>& callback); |
91 bool SendMessageToMicroBenchmark(int id, scoped_ptr<base::Value> value); | 91 bool SendMessageToMicroBenchmark(int id, std::unique_ptr<base::Value> value); |
92 void SetSurfaceIdNamespace(uint32_t surface_id_namespace); | 92 void SetSurfaceIdNamespace(uint32_t surface_id_namespace); |
93 void OnHandleCompositorProto(const std::vector<uint8_t>& proto); | 93 void OnHandleCompositorProto(const std::vector<uint8_t>& proto); |
94 cc::ManagedMemoryPolicy GetGpuMemoryPolicy( | 94 cc::ManagedMemoryPolicy GetGpuMemoryPolicy( |
95 const cc::ManagedMemoryPolicy& policy); | 95 const cc::ManagedMemoryPolicy& policy); |
96 void SetPaintedDeviceScaleFactor(float device_scale); | 96 void SetPaintedDeviceScaleFactor(float device_scale); |
97 | 97 |
98 // WebLayerTreeView implementation. | 98 // WebLayerTreeView implementation. |
99 void setRootLayer(const blink::WebLayer& layer) override; | 99 void setRootLayer(const blink::WebLayer& layer) override; |
100 void clearRootLayer() override; | 100 void clearRootLayer() override; |
101 void attachCompositorAnimationTimeline( | 101 void attachCompositorAnimationTimeline( |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 float top_controls_delta) override; | 166 float top_controls_delta) override; |
167 void RequestNewOutputSurface() override; | 167 void RequestNewOutputSurface() override; |
168 void DidInitializeOutputSurface() override; | 168 void DidInitializeOutputSurface() override; |
169 void DidFailToInitializeOutputSurface() override; | 169 void DidFailToInitializeOutputSurface() override; |
170 void WillCommit() override; | 170 void WillCommit() override; |
171 void DidCommit() override; | 171 void DidCommit() override; |
172 void DidCommitAndDrawFrame() override; | 172 void DidCommitAndDrawFrame() override; |
173 void DidCompleteSwapBuffers() override; | 173 void DidCompleteSwapBuffers() override; |
174 void DidCompletePageScaleAnimation() override; | 174 void DidCompletePageScaleAnimation() override; |
175 void RecordFrameTimingEvents( | 175 void RecordFrameTimingEvents( |
176 scoped_ptr<cc::FrameTimingTracker::CompositeTimingSet> composite_events, | 176 std::unique_ptr<cc::FrameTimingTracker::CompositeTimingSet> |
177 scoped_ptr<cc::FrameTimingTracker::MainFrameTimingSet> main_frame_events) | 177 composite_events, |
178 override; | 178 std::unique_ptr<cc::FrameTimingTracker::MainFrameTimingSet> |
| 179 main_frame_events) override; |
179 | 180 |
180 // cc::LayerTreeHostSingleThreadClient implementation. | 181 // cc::LayerTreeHostSingleThreadClient implementation. |
181 void RequestScheduleAnimation() override; | 182 void RequestScheduleAnimation() override; |
182 void DidPostSwapBuffers() override; | 183 void DidPostSwapBuffers() override; |
183 void DidAbortSwapBuffers() override; | 184 void DidAbortSwapBuffers() override; |
184 | 185 |
185 // cc::RemoteProtoChannel implementation. | 186 // cc::RemoteProtoChannel implementation. |
186 void SetProtoReceiver(ProtoReceiver* receiver) override; | 187 void SetProtoReceiver(ProtoReceiver* receiver) override; |
187 void SendCompositorProto(const cc::proto::CompositorMessage& proto) override; | 188 void SendCompositorProto(const cc::proto::CompositorMessage& proto) override; |
188 | 189 |
(...skipping 13 matching lines...) Expand all Loading... |
202 | 203 |
203 private: | 204 private: |
204 void LayoutAndUpdateLayers(); | 205 void LayoutAndUpdateLayers(); |
205 void InvokeLayoutAndPaintCallback(); | 206 void InvokeLayoutAndPaintCallback(); |
206 bool CompositeIsSynchronous() const; | 207 bool CompositeIsSynchronous() const; |
207 void SynchronouslyComposite(); | 208 void SynchronouslyComposite(); |
208 | 209 |
209 int num_failed_recreate_attempts_; | 210 int num_failed_recreate_attempts_; |
210 RenderWidgetCompositorDelegate* const delegate_; | 211 RenderWidgetCompositorDelegate* const delegate_; |
211 CompositorDependencies* const compositor_deps_; | 212 CompositorDependencies* const compositor_deps_; |
212 scoped_ptr<cc::LayerTreeHost> layer_tree_host_; | 213 std::unique_ptr<cc::LayerTreeHost> layer_tree_host_; |
213 bool never_visible_; | 214 bool never_visible_; |
214 | 215 |
215 blink::WebLayoutAndPaintAsyncCallback* layout_and_paint_async_callback_; | 216 blink::WebLayoutAndPaintAsyncCallback* layout_and_paint_async_callback_; |
216 scoped_ptr<cc::CopyOutputRequest> temporary_copy_output_request_; | 217 std::unique_ptr<cc::CopyOutputRequest> temporary_copy_output_request_; |
217 | 218 |
218 cc::RemoteProtoChannel::ProtoReceiver* remote_proto_channel_receiver_; | 219 cc::RemoteProtoChannel::ProtoReceiver* remote_proto_channel_receiver_; |
219 | 220 |
220 base::WeakPtrFactory<RenderWidgetCompositor> weak_factory_; | 221 base::WeakPtrFactory<RenderWidgetCompositor> weak_factory_; |
221 }; | 222 }; |
222 | 223 |
223 } // namespace content | 224 } // namespace content |
224 | 225 |
225 #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ | 226 #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ |
OLD | NEW |