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

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

Issue 1128083003: Converted bare pointer to scoped_ptr in net/url_request (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Deleted the comment desciption. Created 5 years, 7 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_job.cc ('k') | no next file » | 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
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( 55 base::Value* NetLogRejectedRequestCallback(
56 const std::string* url_id, 56 const std::string* url_id,
57 int num_failures, 57 int num_failures,
58 const base::TimeDelta& release_after, 58 const base::TimeDelta& release_after,
59 NetLogCaptureMode /* capture_mode */) { 59 NetLogCaptureMode /* capture_mode */) {
60 base::DictionaryValue* dict = new base::DictionaryValue(); 60 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
61 dict->SetString("url", *url_id); 61 dict->SetString("url", *url_id);
62 dict->SetInteger("num_failures", num_failures); 62 dict->SetInteger("num_failures", num_failures);
63 dict->SetInteger("release_after_ms", 63 dict->SetInteger("release_after_ms",
64 static_cast<int>(release_after.InMilliseconds())); 64 static_cast<int>(release_after.InMilliseconds()));
65 return dict; 65 return dict.release();
66 } 66 }
67 67
68 URLRequestThrottlerEntry::URLRequestThrottlerEntry( 68 URLRequestThrottlerEntry::URLRequestThrottlerEntry(
69 URLRequestThrottlerManager* manager, 69 URLRequestThrottlerManager* manager,
70 const std::string& url_id) 70 const std::string& url_id)
71 : sliding_window_period_( 71 : sliding_window_period_(
72 base::TimeDelta::FromMilliseconds(kDefaultSlidingWindowPeriodMs)), 72 base::TimeDelta::FromMilliseconds(kDefaultSlidingWindowPeriodMs)),
73 max_send_threshold_(kDefaultMaxSendThreshold), 73 max_send_threshold_(kDefaultMaxSendThreshold),
74 is_backoff_disabled_(false), 74 is_backoff_disabled_(false),
75 backoff_entry_(&backoff_policy_), 75 backoff_entry_(&backoff_policy_),
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 BackoffEntry* URLRequestThrottlerEntry::GetBackoffEntry() { 311 BackoffEntry* URLRequestThrottlerEntry::GetBackoffEntry() {
312 return &backoff_entry_; 312 return &backoff_entry_;
313 } 313 }
314 314
315 // static 315 // static
316 bool URLRequestThrottlerEntry::ExplicitUserRequest(const int load_flags) { 316 bool URLRequestThrottlerEntry::ExplicitUserRequest(const int load_flags) {
317 return (load_flags & LOAD_MAYBE_USER_GESTURE) != 0; 317 return (load_flags & LOAD_MAYBE_USER_GESTURE) != 0;
318 } 318 }
319 319
320 } // namespace net 320 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_job.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698