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

Unified Diff: content/browser/loader/resource_loader.cc

Issue 2669243006: Remove ResourceLoader PostTask after reading headers. (Closed)
Patch Set: Fix typo Created 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/loader/resource_loader.cc
diff --git a/content/browser/loader/resource_loader.cc b/content/browser/loader/resource_loader.cc
index 02d24a8f982b0c4a32de9acb5b9045d74aebdf60..9bfd713067de89b909107f3a38ece2a915f7261b 100644
--- a/content/browser/loader/resource_loader.cc
+++ b/content/browser/loader/resource_loader.cc
@@ -642,9 +642,18 @@ void ResourceLoader::CompleteResponseStarted() {
FROM_HERE_WITH_EXPLICIT_FUNCTION("475761 OnResponseStarted()"));
read_deferral_start_time_ = base::TimeTicks::Now();
- ScopedDeferral scoped_deferral(this, DEFERRED_READ);
+ // Using a ScopedDeferral here would result in calling ReadMore(true) on sync
+ // success. Calling ReadMore(false) here instead allows small responses to be
+ // handled completely synchronously, if no ResourceHandler defers handling of
+ // the response.
+ deferred_stage_ = DEFERRED_SYNC;
handler_->OnResponseStarted(response.get(),
base::MakeUnique<Controller>(this));
+ if (is_deferred()) {
+ deferred_stage_ = DEFERRED_READ;
+ } else {
+ ReadMore(false);
+ }
}
void ResourceLoader::ReadMore(bool handle_result_async) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698