OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_IMPL_H_ |
6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_IMPL_H_ | 6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_IMPL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "content/public/browser/dom_storage_context.h" | 10 #include "content/public/browser/dom_storage_context.h" |
11 | 11 |
12 class FilePath; | 12 class FilePath; |
13 | 13 |
14 namespace quota { | 14 namespace quota { |
15 class SpecialStoragePolicy; | 15 class SpecialStoragePolicy; |
16 } | 16 } |
17 | 17 |
18 // This is owned by BrowserContext (aka Profile) and encapsulates all | 18 // This is owned by BrowserContext (aka Profile) and encapsulates all |
19 // per-profile dom storage state. | 19 // per-profile dom storage state. |
20 class CONTENT_EXPORT DOMStorageContextImpl : | 20 class CONTENT_EXPORT DOMStorageContextImpl : |
21 NON_EXPORTED_BASE(public content::DOMStorageContext), | 21 NON_EXPORTED_BASE(public content::DOMStorageContext), |
22 public base::RefCountedThreadSafe<DOMStorageContextImpl> { | 22 public base::RefCountedThreadSafe<DOMStorageContextImpl> { |
23 public: | 23 public: |
24 // If |data_path| is empty, nothing will be saved to disk. | 24 // If |data_path| is empty, nothing will be saved to disk. |
25 DOMStorageContextImpl(const FilePath& data_path, | 25 DOMStorageContextImpl(const FilePath& data_path, |
26 quota::SpecialStoragePolicy* special_storage_policy); | 26 quota::SpecialStoragePolicy* special_storage_policy, |
| 27 bool save_session_storage_on_disk); |
27 | 28 |
28 // DOMStorageContext implementation. | 29 // DOMStorageContext implementation. |
29 virtual void GetUsageInfo(const GetUsageInfoCallback& callback) OVERRIDE; | 30 virtual void GetUsageInfo(const GetUsageInfoCallback& callback) OVERRIDE; |
30 virtual void DeleteOrigin(const GURL& origin) OVERRIDE; | 31 virtual void DeleteOrigin(const GURL& origin) OVERRIDE; |
31 virtual scoped_refptr<content::SessionStorageNamespace> | 32 virtual scoped_refptr<content::SessionStorageNamespace> |
32 RecreateSessionStorage(const std::string& persistent_id) OVERRIDE; | 33 RecreateSessionStorage(const std::string& persistent_id) OVERRIDE; |
| 34 virtual void StartScavengingUnusedSessionStorage() OVERRIDE; |
33 | 35 |
34 // Called to free up memory that's not strictly needed. | 36 // Called to free up memory that's not strictly needed. |
35 void PurgeMemory(); | 37 void PurgeMemory(); |
36 | 38 |
37 // Used by content settings to alter the behavior around | 39 // Used by content settings to alter the behavior around |
38 // what data to keep and what data to discard at shutdown. | 40 // what data to keep and what data to discard at shutdown. |
39 // The policy is not so straight forward to describe, see | 41 // The policy is not so straight forward to describe, see |
40 // the implementation for details. | 42 // the implementation for details. |
41 void SetForceKeepSessionState(); | 43 void SetForceKeepSessionState(); |
42 | 44 |
43 // Called when the BrowserContext/Profile is going away. | 45 // Called when the BrowserContext/Profile is going away. |
44 void Shutdown(); | 46 void Shutdown(); |
45 | 47 |
46 private: | 48 private: |
47 friend class DOMStorageMessageFilter; // for access to context() | 49 friend class DOMStorageMessageFilter; // for access to context() |
48 friend class SessionStorageNamespaceImpl; // ditto | 50 friend class SessionStorageNamespaceImpl; // ditto |
49 friend class base::RefCountedThreadSafe<DOMStorageContextImpl>; | 51 friend class base::RefCountedThreadSafe<DOMStorageContextImpl>; |
50 | 52 |
51 virtual ~DOMStorageContextImpl(); | 53 virtual ~DOMStorageContextImpl(); |
52 dom_storage::DomStorageContext* context() const { return context_.get(); } | 54 dom_storage::DomStorageContext* context() const { return context_.get(); } |
53 | 55 |
54 scoped_refptr<dom_storage::DomStorageContext> context_; | 56 scoped_refptr<dom_storage::DomStorageContext> context_; |
55 | 57 |
56 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageContextImpl); | 58 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageContextImpl); |
57 }; | 59 }; |
58 | 60 |
59 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_IMPL_H_ | 61 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_IMPL_H_ |
OLD | NEW |