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

Unified Diff: content/child/resource_dispatcher.cc

Issue 689713004: Threaded data provider: Support main thread data notifications (Chrome side) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 10 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 | « content/child/resource_dispatcher.h ('k') | content/child/threaded_data_provider.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/resource_dispatcher.cc
diff --git a/content/child/resource_dispatcher.cc b/content/child/resource_dispatcher.cc
index bccff3b6e26219c92c91a5dd8aeaaf78bfa8861c..1a1c88a468bcf23c66d081f4880f45a80f715e33 100644
--- a/content/child/resource_dispatcher.cc
+++ b/content/child/resource_dispatcher.cc
@@ -576,6 +576,17 @@ void ResourceDispatcher::OnRequestComplete(
base::TimeTicks renderer_completion_time = ToRendererCompletionTime(
*request_info, request_complete_data.completion_time);
+
+ // If we have a threaded data provider, this message needs to bounce off the
+ // background thread before it's returned to this thread and handled,
+ // to make sure it's processed after all incoming data.
+ if (request_info->threaded_data_provider) {
+ request_info->threaded_data_provider->OnRequestCompleteForegroundThread(
+ weak_factory_.GetWeakPtr(), request_complete_data,
+ renderer_completion_time);
+ return;
+ }
+
// The request ID will be removed from our pending list in the destructor.
// Normally, dispatching this message causes the reference-counted request to
// die immediately.
@@ -587,6 +598,23 @@ void ResourceDispatcher::OnRequestComplete(
request_complete_data.encoded_data_length);
}
+void ResourceDispatcher::CompletedRequestAfterBackgroundThreadFlush(
+ int request_id,
+ const ResourceMsg_RequestCompleteData& request_complete_data,
+ const base::TimeTicks& renderer_completion_time) {
+ PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
+ if (!request_info)
+ return;
+
+ RequestPeer* peer = request_info->peer;
+ peer->OnCompletedRequest(request_complete_data.error_code,
+ request_complete_data.was_ignored_by_handler,
+ request_complete_data.exists_in_cache,
+ request_complete_data.security_info,
+ renderer_completion_time,
+ request_complete_data.encoded_data_length);
+}
+
int ResourceDispatcher::AddPendingRequest(RequestPeer* callback,
ResourceType resource_type,
int origin_pid,
« no previous file with comments | « content/child/resource_dispatcher.h ('k') | content/child/threaded_data_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698