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

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

Issue 2725723002: Purge new localstorage memory cache when under memory pressure. (Closed)
Patch Set: Created 3 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_LOCAL_STORAGE_CONTEXT_MOJO_H_ 5 #ifndef CONTENT_BROWSER_DOM_STORAGE_LOCAL_STORAGE_CONTEXT_MOJO_H_
6 #define CONTENT_BROWSER_DOM_STORAGE_LOCAL_STORAGE_CONTEXT_MOJO_H_ 6 #define CONTENT_BROWSER_DOM_STORAGE_LOCAL_STORAGE_CONTEXT_MOJO_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 27 matching lines...) Expand all
38 ~LocalStorageContextMojo(); 38 ~LocalStorageContextMojo();
39 39
40 void OpenLocalStorage(const url::Origin& origin, 40 void OpenLocalStorage(const url::Origin& origin,
41 mojom::LevelDBWrapperRequest request); 41 mojom::LevelDBWrapperRequest request);
42 void GetStorageUsage(GetStorageUsageCallback callback); 42 void GetStorageUsage(GetStorageUsageCallback callback);
43 void DeleteStorage(const url::Origin& origin); 43 void DeleteStorage(const url::Origin& origin);
44 // Like DeleteStorage(), but also deletes storage for all sub-origins. 44 // Like DeleteStorage(), but also deletes storage for all sub-origins.
45 void DeleteStorageForPhysicalOrigin(const url::Origin& origin); 45 void DeleteStorageForPhysicalOrigin(const url::Origin& origin);
46 void Flush(); 46 void Flush();
47 47
48 // Clears any caches, to free up as much memory as possible. Next access to
49 // storage for a particular origin will reload the data from the database.
50 void PurgeMemory();
51
48 leveldb::mojom::LevelDBDatabaseAssociatedRequest DatabaseRequestForTesting(); 52 leveldb::mojom::LevelDBDatabaseAssociatedRequest DatabaseRequestForTesting();
49 53
50 private: 54 private:
51 friend class MojoDOMStorageBrowserTest; 55 friend class MojoDOMStorageBrowserTest;
52 56
53 class LevelDBWrapperHolder; 57 class LevelDBWrapperHolder;
54 58
55 // Runs |callback| immediately if already connected to a database, otherwise 59 // Runs |callback| immediately if already connected to a database, otherwise
56 // delays running |callback| untill after a connection has been established. 60 // delays running |callback| untill after a connection has been established.
57 // Initiates connecting to the database if no connection is in progres yet. 61 // Initiates connecting to the database if no connection is in progres yet.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 // Used to access old data for migration. 120 // Used to access old data for migration.
117 scoped_refptr<DOMStorageTaskRunner> task_runner_; 121 scoped_refptr<DOMStorageTaskRunner> task_runner_;
118 base::FilePath old_localstorage_path_; 122 base::FilePath old_localstorage_path_;
119 123
120 base::WeakPtrFactory<LocalStorageContextMojo> weak_ptr_factory_; 124 base::WeakPtrFactory<LocalStorageContextMojo> weak_ptr_factory_;
121 }; 125 };
122 126
123 } // namespace content 127 } // namespace content
124 128
125 #endif // CONTENT_BROWSER_DOM_STORAGE_LOCAL_STORAGE_CONTEXT_MOJO_H_ 129 #endif // CONTENT_BROWSER_DOM_STORAGE_LOCAL_STORAGE_CONTEXT_MOJO_H_
OLDNEW
« no previous file with comments | « content/browser/dom_storage/dom_storage_context_wrapper.cc ('k') | content/browser/dom_storage/local_storage_context_mojo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698