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

Side by Side Diff: webkit/dom_storage/dom_storage_namespace.h

Issue 9963107: Persist sessionStorage on disk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup. Created 8 years, 8 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 WEBKIT_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_ 5 #ifndef WEBKIT_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_
6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_ 6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 14
15 class GURL; 15 class GURL;
16 16
17 namespace dom_storage { 17 namespace dom_storage {
18 18
19 class DomStorageArea; 19 class DomStorageArea;
20 class DomStorageTaskRunner; 20 class DomStorageTaskRunner;
21 class SessionStorageDatabase;
21 22
22 // Container for the set of per-origin Areas. 23 // Container for the set of per-origin Areas.
23 // See class comments for DomStorageContext for a larger overview. 24 // See class comments for DomStorageContext for a larger overview.
24 class DomStorageNamespace 25 class DomStorageNamespace
25 : public base::RefCountedThreadSafe<DomStorageNamespace> { 26 : public base::RefCountedThreadSafe<DomStorageNamespace> {
26 public: 27 public:
27 // Constructor for a LocalStorage namespace with id of 0 28 // Constructor for a LocalStorage namespace with id of 0
28 // and an optional backing directory on disk. 29 // and an optional backing directory on disk.
29 DomStorageNamespace(const FilePath& directory, // may be empty 30 DomStorageNamespace(const FilePath& directory, // may be empty
30 DomStorageTaskRunner* task_runner); 31 DomStorageTaskRunner* task_runner);
31 32
32 // Constructor for a SessionStorage namespace with a non-zero id 33 // Constructor for a SessionStorage namespace with a non-zero id
33 // and no backing directory on disk. 34 // and no backing on disk.
34 DomStorageNamespace(int64 namespace_id, 35 DomStorageNamespace(int64 namespace_id,
35 DomStorageTaskRunner* task_runner); 36 DomStorageTaskRunner* task_runner);
36 37
38 // Constructor for a SessionStorage namespace with a non-zero id and backing
39 // on disk via |session_storage_database|.
michaeln 2012/04/22 21:43:35 i see in the .cc file this ctor is being called wi
marja 2012/05/11 12:18:32 Done.
40 DomStorageNamespace(int64 namespace_id,
41 SessionStorageDatabase* session_storage_database,
42 DomStorageTaskRunner* task_runner);
43
37 int64 namespace_id() const { return namespace_id_; } 44 int64 namespace_id() const { return namespace_id_; }
38 45
39 // Returns the storage area for the given origin, 46 // Returns the storage area for the given origin,
40 // creating instance if needed. Each call to open 47 // creating instance if needed. Each call to open
41 // must be balanced with a call to CloseStorageArea. 48 // must be balanced with a call to CloseStorageArea.
42 DomStorageArea* OpenStorageArea(const GURL& origin); 49 DomStorageArea* OpenStorageArea(const GURL& origin);
43 void CloseStorageArea(DomStorageArea* area); 50 void CloseStorageArea(DomStorageArea* area);
44 51
45 // Creates a clone of |this| namespace including 52 // Creates a clone of |this| namespace including
46 // shallow copies of all contained areas. 53 // shallow copies of all contained areas.
(...skipping 16 matching lines...) Expand all
63 AreaHolder(DomStorageArea* area, int count); 70 AreaHolder(DomStorageArea* area, int count);
64 ~AreaHolder(); 71 ~AreaHolder();
65 }; 72 };
66 typedef std::map<GURL, AreaHolder> AreaMap; 73 typedef std::map<GURL, AreaHolder> AreaMap;
67 74
68 ~DomStorageNamespace(); 75 ~DomStorageNamespace();
69 76
70 // Returns a pointer to the area holder in our map or NULL. 77 // Returns a pointer to the area holder in our map or NULL.
71 AreaHolder* GetAreaHolder(const GURL& origin); 78 AreaHolder* GetAreaHolder(const GURL& origin);
72 79
80 void CloneNamespaceInCommitSequence(int64 clone_namespace_id);
81
73 int64 namespace_id_; 82 int64 namespace_id_;
74 FilePath directory_; 83 FilePath directory_;
75 AreaMap areas_; 84 AreaMap areas_;
76 scoped_refptr<DomStorageTaskRunner> task_runner_; 85 scoped_refptr<DomStorageTaskRunner> task_runner_;
86 scoped_refptr<SessionStorageDatabase> session_storage_database_;
77 }; 87 };
78 88
79 } // namespace dom_storage 89 } // namespace dom_storage
80 90
81 91
82 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_ 92 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698