| 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_CONTEXT_WRAPPER_H_ | 5 #ifndef CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_WRAPPER_H_ |
| 6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_WRAPPER_H_ | 6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_WRAPPER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 // Called when the BrowserContext/Profile is going away. | 71 // Called when the BrowserContext/Profile is going away. |
| 72 void Shutdown(); | 72 void Shutdown(); |
| 73 | 73 |
| 74 void Flush(); | 74 void Flush(); |
| 75 | 75 |
| 76 // See mojom::StoragePartitionService interface. | 76 // See mojom::StoragePartitionService interface. |
| 77 void OpenLocalStorage(const url::Origin& origin, | 77 void OpenLocalStorage(const url::Origin& origin, |
| 78 mojom::LevelDBWrapperRequest request); | 78 mojom::LevelDBWrapperRequest request); |
| 79 | 79 |
| 80 void SetLocalStorageDatabaseForTesting( |
| 81 leveldb::mojom::LevelDBDatabaseAssociatedPtr database); |
| 82 |
| 80 private: | 83 private: |
| 81 friend class DOMStorageMessageFilter; // for access to context() | 84 friend class DOMStorageMessageFilter; // for access to context() |
| 82 friend class SessionStorageNamespaceImpl; // ditto | 85 friend class SessionStorageNamespaceImpl; // ditto |
| 83 friend class base::RefCountedThreadSafe<DOMStorageContextWrapper>; | 86 friend class base::RefCountedThreadSafe<DOMStorageContextWrapper>; |
| 84 friend class MojoDOMStorageBrowserTest; | 87 friend class MojoDOMStorageBrowserTest; |
| 85 | 88 |
| 86 ~DOMStorageContextWrapper() override; | 89 ~DOMStorageContextWrapper() override; |
| 87 DOMStorageContextImpl* context() const { return context_.get(); } | 90 DOMStorageContextImpl* context() const { return context_.get(); } |
| 88 | 91 |
| 89 // Called on UI thread when the system is under memory pressure. | 92 // Called on UI thread when the system is under memory pressure. |
| 90 void OnMemoryPressure( | 93 void OnMemoryPressure( |
| 91 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level); | 94 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level); |
| 92 | 95 |
| 93 // base::MemoryCoordinatorClient implementation: | 96 // base::MemoryCoordinatorClient implementation: |
| 94 void OnPurgeMemory() override; | 97 void OnPurgeMemory() override; |
| 95 | 98 |
| 96 void PurgeMemory(DOMStorageContextImpl::PurgeOption purge_option); | 99 void PurgeMemory(DOMStorageContextImpl::PurgeOption purge_option); |
| 97 | 100 |
| 98 void GotMojoLocalStorageUsage(GetLocalStorageUsageCallback callback, | |
| 99 base::SingleThreadTaskRunner* reply_task_runner, | |
| 100 std::vector<LocalStorageUsageInfo> usage); | |
| 101 | |
| 102 // Keep all mojo-ish details together and not bleed them through the public | 101 // Keep all mojo-ish details together and not bleed them through the public |
| 103 // interface. The |mojo_state_| object is owned by this object, but destroyed | 102 // interface. The |mojo_state_| object is owned by this object, but destroyed |
| 104 // asynchronously on the |mojo_task_runner_|. | 103 // asynchronously on the |mojo_task_runner_|. |
| 105 LocalStorageContextMojo* mojo_state_ = nullptr; | 104 LocalStorageContextMojo* mojo_state_ = nullptr; |
| 106 scoped_refptr<base::SingleThreadTaskRunner> mojo_task_runner_; | 105 scoped_refptr<base::SingleThreadTaskRunner> mojo_task_runner_; |
| 107 | 106 |
| 108 // To receive memory pressure signals. | 107 // To receive memory pressure signals. |
| 109 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; | 108 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; |
| 110 | 109 |
| 111 scoped_refptr<DOMStorageContextImpl> context_; | 110 scoped_refptr<DOMStorageContextImpl> context_; |
| 112 | 111 |
| 113 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageContextWrapper); | 112 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageContextWrapper); |
| 114 }; | 113 }; |
| 115 | 114 |
| 116 } // namespace content | 115 } // namespace content |
| 117 | 116 |
| 118 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_WRAPPER_H_ | 117 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_WRAPPER_H_ |
| OLD | NEW |