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

Side by Side Diff: content/common/dom_storage/dom_storage_map.h

Issue 896643002: [DOMStorage] Rate limiting writes to disk. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 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 #ifndef CONTENT_COMMON_DOM_STORAGE_DOM_STORAGE_MAP_H_ 5 #ifndef CONTENT_COMMON_DOM_STORAGE_DOM_STORAGE_MAP_H_
6 #define CONTENT_COMMON_DOM_STORAGE_DOM_STORAGE_MAP_H_ 6 #define CONTENT_COMMON_DOM_STORAGE_DOM_STORAGE_MAP_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 28 matching lines...) Expand all
39 void ExtractValues(DOMStorageValuesMap* map) const { *map = values_; } 39 void ExtractValues(DOMStorageValuesMap* map) const { *map = values_; }
40 40
41 // Creates a new instance of DOMStorageMap containing 41 // Creates a new instance of DOMStorageMap containing
42 // a deep copy of values_. 42 // a deep copy of values_.
43 DOMStorageMap* DeepCopy() const; 43 DOMStorageMap* DeepCopy() const;
44 44
45 size_t bytes_used() const { return bytes_used_; } 45 size_t bytes_used() const { return bytes_used_; }
46 size_t quota() const { return quota_; } 46 size_t quota() const { return quota_; }
47 void set_quota(size_t quota) { quota_ = quota; } 47 void set_quota(size_t quota) { quota_ = quota; }
48 48
49 static size_t CountBytes(const DOMStorageValuesMap& values);
50
49 private: 51 private:
50 friend class base::RefCountedThreadSafe<DOMStorageMap>; 52 friend class base::RefCountedThreadSafe<DOMStorageMap>;
51 ~DOMStorageMap(); 53 ~DOMStorageMap();
52 54
53 void ResetKeyIterator(); 55 void ResetKeyIterator();
54 56
55 DOMStorageValuesMap values_; 57 DOMStorageValuesMap values_;
56 DOMStorageValuesMap::const_iterator key_iterator_; 58 DOMStorageValuesMap::const_iterator key_iterator_;
57 unsigned last_key_index_; 59 unsigned last_key_index_;
58 size_t bytes_used_; 60 size_t bytes_used_;
59 size_t quota_; 61 size_t quota_;
60 }; 62 };
61 63
62 } // namespace content 64 } // namespace content
63 65
64 #endif // CONTENT_COMMON_DOM_STORAGE_DOM_STORAGE_MAP_H_ 66 #endif // CONTENT_COMMON_DOM_STORAGE_DOM_STORAGE_MAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698