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

Side by Side Diff: net/url_request/url_request_throttler_entry.cc

Issue 1059843002: Refactor NetLog::LogLevel --> NetLogCaptureMode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again to fix a merge conflict Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « net/url_request/url_request_netlog_params.cc ('k') | remoting/base/vlog_net_log.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/url_request/url_request_throttler_entry.h" 5 #include "net/url_request/url_request_throttler_entry.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 const double URLRequestThrottlerEntry::kDefaultMultiplyFactor = 1.4; 45 const double URLRequestThrottlerEntry::kDefaultMultiplyFactor = 1.4;
46 const double URLRequestThrottlerEntry::kDefaultJitterFactor = 0.4; 46 const double URLRequestThrottlerEntry::kDefaultJitterFactor = 0.4;
47 const int URLRequestThrottlerEntry::kDefaultMaximumBackoffMs = 15 * 60 * 1000; 47 const int URLRequestThrottlerEntry::kDefaultMaximumBackoffMs = 15 * 60 * 1000;
48 const int URLRequestThrottlerEntry::kDefaultEntryLifetimeMs = 2 * 60 * 1000; 48 const int URLRequestThrottlerEntry::kDefaultEntryLifetimeMs = 2 * 60 * 1000;
49 const char URLRequestThrottlerEntry::kExponentialThrottlingHeader[] = 49 const char URLRequestThrottlerEntry::kExponentialThrottlingHeader[] =
50 "X-Chrome-Exponential-Throttling"; 50 "X-Chrome-Exponential-Throttling";
51 const char URLRequestThrottlerEntry::kExponentialThrottlingDisableValue[] = 51 const char URLRequestThrottlerEntry::kExponentialThrottlingDisableValue[] =
52 "disable"; 52 "disable";
53 53
54 // Returns NetLog parameters when a request is rejected by throttling. 54 // Returns NetLog parameters when a request is rejected by throttling.
55 base::Value* NetLogRejectedRequestCallback(const std::string* url_id, 55 base::Value* NetLogRejectedRequestCallback(
56 int num_failures, 56 const std::string* url_id,
57 const base::TimeDelta& release_after, 57 int num_failures,
58 NetLog::LogLevel /* log_level */) { 58 const base::TimeDelta& release_after,
59 NetLogCaptureMode /* capture_mode */) {
59 base::DictionaryValue* dict = new base::DictionaryValue(); 60 base::DictionaryValue* dict = new base::DictionaryValue();
60 dict->SetString("url", *url_id); 61 dict->SetString("url", *url_id);
61 dict->SetInteger("num_failures", num_failures); 62 dict->SetInteger("num_failures", num_failures);
62 dict->SetInteger("release_after_ms", 63 dict->SetInteger("release_after_ms",
63 static_cast<int>(release_after.InMilliseconds())); 64 static_cast<int>(release_after.InMilliseconds()));
64 return dict; 65 return dict;
65 } 66 }
66 67
67 URLRequestThrottlerEntry::URLRequestThrottlerEntry( 68 URLRequestThrottlerEntry::URLRequestThrottlerEntry(
68 URLRequestThrottlerManager* manager, 69 URLRequestThrottlerManager* manager,
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 BackoffEntry* URLRequestThrottlerEntry::GetBackoffEntry() { 311 BackoffEntry* URLRequestThrottlerEntry::GetBackoffEntry() {
311 return &backoff_entry_; 312 return &backoff_entry_;
312 } 313 }
313 314
314 // static 315 // static
315 bool URLRequestThrottlerEntry::ExplicitUserRequest(const int load_flags) { 316 bool URLRequestThrottlerEntry::ExplicitUserRequest(const int load_flags) {
316 return (load_flags & LOAD_MAYBE_USER_GESTURE) != 0; 317 return (load_flags & LOAD_MAYBE_USER_GESTURE) != 0;
317 } 318 }
318 319
319 } // namespace net 320 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_netlog_params.cc ('k') | remoting/base/vlog_net_log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698