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

Side by Side 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 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_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 #pragma once 7 #pragma once
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 30 matching lines...) Expand all
41 unsigned Length(); 41 unsigned Length();
42 NullableString16 Key(unsigned index); 42 NullableString16 Key(unsigned index);
43 NullableString16 GetItem(const string16& key); 43 NullableString16 GetItem(const string16& key);
44 bool SetItem(const string16& key, const string16& value, 44 bool SetItem(const string16& key, const string16& value,
45 NullableString16* old_value); 45 NullableString16* old_value);
46 bool RemoveItem(const string16& key, string16* old_value); 46 bool RemoveItem(const string16& key, string16* old_value);
47 bool Clear(); 47 bool Clear();
48 48
49 DomStorageArea* ShallowCopy(int64 destination_namespace_id); 49 DomStorageArea* ShallowCopy(int64 destination_namespace_id);
50 50
51 void Shutdown();
52
51 private: 53 private:
52 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, DomStorageAreaBasics); 54 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, DomStorageAreaBasics);
53 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, BackingDatabaseOpened); 55 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, BackingDatabaseOpened);
54 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, TestDatabaseFilePath); 56 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, TestDatabaseFilePath);
55 friend class base::RefCountedThreadSafe<DomStorageArea>; 57 friend class base::RefCountedThreadSafe<DomStorageArea>;
58 struct CommitBatch;
59
60 ~DomStorageArea();
56 61
57 // If we haven't done so already and this is a local storage area, 62 // If we haven't done so already and this is a local storage area,
58 // will attempt to read any values for this origin currently 63 // will attempt to read any values for this origin currently
59 // stored on disk. 64 // stored on disk.
60 void InitialImportIfNeeded(); 65 void InitialImportIfNeeded();
61 66
62 // Posts a task to write the set of changed values to disk. 67 // Post tasks to defer writing a batch of changed values to
63 void ScheduleCommitChanges(); 68 // disk on the commit sequence, and to call back on the main
69 // task sequence when complete.
70 CommitBatch* CreateCommitBatchIfNeeded();
71 void OnCommitTimer();
64 void CommitChanges(); 72 void CommitChanges();
73 void OnCommitComplete();
65 74
66 ~DomStorageArea(); 75 void ShutdownInCommitSequence();
76
77
67 78
68 int64 namespace_id_; 79 int64 namespace_id_;
69 GURL origin_; 80 GURL origin_;
70 FilePath directory_; 81 FilePath directory_;
71 scoped_refptr<DomStorageTaskRunner> task_runner_; 82 scoped_refptr<DomStorageTaskRunner> task_runner_;
72 scoped_refptr<DomStorageMap> map_; 83 scoped_refptr<DomStorageMap> map_;
73 scoped_ptr<DomStorageDatabase> backing_; 84 scoped_ptr<DomStorageDatabase> backing_;
74 bool initial_import_done_; 85 bool is_initial_import_done_;
75 ValuesMap changed_values_; 86 bool is_shutdown_;
76 bool clear_all_next_commit_; 87
77 bool commit_in_flight_; 88 scoped_ptr<CommitBatch> commit_batch_;
89 scoped_ptr<CommitBatch> in_flight_commit_batch_;
78 }; 90 };
79 91
80 } // namespace dom_storage 92 } // namespace dom_storage
81 93
82 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_AREA_H_ 94 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_AREA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698