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

Side by Side Diff: content/browser/dom_storage/dom_storage_area.h

Issue 1953703004: Purge browser cache for dom storage in a smarter way (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dom_storage
Patch Set: Fixes. Created 4 years, 7 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_BROWSER_DOM_STORAGE_DOM_STORAGE_AREA_H_ 5 #ifndef CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_AREA_H_
6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_AREA_H_ 6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_AREA_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory> 11 #include <memory>
12 #include <string> 12 #include <string>
13 13
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/gtest_prod_util.h" 15 #include "base/gtest_prod_util.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
18 #include "base/strings/nullable_string16.h" 18 #include "base/strings/nullable_string16.h"
19 #include "base/strings/string16.h" 19 #include "base/strings/string16.h"
20 #include "content/common/content_export.h" 20 #include "content/common/content_export.h"
21 #include "content/common/dom_storage/dom_storage_map.h"
21 #include "content/common/dom_storage/dom_storage_types.h" 22 #include "content/common/dom_storage/dom_storage_types.h"
22 #include "url/gurl.h" 23 #include "url/gurl.h"
23 24
24 namespace base { 25 namespace base {
25 namespace trace_event { 26 namespace trace_event {
26 class ProcessMemoryDump; 27 class ProcessMemoryDump;
27 } 28 }
28 } 29 }
29 30
30 namespace content { 31 namespace content {
31 32
32 class DOMStorageDatabaseAdapter; 33 class DOMStorageDatabaseAdapter;
33 class DOMStorageMap;
34 class DOMStorageTaskRunner; 34 class DOMStorageTaskRunner;
35 class SessionStorageDatabase; 35 class SessionStorageDatabase;
36 36
37 // Container for a per-origin Map of key/value pairs potentially 37 // Container for a per-origin Map of key/value pairs potentially
38 // backed by storage on disk and lazily commits changes to disk. 38 // backed by storage on disk and lazily commits changes to disk.
39 // See class comments for DOMStorageContextImpl for a larger overview. 39 // See class comments for DOMStorageContextImpl for a larger overview.
40 class CONTENT_EXPORT DOMStorageArea 40 class CONTENT_EXPORT DOMStorageArea
41 : public base::RefCountedThreadSafe<DOMStorageArea> { 41 : public base::RefCountedThreadSafe<DOMStorageArea> {
42 42
43 public: 43 public:
(...skipping 14 matching lines...) Expand all
58 58
59 // Session storage. Backed on disk if |session_storage_backing| is not NULL. 59 // Session storage. Backed on disk if |session_storage_backing| is not NULL.
60 DOMStorageArea(int64_t namespace_id, 60 DOMStorageArea(int64_t namespace_id,
61 const std::string& persistent_namespace_id, 61 const std::string& persistent_namespace_id,
62 const GURL& origin, 62 const GURL& origin,
63 SessionStorageDatabase* session_storage_backing, 63 SessionStorageDatabase* session_storage_backing,
64 DOMStorageTaskRunner* task_runner); 64 DOMStorageTaskRunner* task_runner);
65 65
66 const GURL& origin() const { return origin_; } 66 const GURL& origin() const { return origin_; }
67 int64_t namespace_id() const { return namespace_id_; } 67 int64_t namespace_id() const { return namespace_id_; }
68 size_t map_usage_in_bytes() const { return map_ ? map_->bytes_used() : 0; }
68 69
69 // Writes a copy of the current set of values in the area to the |map|. 70 // Writes a copy of the current set of values in the area to the |map|.
70 void ExtractValues(DOMStorageValuesMap* map); 71 void ExtractValues(DOMStorageValuesMap* map);
71 72
72 unsigned Length(); 73 unsigned Length();
73 base::NullableString16 Key(unsigned index); 74 base::NullableString16 Key(unsigned index);
74 base::NullableString16 GetItem(const base::string16& key); 75 base::NullableString16 GetItem(const base::string16& key);
75 bool SetItem(const base::string16& key, const base::string16& value, 76 bool SetItem(const base::string16& key, const base::string16& value,
76 base::NullableString16* old_value); 77 base::NullableString16* old_value);
77 bool RemoveItem(const base::string16& key, base::string16* old_value); 78 bool RemoveItem(const base::string16& key, base::string16* old_value);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 base::TimeTicks start_time_; 190 base::TimeTicks start_time_;
190 RateLimiter data_rate_limiter_; 191 RateLimiter data_rate_limiter_;
191 RateLimiter commit_rate_limiter_; 192 RateLimiter commit_rate_limiter_;
192 193
193 DISALLOW_COPY_AND_ASSIGN(DOMStorageArea); 194 DISALLOW_COPY_AND_ASSIGN(DOMStorageArea);
194 }; 195 };
195 196
196 } // namespace content 197 } // namespace content
197 198
198 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_AREA_H_ 199 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_AREA_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/dom_storage/dom_storage_area.cc » ('j') | content/browser/dom_storage/dom_storage_namespace.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698