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

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

Issue 2252373002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
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_manager.h" 5 #include "extensions/browser/extension_throttle_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // Delete all entries. 54 // Delete all entries.
55 url_entries_.clear(); 55 url_entries_.clear();
56 } 56 }
57 57
58 std::unique_ptr<content::ResourceThrottle> 58 std::unique_ptr<content::ResourceThrottle>
59 ExtensionThrottleManager::MaybeCreateThrottle(const net::URLRequest* request) { 59 ExtensionThrottleManager::MaybeCreateThrottle(const net::URLRequest* request) {
60 if (request->first_party_for_cookies().scheme() != 60 if (request->first_party_for_cookies().scheme() !=
61 extensions::kExtensionScheme) { 61 extensions::kExtensionScheme) {
62 return nullptr; 62 return nullptr;
63 } 63 }
64 return base::WrapUnique( 64 return base::MakeUnique<extensions::ExtensionRequestLimitingThrottle>(request,
65 new extensions::ExtensionRequestLimitingThrottle(request, this)); 65 this);
66 } 66 }
67 67
68 scoped_refptr<ExtensionThrottleEntryInterface> 68 scoped_refptr<ExtensionThrottleEntryInterface>
69 ExtensionThrottleManager::RegisterRequestUrl(const GURL& url) { 69 ExtensionThrottleManager::RegisterRequestUrl(const GURL& url) {
70 DCHECK(!enable_thread_checks_ || CalledOnValidThread()); 70 DCHECK(!enable_thread_checks_ || CalledOnValidThread());
71 71
72 // Normalize the url. 72 // Normalize the url.
73 std::string url_id = GetIdFromUrl(url); 73 std::string url_id = GetIdFromUrl(url);
74 74
75 // Periodically garbage collect old entries. 75 // Periodically garbage collect old entries.
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 void ExtensionThrottleManager::OnNetworkChange() { 209 void ExtensionThrottleManager::OnNetworkChange() {
210 // Remove all entries. Any entries that in-flight requests have a reference 210 // Remove all entries. Any entries that in-flight requests have a reference
211 // to will live until those requests end, and these entries may be 211 // to will live until those requests end, and these entries may be
212 // inconsistent with new entries for the same URLs, but since what we 212 // inconsistent with new entries for the same URLs, but since what we
213 // want is a clean slate for the new connection type, this is OK. 213 // want is a clean slate for the new connection type, this is OK.
214 url_entries_.clear(); 214 url_entries_.clear();
215 requests_since_last_gc_ = 0; 215 requests_since_last_gc_ = 0;
216 } 216 }
217 217
218 } // namespace extensions 218 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/extension_protocols.cc ('k') | extensions/browser/guest_view/extension_options/extension_options_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698