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

Side by Side Diff: content/browser/in_process_webkit/dom_storage_context_impl.cc

Issue 9700007: ContentAPI change - Post DomStorage tasks via a SequencedTaskRunner instead of directly to WEBKIT_DE (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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "content/browser/in_process_webkit/dom_storage_context_impl.h" 5 #include "content/browser/in_process_webkit/dom_storage_context_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } // namespace 57 } // namespace
58 58
59 DOMStorageContextImpl::DOMStorageContextImpl( 59 DOMStorageContextImpl::DOMStorageContextImpl(
60 const FilePath& data_path, 60 const FilePath& data_path,
61 quota::SpecialStoragePolicy* special_storage_policy) 61 quota::SpecialStoragePolicy* special_storage_policy)
62 : last_storage_area_id_(0), 62 : last_storage_area_id_(0),
63 last_session_storage_namespace_id_on_ui_thread_(kLocalStorageNamespaceId), 63 last_session_storage_namespace_id_on_ui_thread_(kLocalStorageNamespaceId),
64 last_session_storage_namespace_id_on_io_thread_(kLocalStorageNamespaceId), 64 last_session_storage_namespace_id_on_io_thread_(kLocalStorageNamespaceId),
65 clear_local_state_on_exit_(false), 65 clear_local_state_on_exit_(false),
66 save_session_state_(false), 66 save_session_state_(false),
67 special_storage_policy_(special_storage_policy) { 67 special_storage_policy_(special_storage_policy),
68 webkit_message_loop_(
69 BrowserThread::GetMessageLoopProxyForThread(
70 BrowserThread::WEBKIT_DEPRECATED)) {
68 data_path_ = data_path; 71 data_path_ = data_path;
69 } 72 }
70 73
71 DOMStorageContextImpl::~DOMStorageContextImpl() { 74 DOMStorageContextImpl::~DOMStorageContextImpl() {
72 // This should not go away until all DOM Storage message filters have gone 75 // This should not go away until all DOM Storage message filters have gone
73 // away. And they remove themselves from this list. 76 // away. And they remove themselves from this list.
74 DCHECK(message_filter_set_.empty()); 77 DCHECK(message_filter_set_.empty());
75 78
76 for (StorageNamespaceMap::iterator iter(storage_namespace_map_.begin()); 79 for (StorageNamespaceMap::iterator iter(storage_namespace_map_.begin());
77 iter != storage_namespace_map_.end(); ++iter) { 80 iter != storage_namespace_map_.end(); ++iter) {
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 void DOMStorageContextImpl::CompleteCloningSessionStorage( 288 void DOMStorageContextImpl::CompleteCloningSessionStorage(
286 int64 existing_id, int64 clone_id) { 289 int64 existing_id, int64 clone_id) {
287 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); 290 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
288 DOMStorageNamespace* existing_namespace = 291 DOMStorageNamespace* existing_namespace =
289 GetStorageNamespace(existing_id, false); 292 GetStorageNamespace(existing_id, false);
290 // If nothing exists, then there's nothing to clone. 293 // If nothing exists, then there's nothing to clone.
291 if (existing_namespace) 294 if (existing_namespace)
292 RegisterStorageNamespace(existing_namespace->Copy(clone_id)); 295 RegisterStorageNamespace(existing_namespace->Copy(clone_id));
293 } 296 }
294 297
298 base::SequencedTaskRunner* DOMStorageContextImpl::task_runner() const {
299 return webkit_message_loop_;
300 }
301
295 std::vector<FilePath> DOMStorageContextImpl::GetAllStorageFiles() { 302 std::vector<FilePath> DOMStorageContextImpl::GetAllStorageFiles() {
296 std::vector<FilePath> files; 303 std::vector<FilePath> files;
297 file_util::FileEnumerator file_enumerator( 304 file_util::FileEnumerator file_enumerator(
298 data_path_.Append(kLocalStorageDirectory), false, 305 data_path_.Append(kLocalStorageDirectory), false,
299 file_util::FileEnumerator::FILES); 306 file_util::FileEnumerator::FILES);
300 for (FilePath file_path = file_enumerator.Next(); !file_path.empty(); 307 for (FilePath file_path = file_enumerator.Next(); !file_path.empty();
301 file_path = file_enumerator.Next()) { 308 file_path = file_enumerator.Next()) {
302 if (file_path.Extension() == kLocalStorageExtension) 309 if (file_path.Extension() == kLocalStorageExtension)
303 files.push_back(file_path); 310 files.push_back(file_path);
304 } 311 }
305 return files; 312 return files;
306 } 313 }
307 314
308 FilePath DOMStorageContextImpl::GetFilePath(const string16& origin_id) const { 315 FilePath DOMStorageContextImpl::GetFilePath(const string16& origin_id) const {
309 FilePath storage_dir = data_path_.Append(kLocalStorageDirectory); 316 FilePath storage_dir = data_path_.Append(kLocalStorageDirectory);
310 FilePath::StringType id = webkit_glue::WebStringToFilePathString(origin_id); 317 FilePath::StringType id = webkit_glue::WebStringToFilePathString(origin_id);
311 return storage_dir.Append(id.append(kLocalStorageExtension)); 318 return storage_dir.Append(id.append(kLocalStorageExtension));
312 } 319 }
OLDNEW
« no previous file with comments | « content/browser/in_process_webkit/dom_storage_context_impl.h ('k') | content/public/browser/dom_storage_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698