summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/extensions/extensions_quota_service.h3
-rw-r--r--chrome/browser/extensions/extensions_quota_service_unittest.cc9
2 files changed, 5 insertions, 7 deletions
diff --git a/chrome/browser/extensions/extensions_quota_service.h b/chrome/browser/extensions/extensions_quota_service.h
index f68a763..700f9cc 100644
--- a/chrome/browser/extensions/extensions_quota_service.h
+++ b/chrome/browser/extensions/extensions_quota_service.h
@@ -99,7 +99,7 @@ class QuotaLimitHeuristic {
// come in). So, a bucket has an expiration to denote it has becomes stale.
class Bucket {
public:
- explicit Bucket() : num_tokens_(0) {}
+ Bucket() : num_tokens_(0) {}
// Removes a token from this bucket, and returns true if the bucket had
// any tokens in the first place.
bool DeductToken() { return num_tokens_-- > 0; }
@@ -130,6 +130,7 @@ class QuotaLimitHeuristic {
// for this QuotaLimitHeuristic.
class BucketMapper {
public:
+ virtual ~BucketMapper() {}
// In most cases, this should simply extract item IDs from the arguments
// (e.g for bookmark operations involving an existing item). If a problem
// occurs while parsing |args|, the function aborts - buckets may be non-
diff --git a/chrome/browser/extensions/extensions_quota_service_unittest.cc b/chrome/browser/extensions/extensions_quota_service_unittest.cc
index fae8d41..80457eb 100644
--- a/chrome/browser/extensions/extensions_quota_service_unittest.cc
+++ b/chrome/browser/extensions/extensions_quota_service_unittest.cc
@@ -34,12 +34,9 @@ class Mapper : public QuotaLimitHeuristic::BucketMapper {
for (size_t i = 0; i < v->GetSize(); i++) {
int id;
ASSERT_TRUE(v->GetInteger(i, &id));
- Bucket* bucket = buckets_[id];
- if (bucket == NULL) {
- bucket = new Bucket();
- buckets_[id] = bucket;
- }
- buckets->push_back(bucket);
+ if (buckets_.find(id) == buckets_.end())
+ buckets_[id] = new Bucket();
+ buckets->push_back(buckets_[id]);
}
}
private: