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

Unified Diff: webkit/dom_storage/dom_storage_area.h

Issue 9718029: DomStorage commit task sequencing. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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
===================================================================
--- webkit/dom_storage/dom_storage_area.h (revision 127221)
+++ webkit/dom_storage/dom_storage_area.h (working copy)
@@ -27,6 +27,9 @@
: public base::RefCountedThreadSafe<DomStorageArea> {
public:
+ static FilePath DatabaseFileNameFromOrigin(const GURL& origin);
benm (inactive) 2012/03/19 14:22:53 Why is this public now?
michaeln 2012/03/19 16:04:42 This change really belongs in https://chromiumcode
+ static const FilePath::CharType kDatabaseFileExtension[];
+
DomStorageArea(int64 namespace_id,
const GURL& origin,
const FilePath& directory,
@@ -45,23 +48,30 @@
DomStorageArea* ShallowCopy(int64 destination_namespace_id);
+ void Shutdown();
+
private:
FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, DomStorageAreaBasics);
FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, BackingDatabaseOpened);
FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, TestDatabaseFilePath);
friend class base::RefCountedThreadSafe<DomStorageArea>;
+ struct CommitBatch;
+
// If we haven't done so already and this is a local storage area,
// will attempt to read any values for this origin currently
// stored on disk.
void InitialImportIfNeeded();
- // Posts a task to write the set of changed values to disk.
- void ScheduleCommitChanges();
+ // Post tasks to defer writing a batch of changed values to
+ // disk on the commit sequence, and to call back on the main
+ // task sequence when complete.
+ CommitBatch* GetCommitBatch();
+ void OnCommitTimer();
void CommitChanges();
+ void OnCommitComplete();
+ void CommitShutdownChanges();
- static FilePath DatabaseFileNameFromOrigin(const GURL& origin);
-
~DomStorageArea();
int64 namespace_id_;
@@ -70,10 +80,11 @@
scoped_refptr<DomStorageTaskRunner> task_runner_;
scoped_refptr<DomStorageMap> map_;
scoped_ptr<DomStorageDatabase> backing_;
- bool initial_import_done_;
- ValuesMap changed_values_;
- bool clear_all_next_commit_;
- bool commit_in_flight_;
+ bool is_initial_import_done_;
+ bool is_shutdown_;
+
+ scoped_ptr<CommitBatch> commit_batch_;
+ scoped_ptr<CommitBatch> in_flight_commit_batch_;
};
} // namespace dom_storage

Powered by Google App Engine
This is Rietveld 408576698