| 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_NAMESPACE_H_ | 5 #ifndef CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_ |
| 6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_ | 6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
| 16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
| 17 | 17 |
| 18 namespace base { |
| 19 namespace trace_event { |
| 20 class ProcessMemoryDump; |
| 21 } |
| 22 } |
| 23 |
| 18 namespace content { | 24 namespace content { |
| 19 | 25 |
| 20 class DOMStorageArea; | 26 class DOMStorageArea; |
| 21 class DOMStorageTaskRunner; | 27 class DOMStorageTaskRunner; |
| 22 class SessionStorageDatabase; | 28 class SessionStorageDatabase; |
| 23 | 29 |
| 24 // Container for the set of per-origin Areas. | 30 // Container for the set of per-origin Areas. |
| 25 // See class comments for DOMStorageContextImpl for a larger overview. | 31 // See class comments for DOMStorageContextImpl for a larger overview. |
| 26 class CONTENT_EXPORT DOMStorageNamespace | 32 class CONTENT_EXPORT DOMStorageNamespace |
| 27 : public base::RefCountedThreadSafe<DOMStorageNamespace> { | 33 : public base::RefCountedThreadSafe<DOMStorageNamespace> { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 const std::string& clone_persistent_namespace_id); | 75 const std::string& clone_persistent_namespace_id); |
| 70 | 76 |
| 71 void DeleteLocalStorageOrigin(const GURL& origin); | 77 void DeleteLocalStorageOrigin(const GURL& origin); |
| 72 void DeleteSessionStorageOrigin(const GURL& origin); | 78 void DeleteSessionStorageOrigin(const GURL& origin); |
| 73 void PurgeMemory(PurgeOption purge); | 79 void PurgeMemory(PurgeOption purge); |
| 74 void Shutdown(); | 80 void Shutdown(); |
| 75 void Flush(); | 81 void Flush(); |
| 76 | 82 |
| 77 unsigned int CountInMemoryAreas() const; | 83 unsigned int CountInMemoryAreas() const; |
| 78 | 84 |
| 85 // Adds memory statistics to |pmd| for chrome://tracing. |
| 86 void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd); |
| 87 |
| 79 private: | 88 private: |
| 80 friend class base::RefCountedThreadSafe<DOMStorageNamespace>; | 89 friend class base::RefCountedThreadSafe<DOMStorageNamespace>; |
| 81 | 90 |
| 82 // Struct to hold references to our contained areas and | 91 // Struct to hold references to our contained areas and |
| 83 // to keep track of how many tabs have a given area open. | 92 // to keep track of how many tabs have a given area open. |
| 84 struct AreaHolder { | 93 struct AreaHolder { |
| 85 scoped_refptr<DOMStorageArea> area_; | 94 scoped_refptr<DOMStorageArea> area_; |
| 86 int open_count_; | 95 int open_count_; |
| 87 AreaHolder(); | 96 AreaHolder(); |
| 88 AreaHolder(DOMStorageArea* area, int count); | 97 AreaHolder(DOMStorageArea* area, int count); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 101 base::FilePath directory_; | 110 base::FilePath directory_; |
| 102 AreaMap areas_; | 111 AreaMap areas_; |
| 103 scoped_refptr<DOMStorageTaskRunner> task_runner_; | 112 scoped_refptr<DOMStorageTaskRunner> task_runner_; |
| 104 scoped_refptr<SessionStorageDatabase> session_storage_database_; | 113 scoped_refptr<SessionStorageDatabase> session_storage_database_; |
| 105 }; | 114 }; |
| 106 | 115 |
| 107 } // namespace content | 116 } // namespace content |
| 108 | 117 |
| 109 | 118 |
| 110 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_ | 119 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_ |
| OLD | NEW |