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

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

Issue 1129233003: localStorage: Aggressively flush to disk for Android WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@local-storage-flush-android
Patch Set: Only logging LocalStorage.CommitDelay when not aggressive 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
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 16 matching lines...) Expand all
27 // Container for a per-origin Map of key/value pairs potentially 27 // Container for a per-origin Map of key/value pairs potentially
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 static void EnableAggressiveCommitDelay();
37 38
38 // Local storage. Backed on disk if directory is nonempty. 39 // Local storage. Backed on disk if directory is nonempty.
39 DOMStorageArea(const GURL& origin, 40 DOMStorageArea(const GURL& origin,
40 const base::FilePath& directory, 41 const base::FilePath& directory,
41 DOMStorageTaskRunner* task_runner); 42 DOMStorageTaskRunner* task_runner);
42 43
43 // Session storage. Backed on disk if |session_storage_backing| is not NULL. 44 // Session storage. Backed on disk if |session_storage_backing| is not NULL.
44 DOMStorageArea(int64 namespace_id, 45 DOMStorageArea(int64 namespace_id,
45 const std::string& persistent_namespace_id, 46 const std::string& persistent_namespace_id,
46 const GURL& origin, 47 const GURL& origin,
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 CommitBatch* CreateCommitBatchIfNeeded(); 147 CommitBatch* CreateCommitBatchIfNeeded();
147 void StartCommitTimer(); 148 void StartCommitTimer();
148 void OnCommitTimer(); 149 void OnCommitTimer();
149 void PostCommitTask(); 150 void PostCommitTask();
150 void CommitChanges(const CommitBatch* commit_batch); 151 void CommitChanges(const CommitBatch* commit_batch);
151 void OnCommitComplete(); 152 void OnCommitComplete();
152 base::TimeDelta ComputeCommitDelay() const; 153 base::TimeDelta ComputeCommitDelay() const;
153 154
154 void ShutdownInCommitSequence(); 155 void ShutdownInCommitSequence();
155 156
157 // If true will write values "soon" i.e. within 1 sec.
158 static bool s_aggressive_flushing_enabled_;
159
156 int64 namespace_id_; 160 int64 namespace_id_;
157 std::string persistent_namespace_id_; 161 std::string persistent_namespace_id_;
158 GURL origin_; 162 GURL origin_;
159 base::FilePath directory_; 163 base::FilePath directory_;
160 scoped_refptr<DOMStorageTaskRunner> task_runner_; 164 scoped_refptr<DOMStorageTaskRunner> task_runner_;
161 scoped_refptr<DOMStorageMap> map_; 165 scoped_refptr<DOMStorageMap> map_;
162 scoped_ptr<DOMStorageDatabaseAdapter> backing_; 166 scoped_ptr<DOMStorageDatabaseAdapter> backing_;
163 scoped_refptr<SessionStorageDatabase> session_storage_backing_; 167 scoped_refptr<SessionStorageDatabase> session_storage_backing_;
164 bool is_initial_import_done_; 168 bool is_initial_import_done_;
165 bool is_shutdown_; 169 bool is_shutdown_;
166 scoped_ptr<CommitBatch> commit_batch_; 170 scoped_ptr<CommitBatch> commit_batch_;
167 int commit_batches_in_flight_; 171 int commit_batches_in_flight_;
168 base::TimeTicks start_time_; 172 base::TimeTicks start_time_;
169 RateLimiter data_rate_limiter_; 173 RateLimiter data_rate_limiter_;
170 RateLimiter commit_rate_limiter_; 174 RateLimiter commit_rate_limiter_;
171 175
172 DISALLOW_COPY_AND_ASSIGN(DOMStorageArea); 176 DISALLOW_COPY_AND_ASSIGN(DOMStorageArea);
173 }; 177 };
174 178
175 } // namespace content 179 } // namespace content
176 180
177 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_AREA_H_ 181 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_AREA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698