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

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

Issue 9963107: Persist sessionStorage on disk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review. Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
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/file_path.h" 9 #include "base/file_path.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/string16.h" 11 #include "base/string16.h"
12 #include "base/time.h" 12 #include "base/time.h"
13 #include "content/public/browser/dom_storage_context.h" 13 #include "content/public/browser/dom_storage_context.h"
14 #include "webkit/dom_storage/dom_storage_types.h" 14 #include "webkit/dom_storage/dom_storage_types.h"
15 15
16 namespace content {
17 class SessionStorageNamespace;
18 }
19
16 namespace dom_storage { 20 namespace dom_storage {
17 class DomStorageContext; 21 class DomStorageContext;
18 } 22 }
19 23
20 namespace quota { 24 namespace quota {
21 class SpecialStoragePolicy; 25 class SpecialStoragePolicy;
22 } 26 }
23 27
24 // This is owned by BrowserContext (aka Profile) and encapsulates all 28 // This is owned by BrowserContext (aka Profile) and encapsulates all
25 // per-profile dom storage state. 29 // per-profile dom storage state.
26 class CONTENT_EXPORT DOMStorageContextImpl : 30 class CONTENT_EXPORT DOMStorageContextImpl :
27 NON_EXPORTED_BASE(public content::DOMStorageContext), 31 NON_EXPORTED_BASE(public content::DOMStorageContext),
28 public base::RefCountedThreadSafe<DOMStorageContextImpl> { 32 public base::RefCountedThreadSafe<DOMStorageContextImpl> {
29 public: 33 public:
30 // If |data_path| is empty, nothing will be saved to disk. 34 // If |data_path| is empty, nothing will be saved to disk.
31 DOMStorageContextImpl(const FilePath& data_path, 35 DOMStorageContextImpl(const FilePath& data_path,
32 quota::SpecialStoragePolicy* special_storage_policy); 36 quota::SpecialStoragePolicy* special_storage_policy);
33 37
34 // DOMStorageContext implementation. 38 // DOMStorageContext implementation.
35 virtual void GetUsageInfo(const GetUsageInfoCallback& callback) OVERRIDE; 39 virtual void GetUsageInfo(const GetUsageInfoCallback& callback) OVERRIDE;
36 virtual void DeleteOrigin(const GURL& origin) OVERRIDE; 40 virtual void DeleteOrigin(const GURL& origin) OVERRIDE;
37 41
38 // DEPRECATED DOMStorageContext implementation. 42 // DEPRECATED DOMStorageContext implementation.
39 virtual void GetAllStorageFiles( 43 virtual void GetAllStorageFiles(
40 const GetAllStorageFilesCallback& callback) OVERRIDE; 44 const GetAllStorageFilesCallback& callback) OVERRIDE;
41 virtual FilePath GetFilePath(const string16& origin_id) const OVERRIDE; 45 virtual FilePath GetFilePath(const string16& origin_id) const OVERRIDE;
42 virtual void DeleteForOrigin(const string16& origin_id) OVERRIDE; 46 virtual void DeleteForOrigin(const string16& origin_id) OVERRIDE;
43 virtual void DeleteLocalStorageFile(const FilePath& file_path) OVERRIDE; 47 virtual void DeleteLocalStorageFile(const FilePath& file_path) OVERRIDE;
48 virtual void DoomSessionStorage(
49 const std::string& persistent_namespace_id) OVERRIDE;
50 virtual scoped_refptr<content::SessionStorageNamespace>
51 RecreateSessionStorage(const std::string& persistent_id) OVERRIDE;
44 52
45 // Called to free up memory that's not strictly needed. 53 // Called to free up memory that's not strictly needed.
46 void PurgeMemory(); 54 void PurgeMemory();
47 55
48 // Used by content settings to alter the behavior around 56 // Used by content settings to alter the behavior around
49 // what data to keep and what data to discard at shutdown. 57 // what data to keep and what data to discard at shutdown.
50 // The policy is not so straight forward to describe, see 58 // The policy is not so straight forward to describe, see
51 // the implementation for details. 59 // the implementation for details.
52 void SetForceKeepSessionState(); 60 void SetForceKeepSessionState();
53 61
54 // Called when the BrowserContext/Profile is going away. 62 // Called when the BrowserContext/Profile is going away.
55 void Shutdown(); 63 void Shutdown();
56 64
57 private: 65 private:
58 friend class DOMStorageMessageFilter; // for access to context() 66 friend class DOMStorageMessageFilter; // for access to context()
59 friend class SessionStorageNamespaceImpl; // ditto 67 friend class SessionStorageNamespaceImpl; // ditto
60 friend class base::RefCountedThreadSafe<DOMStorageContextImpl>; 68 friend class base::RefCountedThreadSafe<DOMStorageContextImpl>;
61 69
62 virtual ~DOMStorageContextImpl(); 70 virtual ~DOMStorageContextImpl();
63 dom_storage::DomStorageContext* context() const { return context_.get(); } 71 dom_storage::DomStorageContext* context() const { return context_.get(); }
64 72
65 scoped_refptr<dom_storage::DomStorageContext> context_; 73 scoped_refptr<dom_storage::DomStorageContext> context_;
66 74
67 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageContextImpl); 75 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageContextImpl);
68 }; 76 };
69 77
70 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_IMPL_H_ 78 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698