| Index: content/browser/dom_storage/dom_storage_context_impl.h
|
| diff --git a/content/browser/dom_storage/dom_storage_context_impl.h b/content/browser/dom_storage/dom_storage_context_impl.h
|
| index c2bbe4d42b50fcd2991e976540e64a6e1b58acc0..c8f27e37ed8cb355852264ac7d32ca90192cfe80 100644
|
| --- a/content/browser/dom_storage/dom_storage_context_impl.h
|
| +++ b/content/browser/dom_storage/dom_storage_context_impl.h
|
| @@ -65,6 +65,9 @@ class CONTENT_EXPORT DOMStorageContextImpl
|
| : public base::RefCountedThreadSafe<DOMStorageContextImpl>,
|
| public base::trace_event::MemoryDumpProvider {
|
| public:
|
| + typedef std::map<int64_t, scoped_refptr<DOMStorageNamespace>>
|
| + StorageNamespaceMap;
|
| +
|
| // An interface for observing Local and Session Storage events on the
|
| // background thread.
|
| class EventObserver {
|
| @@ -89,6 +92,19 @@ class CONTENT_EXPORT DOMStorageContextImpl
|
| virtual ~EventObserver() {}
|
| };
|
|
|
| + // Option for PurgeMemory.
|
| + enum PurgeOption {
|
| + // Determines if purging is required based on the usage and the platform.
|
| + PURGE_IF_NEEDED,
|
| +
|
| + // Purge unopened areas only.
|
| + PURGE_UNOPENED,
|
| +
|
| + // Purge aggressively, i.e. discard cache even for areas that have
|
| + // non-zero open count.
|
| + PURGE_AGGRESSIVE,
|
| + };
|
| +
|
| // |localstorage_directory| and |sessionstorage_directory| may be empty
|
| // for incognito browser contexts.
|
| DOMStorageContextImpl(const base::FilePath& localstorage_directory,
|
| @@ -175,6 +191,10 @@ class CONTENT_EXPORT DOMStorageContextImpl
|
| // unclean exit.
|
| void StartScavengingUnusedSessionStorage();
|
|
|
| + // Frees up memory when possible. Purges caches and schedules commits
|
| + // depending on the given |purge_option|.
|
| + void PurgeMemory(PurgeOption purge_option);
|
| +
|
| // base::trace_event::MemoryDumpProvider implementation.
|
| bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
|
| base::trace_event::ProcessMemoryDump* pmd) override;
|
| @@ -183,8 +203,6 @@ class CONTENT_EXPORT DOMStorageContextImpl
|
| friend class DOMStorageContextImplTest;
|
| FRIEND_TEST_ALL_PREFIXES(DOMStorageContextImplTest, Basics);
|
| friend class base::RefCountedThreadSafe<DOMStorageContextImpl>;
|
| - typedef std::map<int64_t, scoped_refptr<DOMStorageNamespace>>
|
| - StorageNamespaceMap;
|
|
|
| ~DOMStorageContextImpl() override;
|
|
|
| @@ -238,6 +256,9 @@ class CONTENT_EXPORT DOMStorageContextImpl
|
| // Mapping between persistent namespace IDs and namespace IDs for
|
| // sessionStorage.
|
| std::map<std::string, int64_t> persistent_namespace_id_to_namespace_id_;
|
| +
|
| + // For cleaning up unused databases more aggressively.
|
| + bool is_low_end_device_;
|
| };
|
|
|
| } // namespace content
|
|
|