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

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, 11 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
Index: content/child/resource_dispatcher.cc
diff --git a/content/child/resource_dispatcher.cc b/content/child/resource_dispatcher.cc
index 7cbc7fa53e3249f3e79802d1b407a3cf02f3a70e..3441007b4a9cf909bfc6d12572d7f78cb5fd2e03 100644
--- a/content/child/resource_dispatcher.cc
+++ b/content/child/resource_dispatcher.cc
@@ -578,6 +578,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.
@@ -589,6 +600,23 @@ void ResourceDispatcher::OnRequestComplete(
request_complete_data.encoded_data_length);
}
+void ResourceDispatcher::CompletedRequestAfterBackgroundThreadFlush(
davidben 2015/01/23 19:46:43 Huh. I never failed a separate bug for this, but w
oystein (OOO til 10th of July) 2015/01/23 21:23:47 Interesting! It actually might, though it depends
davidben 2015/01/26 21:53:12 Yeah, I think that stop was triggered by ResourceC
+ 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,

Powered by Google App Engine
This is Rietveld 408576698