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

Side by Side Diff: extensions/browser/extension_throttle_entry.cc

Issue 1909773002: Convert //extensions/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 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 | « extensions/browser/extension_system.h ('k') | extensions/browser/extension_throttle_manager.h » ('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 "extensions/browser/extension_throttle_entry.h" 5 #include "extensions/browser/extension_throttle_entry.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 28 matching lines...) Expand all
39 // avoid false positives. It should help avoid back-off from kicking in e.g. 39 // avoid false positives. It should help avoid back-off from kicking in e.g.
40 // on flaky connections. 40 // on flaky connections.
41 const int ExtensionThrottleEntry::kDefaultNumErrorsToIgnore = 2; 41 const int ExtensionThrottleEntry::kDefaultNumErrorsToIgnore = 2;
42 const int ExtensionThrottleEntry::kDefaultInitialDelayMs = 700; 42 const int ExtensionThrottleEntry::kDefaultInitialDelayMs = 700;
43 const double ExtensionThrottleEntry::kDefaultMultiplyFactor = 1.4; 43 const double ExtensionThrottleEntry::kDefaultMultiplyFactor = 1.4;
44 const double ExtensionThrottleEntry::kDefaultJitterFactor = 0.4; 44 const double ExtensionThrottleEntry::kDefaultJitterFactor = 0.4;
45 const int ExtensionThrottleEntry::kDefaultMaximumBackoffMs = 15 * 60 * 1000; 45 const int ExtensionThrottleEntry::kDefaultMaximumBackoffMs = 15 * 60 * 1000;
46 const int ExtensionThrottleEntry::kDefaultEntryLifetimeMs = 2 * 60 * 1000; 46 const int ExtensionThrottleEntry::kDefaultEntryLifetimeMs = 2 * 60 * 1000;
47 47
48 // Returns NetLog parameters when a request is rejected by throttling. 48 // Returns NetLog parameters when a request is rejected by throttling.
49 scoped_ptr<base::Value> NetLogRejectedRequestCallback( 49 std::unique_ptr<base::Value> NetLogRejectedRequestCallback(
50 const std::string* url_id, 50 const std::string* url_id,
51 int num_failures, 51 int num_failures,
52 const base::TimeDelta& release_after, 52 const base::TimeDelta& release_after,
53 net::NetLogCaptureMode /* capture_mode */) { 53 net::NetLogCaptureMode /* capture_mode */) {
54 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 54 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
55 dict->SetString("url", *url_id); 55 dict->SetString("url", *url_id);
56 dict->SetInteger("num_failures", num_failures); 56 dict->SetInteger("num_failures", num_failures);
57 dict->SetInteger("release_after_ms", 57 dict->SetInteger("release_after_ms",
58 static_cast<int>(release_after.InMilliseconds())); 58 static_cast<int>(release_after.InMilliseconds()));
59 return std::move(dict); 59 return std::move(dict);
60 } 60 }
61 61
62 ExtensionThrottleEntry::ExtensionThrottleEntry( 62 ExtensionThrottleEntry::ExtensionThrottleEntry(
63 ExtensionThrottleManager* manager, 63 ExtensionThrottleManager* manager,
64 const std::string& url_id) 64 const std::string& url_id)
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 net::BackoffEntry* ExtensionThrottleEntry::GetBackoffEntry() { 278 net::BackoffEntry* ExtensionThrottleEntry::GetBackoffEntry() {
279 return &backoff_entry_; 279 return &backoff_entry_;
280 } 280 }
281 281
282 // static 282 // static
283 bool ExtensionThrottleEntry::ExplicitUserRequest(const int load_flags) { 283 bool ExtensionThrottleEntry::ExplicitUserRequest(const int load_flags) {
284 return (load_flags & net::LOAD_MAYBE_USER_GESTURE) != 0; 284 return (load_flags & net::LOAD_MAYBE_USER_GESTURE) != 0;
285 } 285 }
286 286
287 } // namespace extensions 287 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/extension_system.h ('k') | extensions/browser/extension_throttle_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698