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

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

Issue 1732363002: Delay deferring resource requests until after first checking cache and extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove extra paren Created 4 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 | « 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_scheduler.cc
diff --git a/content/browser/loader/resource_scheduler.cc b/content/browser/loader/resource_scheduler.cc
index cda8a6c787bf5e679b9242456898468373ac750f..663281848c3ea4a9c408c15da3418c4e6a39f565 100644
--- a/content/browser/loader/resource_scheduler.cc
+++ b/content/browser/loader/resource_scheduler.cc
@@ -16,6 +16,7 @@
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
+#include "base/strings/string_util.h"
#include "base/supports_user_data.h"
#include "content/common/resource_messages.h"
#include "content/public/browser/resource_controller.h"
@@ -51,6 +52,13 @@ const RequestAttributes kAttributeInFlight = 0x01;
const RequestAttributes kAttributeDelayable = 0x02;
const RequestAttributes kAttributeLayoutBlocking = 0x04;
+bool InDeferAfterCacheExperiment() {
+ std::string experiment =
+ base::FieldTrialList::FindFullName("ResourceSchedulerDeferAfterCache");
+ return base::StartsWith(experiment, "ExperimentYes",
+ base::CompareCase::INSENSITIVE_ASCII);
+}
+
} // namespace
static const size_t kDefaultMaxNumDelayableRequestsPerClient = 10;
@@ -242,9 +250,21 @@ class ResourceScheduler::ScheduledResourceRequest : public ResourceThrottle {
// ResourceThrottle interface:
void WillStartRequest(bool* defer) override {
+ if (InDeferAfterCacheExperiment()) {
+ *defer = false;
+ return;
+ }
deferred_ = *defer = !ready_;
}
+ void WillStartUsingNetwork(bool* defer) override {
+ if (InDeferAfterCacheExperiment()) {
+ deferred_ = *defer = !ready_;
+ return;
+ }
+ *defer = false;
+ }
+
const char* GetNameForLogging() const override { return "ResourceScheduler"; }
const ClientId client_id_;
« 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