| OLD | NEW |
| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 for (base::DictionaryValue::Iterator it(dict); !it.IsAtEnd(); it.Advance()) { | 142 for (base::DictionaryValue::Iterator it(dict); !it.IsAtEnd(); it.Advance()) { |
| 143 keys.push_back(it.key()); | 143 keys.push_back(it.key()); |
| 144 } | 144 } |
| 145 return keys; | 145 return keys; |
| 146 } | 146 } |
| 147 | 147 |
| 148 // Creates quota heuristics for settings modification. | 148 // Creates quota heuristics for settings modification. |
| 149 void GetModificationQuotaLimitHeuristics(QuotaLimitHeuristics* heuristics) { | 149 void GetModificationQuotaLimitHeuristics(QuotaLimitHeuristics* heuristics) { |
| 150 // See storage.json for the current value of these limits. | 150 // See storage.json for the current value of these limits. |
| 151 QuotaLimitHeuristic::Config short_limit_config = { | 151 QuotaLimitHeuristic::Config short_limit_config = { |
| 152 core_api::storage::sync::MAX_WRITE_OPERATIONS_PER_MINUTE, | 152 api::storage::sync::MAX_WRITE_OPERATIONS_PER_MINUTE, |
| 153 base::TimeDelta::FromMinutes(1)}; | 153 base::TimeDelta::FromMinutes(1)}; |
| 154 QuotaLimitHeuristic::Config long_limit_config = { | 154 QuotaLimitHeuristic::Config long_limit_config = { |
| 155 core_api::storage::sync::MAX_WRITE_OPERATIONS_PER_HOUR, | 155 api::storage::sync::MAX_WRITE_OPERATIONS_PER_HOUR, |
| 156 base::TimeDelta::FromHours(1)}; | 156 base::TimeDelta::FromHours(1)}; |
| 157 heuristics->push_back(new QuotaService::TimedLimit( | 157 heuristics->push_back(new QuotaService::TimedLimit( |
| 158 short_limit_config, new QuotaLimitHeuristic::SingletonBucketMapper(), | 158 short_limit_config, new QuotaLimitHeuristic::SingletonBucketMapper(), |
| 159 "MAX_WRITE_OPERATIONS_PER_MINUTE")); | 159 "MAX_WRITE_OPERATIONS_PER_MINUTE")); |
| 160 heuristics->push_back(new QuotaService::TimedLimit( | 160 heuristics->push_back(new QuotaService::TimedLimit( |
| 161 long_limit_config, new QuotaLimitHeuristic::SingletonBucketMapper(), | 161 long_limit_config, new QuotaLimitHeuristic::SingletonBucketMapper(), |
| 162 "MAX_WRITE_OPERATIONS_PER_HOUR")); | 162 "MAX_WRITE_OPERATIONS_PER_HOUR")); |
| 163 }; | 163 }; |
| 164 | 164 |
| 165 } // namespace | 165 } // namespace |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 StorageStorageAreaClearFunction::RunWithStorage(ValueStore* storage) { | 290 StorageStorageAreaClearFunction::RunWithStorage(ValueStore* storage) { |
| 291 return UseWriteResult(storage->Clear(), storage); | 291 return UseWriteResult(storage->Clear(), storage); |
| 292 } | 292 } |
| 293 | 293 |
| 294 void StorageStorageAreaClearFunction::GetQuotaLimitHeuristics( | 294 void StorageStorageAreaClearFunction::GetQuotaLimitHeuristics( |
| 295 QuotaLimitHeuristics* heuristics) const { | 295 QuotaLimitHeuristics* heuristics) const { |
| 296 GetModificationQuotaLimitHeuristics(heuristics); | 296 GetModificationQuotaLimitHeuristics(heuristics); |
| 297 } | 297 } |
| 298 | 298 |
| 299 } // namespace extensions | 299 } // namespace extensions |
| OLD | NEW |