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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/compositor/delegated_frame_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/compositor/delegated_frame_host.h
diff --git a/content/browser/compositor/delegated_frame_host.h b/content/browser/compositor/delegated_frame_host.h
index 42ad05d6524ebcf8e9d1105324d593bc0d341c2d..a3b43855b503ebd63b804d4971e6ec1b8085ed4b 100644
--- a/content/browser/compositor/delegated_frame_host.h
+++ b/content/browser/compositor/delegated_frame_host.h
@@ -137,6 +137,8 @@ class CONTENT_EXPORT DelegatedFrameHost
FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
DiscardDelegatedFramesWithLocking);
FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraCopyRequestTest,
+ DedupeFrameSubscriberRequests);
+ FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraCopyRequestTest,
DestroyedAfterCopyRequest);
RenderWidgetHostViewFrameSubscriber* frame_subscriber() const {
@@ -228,8 +230,14 @@ class CONTENT_EXPORT DelegatedFrameHost
// cc::SurfaceFactoryClient implementation.
void ReturnResources(const cc::ReturnedResourceArray& resources) override;
+ // Called to consult the current |frame_subscriber_|, to determine and maybe
+ // initiate a copy-into-video-frame request.
void DidReceiveFrameFromRenderer(const gfx::Rect& damage_rect);
+ // Called when the next copy has completed for the |frame_subscriber_|, to run
+ // the next callback in the |frame_subscriber_callbacks_| queue.
+ void DeliverResultForFrameSubscriber(bool success);
+
DelegatedFrameHostClient* const client_;
ui::Compositor* compositor_;
@@ -308,6 +316,17 @@ class CONTENT_EXPORT DelegatedFrameHost
scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_;
std::vector<scoped_refptr<OwnedMailbox> > idle_frame_subscriber_textures_;
+ // Set to true if a frame was received from the renderer and a copy request
+ // was made for the frame subscriber, but drawing has not yet started. This
+ // is used to prevent more than one copy request being executed per draw.
+ bool frame_subscriber_copy_request_pending_;
+
+ // Stores the delivery callbacks, in order, that will be executed as each of
+ // the frame subscriber's copy-into-video-frame requests completes. The size
+ // of this queue is always equal to the number of oustanding, de-duped copy
+ // requests.
+ std::deque<base::Callback<void(bool)>> frame_subscriber_callbacks_;
+
// Callback used to pass the output request to the layer or to a function
// specified by a test.
base::Callback<void(scoped_ptr<cc::CopyOutputRequest>)>
« 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