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

Unified Diff: net/url_request/url_request_throttler_entry.cc

Issue 7582004: Add load flag indicating a request is probably the result of a user gesture. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to lkgr. Created 9 years, 4 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: net/url_request/url_request_throttler_entry.cc
diff --git a/net/url_request/url_request_throttler_entry.cc b/net/url_request/url_request_throttler_entry.cc
index bf831caec1bacc90994495cd879f78e637c2a50c..a56e4148ecd7558fc87ef847040e573b3c1bd745 100644
--- a/net/url_request/url_request_throttler_entry.cc
+++ b/net/url_request/url_request_throttler_entry.cc
@@ -12,6 +12,7 @@
#include "base/rand_util.h"
#include "base/string_number_conversions.h"
#include "base/values.h"
+#include "net/base/load_flags.h"
#include "net/base/net_log.h"
#include "net/url_request/url_request_throttler_header_interface.h"
#include "net/url_request/url_request_throttler_manager.h"
@@ -178,9 +179,10 @@ void URLRequestThrottlerEntry::DetachManager() {
manager_ = NULL;
}
-bool URLRequestThrottlerEntry::IsDuringExponentialBackoff() const {
+bool URLRequestThrottlerEntry::ShouldRejectRequest(int load_flags) const {
bool reject_request = false;
- if (!is_backoff_disabled_ && GetBackoffEntry()->ShouldRejectRequest()) {
+ if (!is_backoff_disabled_ && !ExplicitUserRequest(load_flags) &&
+ GetBackoffEntry()->ShouldRejectRequest()) {
int num_failures = GetBackoffEntry()->failure_count();
int release_after_ms =
(GetBackoffEntry()->GetReleaseTime() - base::TimeTicks::Now())
@@ -444,4 +446,9 @@ BackoffEntry* URLRequestThrottlerEntry::GetBackoffEntry() {
return &backoff_entry_;
}
+// static
+bool URLRequestThrottlerEntry::ExplicitUserRequest(const int load_flags) {
+ return (load_flags & LOAD_MAYBE_USER_GESTURE) != 0;
+}
+
} // namespace net
« no previous file with comments | « net/url_request/url_request_throttler_entry.h ('k') | net/url_request/url_request_throttler_entry_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698