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

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

Issue 2236443003: extensions: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't add braces 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
« no previous file with comments | « extensions/browser/process_manager.cc ('k') | extensions/browser/quota_service_unittest.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/quota_service.h" 5 #include "extensions/browser/quota_service.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "base/threading/thread_task_runner_handle.h" 8 #include "base/threading/thread_task_runner_handle.h"
9 #include "extensions/browser/extension_function.h" 9 #include "extensions/browser/extension_function.h"
10 #include "extensions/common/error_utils.h" 10 #include "extensions/common/error_utils.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 84 }
85 85
86 QuotaService::ScopedDisablePurgeForTesting::~ScopedDisablePurgeForTesting() { 86 QuotaService::ScopedDisablePurgeForTesting::~ScopedDisablePurgeForTesting() {
87 DCHECK(g_purge_disabled_for_testing); 87 DCHECK(g_purge_disabled_for_testing);
88 g_purge_disabled_for_testing = false; 88 g_purge_disabled_for_testing = false;
89 } 89 }
90 90
91 void QuotaService::PurgeFunctionHeuristicsMap(FunctionHeuristicsMap* map) { 91 void QuotaService::PurgeFunctionHeuristicsMap(FunctionHeuristicsMap* map) {
92 FunctionHeuristicsMap::iterator heuristics = map->begin(); 92 FunctionHeuristicsMap::iterator heuristics = map->begin();
93 while (heuristics != map->end()) { 93 while (heuristics != map->end()) {
94 STLDeleteElements(&heuristics->second); 94 base::STLDeleteElements(&heuristics->second);
95 map->erase(heuristics++); 95 map->erase(heuristics++);
96 } 96 }
97 } 97 }
98 98
99 void QuotaService::Purge() { 99 void QuotaService::Purge() {
100 DCHECK(CalledOnValidThread()); 100 DCHECK(CalledOnValidThread());
101 std::map<std::string, FunctionHeuristicsMap>::iterator it = 101 std::map<std::string, FunctionHeuristicsMap>::iterator it =
102 function_heuristics_.begin(); 102 function_heuristics_.begin();
103 for (; it != function_heuristics_.end(); function_heuristics_.erase(it++)) 103 for (; it != function_heuristics_.end(); function_heuristics_.erase(it++))
104 PurgeFunctionHeuristicsMap(&it->second); 104 PurgeFunctionHeuristicsMap(&it->second);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 142
143 bool QuotaService::TimedLimit::Apply(Bucket* bucket, 143 bool QuotaService::TimedLimit::Apply(Bucket* bucket,
144 const base::TimeTicks& event_time) { 144 const base::TimeTicks& event_time) {
145 if (event_time > bucket->expiration()) 145 if (event_time > bucket->expiration())
146 bucket->Reset(config(), event_time); 146 bucket->Reset(config(), event_time);
147 147
148 return bucket->DeductToken(); 148 return bucket->DeductToken();
149 } 149 }
150 150
151 } // namespace extensions 151 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/process_manager.cc ('k') | extensions/browser/quota_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698