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

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

Issue 9963107: Persist sessionStorage on disk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review (pkasting) Created 8 years, 4 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
« no previous file with comments | « content/public/browser/dom_storage_context.h ('k') | webkit/dom_storage/dom_storage_area.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_AREA_H_ 5 #ifndef WEBKIT_DOM_STORAGE_DOM_STORAGE_AREA_H_
6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_AREA_H_ 6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_AREA_H_
7 7
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/gtest_prod_util.h" 9 #include "base/gtest_prod_util.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/nullable_string16.h" 12 #include "base/nullable_string16.h"
13 #include "base/string16.h" 13 #include "base/string16.h"
14 #include "googleurl/src/gurl.h" 14 #include "googleurl/src/gurl.h"
15 #include "webkit/dom_storage/dom_storage_types.h" 15 #include "webkit/dom_storage/dom_storage_types.h"
16 16
17 namespace dom_storage { 17 namespace dom_storage {
18 18
19 class DomStorageDatabaseAdapter; 19 class DomStorageDatabaseAdapter;
20 class DomStorageMap; 20 class DomStorageMap;
21 class DomStorageTaskRunner; 21 class DomStorageTaskRunner;
22 class SessionStorageDatabase;
22 23
23 // Container for a per-origin Map of key/value pairs potentially 24 // Container for a per-origin Map of key/value pairs potentially
24 // backed by storage on disk and lazily commits changes to disk. 25 // backed by storage on disk and lazily commits changes to disk.
25 // See class comments for DomStorageContext for a larger overview. 26 // See class comments for DomStorageContext for a larger overview.
26 class DomStorageArea 27 class DomStorageArea
27 : public base::RefCountedThreadSafe<DomStorageArea> { 28 : public base::RefCountedThreadSafe<DomStorageArea> {
28 29
29 public: 30 public:
30 static const FilePath::CharType kDatabaseFileExtension[]; 31 static const FilePath::CharType kDatabaseFileExtension[];
31 static FilePath DatabaseFileNameFromOrigin(const GURL& origin); 32 static FilePath DatabaseFileNameFromOrigin(const GURL& origin);
32 static GURL OriginFromDatabaseFileName(const FilePath& file_name); 33 static GURL OriginFromDatabaseFileName(const FilePath& file_name);
33 34
34 // Local storage. Backed on disk if directory is nonempty. 35 // Local storage. Backed on disk if directory is nonempty.
35 DomStorageArea(const GURL& origin, 36 DomStorageArea(const GURL& origin,
36 const FilePath& directory, 37 const FilePath& directory,
37 DomStorageTaskRunner* task_runner); 38 DomStorageTaskRunner* task_runner);
38 39
39 // Session storage. 40 // Session storage. Backed on disk if |session_storage_backing| is not NULL.
40 DomStorageArea(int64 namespace_id, 41 DomStorageArea(int64 namespace_id,
41 const std::string& persistent_namespace_id, 42 const std::string& persistent_namespace_id,
42 const GURL& origin, 43 const GURL& origin,
44 SessionStorageDatabase* session_storage_backing,
43 DomStorageTaskRunner* task_runner); 45 DomStorageTaskRunner* task_runner);
44 46
45 const GURL& origin() const { return origin_; } 47 const GURL& origin() const { return origin_; }
46 int64 namespace_id() const { return namespace_id_; } 48 int64 namespace_id() const { return namespace_id_; }
47 49
48 // Writes a copy of the current set of values in the area to the |map|. 50 // Writes a copy of the current set of values in the area to the |map|.
49 void ExtractValues(ValuesMap* map); 51 void ExtractValues(ValuesMap* map);
50 52
51 unsigned Length(); 53 unsigned Length();
52 NullableString16 Key(unsigned index); 54 NullableString16 Key(unsigned index);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 114
113 void ShutdownInCommitSequence(); 115 void ShutdownInCommitSequence();
114 116
115 int64 namespace_id_; 117 int64 namespace_id_;
116 std::string persistent_namespace_id_; 118 std::string persistent_namespace_id_;
117 GURL origin_; 119 GURL origin_;
118 FilePath directory_; 120 FilePath directory_;
119 scoped_refptr<DomStorageTaskRunner> task_runner_; 121 scoped_refptr<DomStorageTaskRunner> task_runner_;
120 scoped_refptr<DomStorageMap> map_; 122 scoped_refptr<DomStorageMap> map_;
121 scoped_ptr<DomStorageDatabaseAdapter> backing_; 123 scoped_ptr<DomStorageDatabaseAdapter> backing_;
124 scoped_refptr<SessionStorageDatabase> session_storage_backing_;
122 bool is_initial_import_done_; 125 bool is_initial_import_done_;
123 bool is_shutdown_; 126 bool is_shutdown_;
124 scoped_ptr<CommitBatch> commit_batch_; 127 scoped_ptr<CommitBatch> commit_batch_;
125 int commit_batches_in_flight_; 128 int commit_batches_in_flight_;
126 }; 129 };
127 130
128 } // namespace dom_storage 131 } // namespace dom_storage
129 132
130 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_AREA_H_ 133 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_AREA_H_
OLDNEW
« no previous file with comments | « content/public/browser/dom_storage_context.h ('k') | webkit/dom_storage/dom_storage_area.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698