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

Side by Side Diff: extensions/browser/api/storage/settings_storage_quota_enforcer.h

Issue 664933004: Standardize usage of virtual/override/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
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 #ifndef EXTENSIONS_BROWSER_API_STORAGE_SETTINGS_STORAGE_QUOTA_ENFORCER_H_ 5 #ifndef EXTENSIONS_BROWSER_API_STORAGE_SETTINGS_STORAGE_QUOTA_ENFORCER_H_
6 #define EXTENSIONS_BROWSER_API_STORAGE_SETTINGS_STORAGE_QUOTA_ENFORCER_H_ 6 #define EXTENSIONS_BROWSER_API_STORAGE_SETTINGS_STORAGE_QUOTA_ENFORCER_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "extensions/browser/value_store/value_store.h" 10 #include "extensions/browser/value_store/value_store.h"
(...skipping 10 matching lines...) Expand all
21 21
22 // The quota for each individual item in bytes. 22 // The quota for each individual item in bytes.
23 size_t quota_bytes_per_item; 23 size_t quota_bytes_per_item;
24 24
25 // The maximum number of items allowed. 25 // The maximum number of items allowed.
26 size_t max_items; 26 size_t max_items;
27 }; 27 };
28 28
29 SettingsStorageQuotaEnforcer(const Limits& limits, ValueStore* delegate); 29 SettingsStorageQuotaEnforcer(const Limits& limits, ValueStore* delegate);
30 30
31 virtual ~SettingsStorageQuotaEnforcer(); 31 ~SettingsStorageQuotaEnforcer() override;
32 32
33 // ValueStore implementation. 33 // ValueStore implementation.
34 virtual size_t GetBytesInUse(const std::string& key) override; 34 size_t GetBytesInUse(const std::string& key) override;
35 virtual size_t GetBytesInUse(const std::vector<std::string>& keys) override; 35 size_t GetBytesInUse(const std::vector<std::string>& keys) override;
36 virtual size_t GetBytesInUse() override; 36 size_t GetBytesInUse() override;
37 virtual ReadResult Get(const std::string& key) override; 37 ReadResult Get(const std::string& key) override;
38 virtual ReadResult Get(const std::vector<std::string>& keys) override; 38 ReadResult Get(const std::vector<std::string>& keys) override;
39 virtual ReadResult Get() override; 39 ReadResult Get() override;
40 virtual WriteResult Set( 40 WriteResult Set(WriteOptions options,
41 WriteOptions options, 41 const std::string& key,
42 const std::string& key, 42 const base::Value& value) override;
43 const base::Value& value) override; 43 WriteResult Set(WriteOptions options,
44 virtual WriteResult Set( 44 const base::DictionaryValue& values) override;
45 WriteOptions options, const base::DictionaryValue& values) override; 45 WriteResult Remove(const std::string& key) override;
46 virtual WriteResult Remove(const std::string& key) override; 46 WriteResult Remove(const std::vector<std::string>& keys) override;
47 virtual WriteResult Remove(const std::vector<std::string>& keys) override; 47 WriteResult Clear() override;
48 virtual WriteResult Clear() override; 48 bool Restore() override;
49 virtual bool Restore() override; 49 bool RestoreKey(const std::string& key) override;
50 virtual bool RestoreKey(const std::string& key) override;
51 50
52 ValueStore* get_delegate_for_test() { return delegate_.get(); } 51 ValueStore* get_delegate_for_test() { return delegate_.get(); }
53 52
54 private: 53 private:
55 // Calculate the current usage for the database. 54 // Calculate the current usage for the database.
56 void CalculateUsage(); 55 void CalculateUsage();
57 56
58 // Limits configuration. 57 // Limits configuration.
59 const Limits limits_; 58 const Limits limits_;
60 59
61 // The delegate storage area. 60 // The delegate storage area.
62 scoped_ptr<ValueStore> const delegate_; 61 scoped_ptr<ValueStore> const delegate_;
63 62
64 // Total bytes in used by |delegate_|. Includes both key lengths and 63 // Total bytes in used by |delegate_|. Includes both key lengths and
65 // JSON-encoded values. 64 // JSON-encoded values.
66 size_t used_total_; 65 size_t used_total_;
67 66
68 // Map of item key to its size, including the key itself. 67 // Map of item key to its size, including the key itself.
69 std::map<std::string, size_t> used_per_setting_; 68 std::map<std::string, size_t> used_per_setting_;
70 69
71 DISALLOW_COPY_AND_ASSIGN(SettingsStorageQuotaEnforcer); 70 DISALLOW_COPY_AND_ASSIGN(SettingsStorageQuotaEnforcer);
72 }; 71 };
73 72
74 } // namespace extensions 73 } // namespace extensions
75 74
76 #endif // EXTENSIONS_BROWSER_API_STORAGE_SETTINGS_STORAGE_QUOTA_ENFORCER_H_ 75 #endif // EXTENSIONS_BROWSER_API_STORAGE_SETTINGS_STORAGE_QUOTA_ENFORCER_H_
OLDNEW
« no previous file with comments | « extensions/browser/api/storage/local_value_store_cache.h ('k') | extensions/browser/api/storage/settings_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698