| OLD | NEW |
| 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_types.h" | 21 #include "content/common/dom_storage/dom_storage_types.h" |
| 22 #include "url/gurl.h" | 22 #include "url/gurl.h" |
| 23 | 23 |
| 24 namespace base { |
| 25 namespace trace_event { |
| 26 class ProcessMemoryDump; |
| 27 } |
| 28 } |
| 29 |
| 24 namespace content { | 30 namespace content { |
| 25 | 31 |
| 26 class DOMStorageDatabaseAdapter; | 32 class DOMStorageDatabaseAdapter; |
| 27 class DOMStorageMap; | 33 class DOMStorageMap; |
| 28 class DOMStorageTaskRunner; | 34 class DOMStorageTaskRunner; |
| 29 class SessionStorageDatabase; | 35 class SessionStorageDatabase; |
| 30 | 36 |
| 31 // Container for a per-origin Map of key/value pairs potentially | 37 // Container for a per-origin Map of key/value pairs potentially |
| 32 // backed by storage on disk and lazily commits changes to disk. | 38 // backed by storage on disk and lazily commits changes to disk. |
| 33 // See class comments for DOMStorageContextImpl for a larger overview. | 39 // See class comments for DOMStorageContextImpl for a larger overview. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 void PurgeMemory(); | 95 void PurgeMemory(); |
| 90 | 96 |
| 91 // Schedules the commit of any unsaved changes and enters a | 97 // Schedules the commit of any unsaved changes and enters a |
| 92 // shutdown state such that the value getters and setters will | 98 // shutdown state such that the value getters and setters will |
| 93 // no longer do anything. | 99 // no longer do anything. |
| 94 void Shutdown(); | 100 void Shutdown(); |
| 95 | 101 |
| 96 // Returns true if the data is loaded in memory. | 102 // Returns true if the data is loaded in memory. |
| 97 bool IsLoadedInMemory() const { return is_initial_import_done_; } | 103 bool IsLoadedInMemory() const { return is_initial_import_done_; } |
| 98 | 104 |
| 105 // Adds memory statistics to |pmd| for chrome://tracing. |
| 106 void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd); |
| 107 |
| 99 private: | 108 private: |
| 100 friend class DOMStorageAreaTest; | 109 friend class DOMStorageAreaTest; |
| 101 FRIEND_TEST_ALL_PREFIXES(DOMStorageAreaTest, DOMStorageAreaBasics); | 110 FRIEND_TEST_ALL_PREFIXES(DOMStorageAreaTest, DOMStorageAreaBasics); |
| 102 FRIEND_TEST_ALL_PREFIXES(DOMStorageAreaTest, BackingDatabaseOpened); | 111 FRIEND_TEST_ALL_PREFIXES(DOMStorageAreaTest, BackingDatabaseOpened); |
| 103 FRIEND_TEST_ALL_PREFIXES(DOMStorageAreaTest, TestDatabaseFilePath); | 112 FRIEND_TEST_ALL_PREFIXES(DOMStorageAreaTest, TestDatabaseFilePath); |
| 104 FRIEND_TEST_ALL_PREFIXES(DOMStorageAreaTest, CommitTasks); | 113 FRIEND_TEST_ALL_PREFIXES(DOMStorageAreaTest, CommitTasks); |
| 105 FRIEND_TEST_ALL_PREFIXES(DOMStorageAreaTest, CommitChangesAtShutdown); | 114 FRIEND_TEST_ALL_PREFIXES(DOMStorageAreaTest, CommitChangesAtShutdown); |
| 106 FRIEND_TEST_ALL_PREFIXES(DOMStorageAreaTest, DeleteOrigin); | 115 FRIEND_TEST_ALL_PREFIXES(DOMStorageAreaTest, DeleteOrigin); |
| 107 FRIEND_TEST_ALL_PREFIXES(DOMStorageAreaTest, PurgeMemory); | 116 FRIEND_TEST_ALL_PREFIXES(DOMStorageAreaTest, PurgeMemory); |
| 108 FRIEND_TEST_ALL_PREFIXES(DOMStorageAreaTest, RateLimiter); | 117 FRIEND_TEST_ALL_PREFIXES(DOMStorageAreaTest, RateLimiter); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 base::TimeTicks start_time_; | 189 base::TimeTicks start_time_; |
| 181 RateLimiter data_rate_limiter_; | 190 RateLimiter data_rate_limiter_; |
| 182 RateLimiter commit_rate_limiter_; | 191 RateLimiter commit_rate_limiter_; |
| 183 | 192 |
| 184 DISALLOW_COPY_AND_ASSIGN(DOMStorageArea); | 193 DISALLOW_COPY_AND_ASSIGN(DOMStorageArea); |
| 185 }; | 194 }; |
| 186 | 195 |
| 187 } // namespace content | 196 } // namespace content |
| 188 | 197 |
| 189 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_AREA_H_ | 198 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_AREA_H_ |
| OLD | NEW |