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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
Index: webkit/dom_storage/dom_storage_area.h
diff --git a/webkit/dom_storage/dom_storage_area.h b/webkit/dom_storage/dom_storage_area.h
index 0bad246431725068a34e97242d199f3b8b36b20b..b321eea4d8ace69c2a52ba5af02dde5aa059f258 100644
--- a/webkit/dom_storage/dom_storage_area.h
+++ b/webkit/dom_storage/dom_storage_area.h
@@ -9,16 +9,19 @@
#include "base/file_path.h"
#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
#include "base/nullable_string16.h"
#include "base/string16.h"
#include "googleurl/src/gurl.h"
-#include "webkit/dom_storage/dom_storage_database.h"
+#include "webkit/dom_storage/dom_storage_database_adapter.h"
#include "webkit/dom_storage/dom_storage_types.h"
namespace dom_storage {
+class DomStorageDatabaseAdapter;
class DomStorageMap;
class DomStorageTaskRunner;
+class SessionStorageDatabase;
// Container for a per-origin Map of key/value pairs potentially
// backed by storage on disk and lazily commits changes to disk.
@@ -31,11 +34,23 @@ class DomStorageArea
static FilePath DatabaseFileNameFromOrigin(const GURL& origin);
static GURL OriginFromDatabaseFileName(const FilePath& file_name);
+ // Local storage backed on disk.
DomStorageArea(int64 namespace_id,
const GURL& origin,
const FilePath& directory,
DomStorageTaskRunner* task_runner);
+ // Session storage backed on disk.
+ DomStorageArea(int64 namespace_id,
+ const GURL& origin,
+ SessionStorageDatabase* session_storage_backing,
+ DomStorageTaskRunner* task_runner);
+
+ // Local storage or session storage in memory.
+ DomStorageArea(int64 namespace_id,
+ const GURL& origin,
+ DomStorageTaskRunner* task_runner);
+
const GURL& origin() const { return origin_; }
int64 namespace_id() const { return namespace_id_; }
@@ -77,8 +92,13 @@ class DomStorageArea
friend class base::RefCountedThreadSafe<DomStorageArea>;
struct CommitBatch {
+ // When committed, Commitbatch will first commit changed_values. If
+ // changed_values_after_deep_copy is non-empty, it will deep cpoy the map,
+ // and commit changed_values_after_deep_copy.
michaeln 2012/04/22 21:43:35 see comments in the .cc file about simplifying thi
marja 2012/05/11 12:18:32 Done.
bool clear_all_first;
ValuesMap changed_values;
+ bool clear_all_after_deep_copy;
+ ValuesMap changed_values_after_deep_copy;
CommitBatch();
~CommitBatch();
};
@@ -91,8 +111,8 @@ class DomStorageArea
void InitialImportIfNeeded();
// Post tasks to defer writing a batch of changed values to
- // disk on the commit sequence, and to call back on the primary
- // task sequence when complete.
+ // disk on the commit sequence, and to call back on the primary task
+ // sequence when complete.
CommitBatch* CreateCommitBatchIfNeeded();
void OnCommitTimer();
void CommitChanges();
@@ -105,9 +125,11 @@ class DomStorageArea
FilePath directory_;
scoped_refptr<DomStorageTaskRunner> task_runner_;
scoped_refptr<DomStorageMap> map_;
- scoped_ptr<DomStorageDatabase> backing_;
+ scoped_ptr<DomStorageDatabaseAdapter> backing_;
+ scoped_refptr<SessionStorageDatabase> session_storage_backing_;
bool is_initial_import_done_;
bool is_shutdown_;
+ bool is_shallow_copy_;
michaeln 2012/04/22 21:43:35 not sure the is_shallow_copy_ data member is good
marja 2012/05/11 12:18:32 Gone.
scoped_ptr<CommitBatch> commit_batch_;
scoped_ptr<CommitBatch> in_flight_commit_batch_;
};

Powered by Google App Engine
This is Rietveld 408576698