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

Side by Side Diff: extensions/browser/api/storage/storage_api.cc

Issue 685603003: Remove the extension QuotaService::SustainedLimit and its last client, the (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fullstop Created 6 years, 1 month 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 | « no previous file | extensions/browser/quota_service.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/api/storage/storage_api.h" 5 #include "extensions/browser/api/storage/storage_api.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 void GetModificationQuotaLimitHeuristics(QuotaLimitHeuristics* heuristics) { 151 void GetModificationQuotaLimitHeuristics(QuotaLimitHeuristics* heuristics) {
152 QuotaLimitHeuristic::Config longLimitConfig = { 152 QuotaLimitHeuristic::Config longLimitConfig = {
153 // See storage.json for current value. 153 // See storage.json for current value.
154 core_api::storage::sync::MAX_WRITE_OPERATIONS_PER_HOUR, 154 core_api::storage::sync::MAX_WRITE_OPERATIONS_PER_HOUR,
155 base::TimeDelta::FromHours(1) 155 base::TimeDelta::FromHours(1)
156 }; 156 };
157 heuristics->push_back(new QuotaService::TimedLimit( 157 heuristics->push_back(new QuotaService::TimedLimit(
158 longLimitConfig, 158 longLimitConfig,
159 new QuotaLimitHeuristic::SingletonBucketMapper(), 159 new QuotaLimitHeuristic::SingletonBucketMapper(),
160 "MAX_WRITE_OPERATIONS_PER_HOUR")); 160 "MAX_WRITE_OPERATIONS_PER_HOUR"));
161
162 // A max of 10 operations per minute, sustained over 10 minutes.
163 QuotaLimitHeuristic::Config shortLimitConfig = {
164 // See storage.json for current value.
165 core_api::storage::sync::MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE,
166 base::TimeDelta::FromMinutes(1)
167 };
168 heuristics->push_back(new QuotaService::SustainedLimit(
169 base::TimeDelta::FromMinutes(10),
170 shortLimitConfig,
171 new QuotaLimitHeuristic::SingletonBucketMapper(),
172 "MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE"));
173 }; 161 };
174 162
175 } // namespace 163 } // namespace
176 164
177 ExtensionFunction::ResponseValue StorageStorageAreaGetFunction::RunWithStorage( 165 ExtensionFunction::ResponseValue StorageStorageAreaGetFunction::RunWithStorage(
178 ValueStore* storage) { 166 ValueStore* storage) {
179 base::Value* input = NULL; 167 base::Value* input = NULL;
180 if (!args_->Get(0, &input)) 168 if (!args_->Get(0, &input))
181 return BadMessage(); 169 return BadMessage();
182 170
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 StorageStorageAreaClearFunction::RunWithStorage(ValueStore* storage) { 288 StorageStorageAreaClearFunction::RunWithStorage(ValueStore* storage) {
301 return UseWriteResult(storage->Clear(), storage); 289 return UseWriteResult(storage->Clear(), storage);
302 } 290 }
303 291
304 void StorageStorageAreaClearFunction::GetQuotaLimitHeuristics( 292 void StorageStorageAreaClearFunction::GetQuotaLimitHeuristics(
305 QuotaLimitHeuristics* heuristics) const { 293 QuotaLimitHeuristics* heuristics) const {
306 GetModificationQuotaLimitHeuristics(heuristics); 294 GetModificationQuotaLimitHeuristics(heuristics);
307 } 295 }
308 296
309 } // namespace extensions 297 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | extensions/browser/quota_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698