OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_BROWSER_COMPOSITOR_DELEGATED_FRAME_HOST_H_ | 5 #ifndef CONTENT_BROWSER_COMPOSITOR_DELEGATED_FRAME_HOST_H_ |
6 #define CONTENT_BROWSER_COMPOSITOR_DELEGATED_FRAME_HOST_H_ | 6 #define CONTENT_BROWSER_COMPOSITOR_DELEGATED_FRAME_HOST_H_ |
7 | 7 |
8 #include "cc/layers/delegated_frame_provider.h" | 8 #include "cc/layers/delegated_frame_provider.h" |
9 #include "cc/layers/delegated_frame_resource_collection.h" | 9 #include "cc/layers/delegated_frame_resource_collection.h" |
10 #include "cc/output/copy_output_result.h" | 10 #include "cc/output/copy_output_result.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 request_copy_of_output_callback_for_testing_ = callback; | 130 request_copy_of_output_callback_for_testing_ = callback; |
131 } | 131 } |
132 | 132 |
133 private: | 133 private: |
134 friend class DelegatedFrameHostClient; | 134 friend class DelegatedFrameHostClient; |
135 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, | 135 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, |
136 SkippedDelegatedFrames); | 136 SkippedDelegatedFrames); |
137 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, | 137 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, |
138 DiscardDelegatedFramesWithLocking); | 138 DiscardDelegatedFramesWithLocking); |
139 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraCopyRequestTest, | 139 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraCopyRequestTest, |
140 DedupeFrameSubscriberRequests); | |
141 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraCopyRequestTest, | |
142 DestroyedAfterCopyRequest); | 140 DestroyedAfterCopyRequest); |
143 | 141 |
144 RenderWidgetHostViewFrameSubscriber* frame_subscriber() const { | 142 RenderWidgetHostViewFrameSubscriber* frame_subscriber() const { |
145 return frame_subscriber_.get(); | 143 return frame_subscriber_.get(); |
146 } | 144 } |
147 bool ShouldCreateResizeLock(); | 145 bool ShouldCreateResizeLock(); |
148 void LockResources(); | 146 void LockResources(); |
149 void UnlockResources(); | 147 void UnlockResources(); |
150 void RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request); | 148 void RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request); |
151 | 149 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 221 |
224 // DelegatedFrameEvictorClient implementation. | 222 // DelegatedFrameEvictorClient implementation. |
225 void EvictDelegatedFrame() override; | 223 void EvictDelegatedFrame() override; |
226 | 224 |
227 // cc::DelegatedFrameProviderClient implementation. | 225 // cc::DelegatedFrameProviderClient implementation. |
228 void UnusedResourcesAreAvailable() override; | 226 void UnusedResourcesAreAvailable() override; |
229 | 227 |
230 // cc::SurfaceFactoryClient implementation. | 228 // cc::SurfaceFactoryClient implementation. |
231 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | 229 void ReturnResources(const cc::ReturnedResourceArray& resources) override; |
232 | 230 |
233 // Called to consult the current |frame_subscriber_|, to determine and maybe | |
234 // initiate a copy-into-video-frame request. | |
235 void DidReceiveFrameFromRenderer(const gfx::Rect& damage_rect); | 231 void DidReceiveFrameFromRenderer(const gfx::Rect& damage_rect); |
236 | 232 |
237 // Called when the next copy has completed for the |frame_subscriber_|, to run | |
238 // the next callback in the |frame_subscriber_callbacks_| queue. | |
239 void DeliverResultForFrameSubscriber(bool success); | |
240 | |
241 DelegatedFrameHostClient* const client_; | 233 DelegatedFrameHostClient* const client_; |
242 ui::Compositor* compositor_; | 234 ui::Compositor* compositor_; |
243 | 235 |
244 // True if this renders into a Surface, false if it renders into a delegated | 236 // True if this renders into a Surface, false if it renders into a delegated |
245 // layer. | 237 // layer. |
246 bool use_surfaces_; | 238 bool use_surfaces_; |
247 | 239 |
248 std::vector<base::Closure> on_compositing_did_commit_callbacks_; | 240 std::vector<base::Closure> on_compositing_did_commit_callbacks_; |
249 | 241 |
250 // The vsync manager we are observing for changes, if any. | 242 // The vsync manager we are observing for changes, if any. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 NO_PENDING_COMMIT, | 301 NO_PENDING_COMMIT, |
310 }; | 302 }; |
311 CanLockCompositorState can_lock_compositor_; | 303 CanLockCompositorState can_lock_compositor_; |
312 | 304 |
313 base::TimeTicks last_draw_ended_; | 305 base::TimeTicks last_draw_ended_; |
314 | 306 |
315 // Subscriber that listens to frame presentation events. | 307 // Subscriber that listens to frame presentation events. |
316 scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_; | 308 scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_; |
317 std::vector<scoped_refptr<OwnedMailbox> > idle_frame_subscriber_textures_; | 309 std::vector<scoped_refptr<OwnedMailbox> > idle_frame_subscriber_textures_; |
318 | 310 |
319 // Set to true if a frame was received from the renderer and a copy request | |
320 // was made for the frame subscriber, but drawing has not yet started. This | |
321 // is used to prevent more than one copy request being executed per draw. | |
322 bool frame_subscriber_copy_request_pending_; | |
323 | |
324 // Stores the delivery callbacks, in order, that will be executed as each of | |
325 // the frame subscriber's copy-into-video-frame requests completes. The size | |
326 // of this queue is always equal to the number of oustanding, de-duped copy | |
327 // requests. | |
328 std::deque<base::Callback<void(bool)>> frame_subscriber_callbacks_; | |
329 | |
330 // Callback used to pass the output request to the layer or to a function | 311 // Callback used to pass the output request to the layer or to a function |
331 // specified by a test. | 312 // specified by a test. |
332 base::Callback<void(scoped_ptr<cc::CopyOutputRequest>)> | 313 base::Callback<void(scoped_ptr<cc::CopyOutputRequest>)> |
333 request_copy_of_output_callback_for_testing_; | 314 request_copy_of_output_callback_for_testing_; |
334 | 315 |
335 // YUV readback pipeline. | 316 // YUV readback pipeline. |
336 scoped_ptr<content::ReadbackYUVInterface> | 317 scoped_ptr<content::ReadbackYUVInterface> |
337 yuv_readback_pipeline_; | 318 yuv_readback_pipeline_; |
338 | 319 |
339 scoped_ptr<DelegatedFrameEvictor> delegated_frame_evictor_; | 320 scoped_ptr<DelegatedFrameEvictor> delegated_frame_evictor_; |
340 }; | 321 }; |
341 | 322 |
342 } // namespace content | 323 } // namespace content |
343 | 324 |
344 #endif // CONTENT_BROWSER_COMPOSITOR_DELEGATED_FRAME_HOST_H_ | 325 #endif // CONTENT_BROWSER_COMPOSITOR_DELEGATED_FRAME_HOST_H_ |
OLD | NEW |