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

Side by Side Diff: content/browser/dom_storage/dom_storage_area.h

Issue 1138843002: localStorage: Aggressively flush to disk for Android WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2357
Patch Set: Created 5 years, 7 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
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/browser/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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_AREA_H_ 5 #ifndef CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_AREA_H_
6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_AREA_H_ 6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_AREA_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 17 matching lines...) Expand all
28 // backed by storage on disk and lazily commits changes to disk. 28 // backed by storage on disk and lazily commits changes to disk.
29 // See class comments for DOMStorageContextImpl for a larger overview. 29 // See class comments for DOMStorageContextImpl for a larger overview.
30 class CONTENT_EXPORT DOMStorageArea 30 class CONTENT_EXPORT DOMStorageArea
31 : public base::RefCountedThreadSafe<DOMStorageArea> { 31 : public base::RefCountedThreadSafe<DOMStorageArea> {
32 32
33 public: 33 public:
34 static const base::FilePath::CharType kDatabaseFileExtension[]; 34 static const base::FilePath::CharType kDatabaseFileExtension[];
35 static base::FilePath DatabaseFileNameFromOrigin(const GURL& origin); 35 static base::FilePath DatabaseFileNameFromOrigin(const GURL& origin);
36 static GURL OriginFromDatabaseFileName(const base::FilePath& file_name); 36 static GURL OriginFromDatabaseFileName(const base::FilePath& file_name);
37 37
38 // Commence aggressive flushing. This should be called early in the startup -
39 // before any localStorage writing. Currently scheduled writes will not be
40 // rescheduled and will be flushed at the scheduled time after which
41 // aggressive flushing will commence.
42 static void EnableAggressiveCommitDelay();
43
38 // Local storage. Backed on disk if directory is nonempty. 44 // Local storage. Backed on disk if directory is nonempty.
39 DOMStorageArea(const GURL& origin, 45 DOMStorageArea(const GURL& origin,
40 const base::FilePath& directory, 46 const base::FilePath& directory,
41 DOMStorageTaskRunner* task_runner); 47 DOMStorageTaskRunner* task_runner);
42 48
43 // Session storage. Backed on disk if |session_storage_backing| is not NULL. 49 // Session storage. Backed on disk if |session_storage_backing| is not NULL.
44 DOMStorageArea(int64 namespace_id, 50 DOMStorageArea(int64 namespace_id,
45 const std::string& persistent_namespace_id, 51 const std::string& persistent_namespace_id,
46 const GURL& origin, 52 const GURL& origin,
47 SessionStorageDatabase* session_storage_backing, 53 SessionStorageDatabase* session_storage_backing,
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // task sequence when complete. 151 // task sequence when complete.
146 CommitBatch* CreateCommitBatchIfNeeded(); 152 CommitBatch* CreateCommitBatchIfNeeded();
147 void OnCommitTimer(); 153 void OnCommitTimer();
148 void PostCommitTask(); 154 void PostCommitTask();
149 void CommitChanges(const CommitBatch* commit_batch); 155 void CommitChanges(const CommitBatch* commit_batch);
150 void OnCommitComplete(); 156 void OnCommitComplete();
151 base::TimeDelta ComputeCommitDelay() const; 157 base::TimeDelta ComputeCommitDelay() const;
152 158
153 void ShutdownInCommitSequence(); 159 void ShutdownInCommitSequence();
154 160
161 static bool s_aggressive_flushing_enabled_;
162
155 int64 namespace_id_; 163 int64 namespace_id_;
156 std::string persistent_namespace_id_; 164 std::string persistent_namespace_id_;
157 GURL origin_; 165 GURL origin_;
158 base::FilePath directory_; 166 base::FilePath directory_;
159 scoped_refptr<DOMStorageTaskRunner> task_runner_; 167 scoped_refptr<DOMStorageTaskRunner> task_runner_;
160 scoped_refptr<DOMStorageMap> map_; 168 scoped_refptr<DOMStorageMap> map_;
161 scoped_ptr<DOMStorageDatabaseAdapter> backing_; 169 scoped_ptr<DOMStorageDatabaseAdapter> backing_;
162 scoped_refptr<SessionStorageDatabase> session_storage_backing_; 170 scoped_refptr<SessionStorageDatabase> session_storage_backing_;
163 bool is_initial_import_done_; 171 bool is_initial_import_done_;
164 bool is_shutdown_; 172 bool is_shutdown_;
165 scoped_ptr<CommitBatch> commit_batch_; 173 scoped_ptr<CommitBatch> commit_batch_;
166 int commit_batches_in_flight_; 174 int commit_batches_in_flight_;
167 base::TimeTicks start_time_; 175 base::TimeTicks start_time_;
168 RateLimiter data_rate_limiter_; 176 RateLimiter data_rate_limiter_;
169 RateLimiter commit_rate_limiter_; 177 RateLimiter commit_rate_limiter_;
170 178
171 DISALLOW_COPY_AND_ASSIGN(DOMStorageArea); 179 DISALLOW_COPY_AND_ASSIGN(DOMStorageArea);
172 }; 180 };
173 181
174 } // namespace content 182 } // namespace content
175 183
176 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_AREA_H_ 184 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_AREA_H_
OLDNEW
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/browser/dom_storage/dom_storage_area.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698