Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Side by Side Diff: content/browser/compositor/delegated_frame_host.h

Issue 986823002: De-dupe copy requests for tab capture in DelegatedFrameHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 3 is enough! :) Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/compositor/delegated_frame_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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,
140 DestroyedAfterCopyRequest); 142 DestroyedAfterCopyRequest);
141 143
142 RenderWidgetHostViewFrameSubscriber* frame_subscriber() const { 144 RenderWidgetHostViewFrameSubscriber* frame_subscriber() const {
143 return frame_subscriber_.get(); 145 return frame_subscriber_.get();
144 } 146 }
145 bool ShouldCreateResizeLock(); 147 bool ShouldCreateResizeLock();
146 void LockResources(); 148 void LockResources();
147 void UnlockResources(); 149 void UnlockResources();
148 void RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request); 150 void RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request);
149 151
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 223
222 // DelegatedFrameEvictorClient implementation. 224 // DelegatedFrameEvictorClient implementation.
223 void EvictDelegatedFrame() override; 225 void EvictDelegatedFrame() override;
224 226
225 // cc::DelegatedFrameProviderClient implementation. 227 // cc::DelegatedFrameProviderClient implementation.
226 void UnusedResourcesAreAvailable() override; 228 void UnusedResourcesAreAvailable() override;
227 229
228 // cc::SurfaceFactoryClient implementation. 230 // cc::SurfaceFactoryClient implementation.
229 void ReturnResources(const cc::ReturnedResourceArray& resources) override; 231 void ReturnResources(const cc::ReturnedResourceArray& resources) override;
230 232
233 // Called to consult the current |frame_subscriber_|, to determine and maybe
234 // initiate a copy-into-video-frame request.
231 void DidReceiveFrameFromRenderer(const gfx::Rect& damage_rect); 235 void DidReceiveFrameFromRenderer(const gfx::Rect& damage_rect);
232 236
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
233 DelegatedFrameHostClient* const client_; 241 DelegatedFrameHostClient* const client_;
234 ui::Compositor* compositor_; 242 ui::Compositor* compositor_;
235 243
236 // True if this renders into a Surface, false if it renders into a delegated 244 // True if this renders into a Surface, false if it renders into a delegated
237 // layer. 245 // layer.
238 bool use_surfaces_; 246 bool use_surfaces_;
239 247
240 std::vector<base::Closure> on_compositing_did_commit_callbacks_; 248 std::vector<base::Closure> on_compositing_did_commit_callbacks_;
241 249
242 // The vsync manager we are observing for changes, if any. 250 // The vsync manager we are observing for changes, if any.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 NO_PENDING_COMMIT, 309 NO_PENDING_COMMIT,
302 }; 310 };
303 CanLockCompositorState can_lock_compositor_; 311 CanLockCompositorState can_lock_compositor_;
304 312
305 base::TimeTicks last_draw_ended_; 313 base::TimeTicks last_draw_ended_;
306 314
307 // Subscriber that listens to frame presentation events. 315 // Subscriber that listens to frame presentation events.
308 scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_; 316 scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_;
309 std::vector<scoped_refptr<OwnedMailbox> > idle_frame_subscriber_textures_; 317 std::vector<scoped_refptr<OwnedMailbox> > idle_frame_subscriber_textures_;
310 318
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
311 // Callback used to pass the output request to the layer or to a function 330 // Callback used to pass the output request to the layer or to a function
312 // specified by a test. 331 // specified by a test.
313 base::Callback<void(scoped_ptr<cc::CopyOutputRequest>)> 332 base::Callback<void(scoped_ptr<cc::CopyOutputRequest>)>
314 request_copy_of_output_callback_for_testing_; 333 request_copy_of_output_callback_for_testing_;
315 334
316 // YUV readback pipeline. 335 // YUV readback pipeline.
317 scoped_ptr<content::ReadbackYUVInterface> 336 scoped_ptr<content::ReadbackYUVInterface>
318 yuv_readback_pipeline_; 337 yuv_readback_pipeline_;
319 338
320 scoped_ptr<DelegatedFrameEvictor> delegated_frame_evictor_; 339 scoped_ptr<DelegatedFrameEvictor> delegated_frame_evictor_;
321 }; 340 };
322 341
323 } // namespace content 342 } // namespace content
324 343
325 #endif // CONTENT_BROWSER_COMPOSITOR_DELEGATED_FRAME_HOST_H_ 344 #endif // CONTENT_BROWSER_COMPOSITOR_DELEGATED_FRAME_HOST_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/compositor/delegated_frame_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698