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

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

Issue 622343002: replace OVERRIDE and FINAL with override and final in extensions/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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_map_factory.h ('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 // The QuotaService uses heuristics to limit abusive requests 5 // The QuotaService uses heuristics to limit abusive requests
6 // made by extensions. In this model 'items' (e.g individual bookmarks) are 6 // made by extensions. In this model 'items' (e.g individual bookmarks) are
7 // represented by a 'Bucket' that holds state for that item for one single 7 // represented by a 'Bucket' that holds state for that item for one single
8 // interval of time. The interval of time is defined as 'how long we need to 8 // interval of time. The interval of time is defined as 'how long we need to
9 // watch an item (for a particular heuristic) before making a decision about 9 // watch an item (for a particular heuristic) before making a decision about
10 // quota violations'. A heuristic is two functions: one mapping input 10 // quota violations'. A heuristic is two functions: one mapping input
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 BucketList* buckets) = 0; 156 BucketList* buckets) = 0;
157 }; 157 };
158 158
159 // Maps all calls to the same bucket, regardless of |args|, for this 159 // Maps all calls to the same bucket, regardless of |args|, for this
160 // QuotaLimitHeuristic. 160 // QuotaLimitHeuristic.
161 class SingletonBucketMapper : public BucketMapper { 161 class SingletonBucketMapper : public BucketMapper {
162 public: 162 public:
163 SingletonBucketMapper() {} 163 SingletonBucketMapper() {}
164 virtual ~SingletonBucketMapper() {} 164 virtual ~SingletonBucketMapper() {}
165 virtual void GetBucketsForArgs(const base::ListValue* args, 165 virtual void GetBucketsForArgs(const base::ListValue* args,
166 BucketList* buckets) OVERRIDE; 166 BucketList* buckets) override;
167 167
168 private: 168 private:
169 Bucket bucket_; 169 Bucket bucket_;
170 DISALLOW_COPY_AND_ASSIGN(SingletonBucketMapper); 170 DISALLOW_COPY_AND_ASSIGN(SingletonBucketMapper);
171 }; 171 };
172 172
173 // Ownership of |map| is given to the new QuotaLimitHeuristic. 173 // Ownership of |map| is given to the new QuotaLimitHeuristic.
174 QuotaLimitHeuristic(const Config& config, 174 QuotaLimitHeuristic(const Config& config,
175 BucketMapper* map, 175 BucketMapper* map,
176 const std::string& name); 176 const std::string& name);
(...skipping 30 matching lines...) Expand all
207 DISALLOW_COPY_AND_ASSIGN(QuotaLimitHeuristic); 207 DISALLOW_COPY_AND_ASSIGN(QuotaLimitHeuristic);
208 }; 208 };
209 209
210 // A simple per-item heuristic to limit the number of events that can occur in 210 // A simple per-item heuristic to limit the number of events that can occur in
211 // a given period of time; e.g "no more than 100 events in an hour". 211 // a given period of time; e.g "no more than 100 events in an hour".
212 class QuotaService::TimedLimit : public QuotaLimitHeuristic { 212 class QuotaService::TimedLimit : public QuotaLimitHeuristic {
213 public: 213 public:
214 TimedLimit(const Config& config, BucketMapper* map, const std::string& name) 214 TimedLimit(const Config& config, BucketMapper* map, const std::string& name)
215 : QuotaLimitHeuristic(config, map, name) {} 215 : QuotaLimitHeuristic(config, map, name) {}
216 virtual bool Apply(Bucket* bucket, 216 virtual bool Apply(Bucket* bucket,
217 const base::TimeTicks& event_time) OVERRIDE; 217 const base::TimeTicks& event_time) override;
218 }; 218 };
219 219
220 // A per-item heuristic to limit the number of events that can occur in a 220 // A per-item heuristic to limit the number of events that can occur in a
221 // period of time over a sustained longer interval. E.g "no more than two 221 // period of time over a sustained longer interval. E.g "no more than two
222 // events per minute, sustained over 10 minutes". 222 // events per minute, sustained over 10 minutes".
223 class QuotaService::SustainedLimit : public QuotaLimitHeuristic { 223 class QuotaService::SustainedLimit : public QuotaLimitHeuristic {
224 public: 224 public:
225 SustainedLimit(const base::TimeDelta& sustain, 225 SustainedLimit(const base::TimeDelta& sustain,
226 const Config& config, 226 const Config& config,
227 BucketMapper* map, 227 BucketMapper* map,
228 const std::string& name); 228 const std::string& name);
229 virtual bool Apply(Bucket* bucket, 229 virtual bool Apply(Bucket* bucket,
230 const base::TimeTicks& event_time) OVERRIDE; 230 const base::TimeTicks& event_time) override;
231 231
232 private: 232 private:
233 // Specifies how long exhaustion of buckets is allowed to continue before 233 // Specifies how long exhaustion of buckets is allowed to continue before
234 // denying requests. 234 // denying requests.
235 const int64 repeat_exhaustion_allowance_; 235 const int64 repeat_exhaustion_allowance_;
236 int64 num_available_repeat_exhaustions_; 236 int64 num_available_repeat_exhaustions_;
237 }; 237 };
238 238
239 } // namespace extensions 239 } // namespace extensions
240 240
241 #endif // EXTENSIONS_BROWSER_QUOTA_SERVICE_H_ 241 #endif // EXTENSIONS_BROWSER_QUOTA_SERVICE_H_
OLDNEW
« no previous file with comments | « extensions/browser/process_map_factory.h ('k') | extensions/browser/quota_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698