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

Side by Side Diff: chrome/browser/extensions/extension_data_deleter.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 "chrome/browser/extensions/extension_data_deleter.h" 5 #include "chrome/browser/extensions/extension_data_deleter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 30 matching lines...) Expand all
41 DCHECK(profile); 41 DCHECK(profile);
42 scoped_refptr<ExtensionDataDeleter> deleter = 42 scoped_refptr<ExtensionDataDeleter> deleter =
43 new ExtensionDataDeleter( 43 new ExtensionDataDeleter(
44 profile, extension_id, storage_origin, is_storage_isolated); 44 profile, extension_id, storage_origin, is_storage_isolated);
45 45
46 BrowserThread::PostTask( 46 BrowserThread::PostTask(
47 BrowserThread::IO, FROM_HERE, 47 BrowserThread::IO, FROM_HERE,
48 base::Bind( 48 base::Bind(
49 &ExtensionDataDeleter::DeleteCookiesOnIOThread, deleter)); 49 &ExtensionDataDeleter::DeleteCookiesOnIOThread, deleter));
50 50
51 BrowserThread::PostTask( 51 scoped_refptr<DOMStorageContext> dom_storage_context =
52 BrowserThread::WEBKIT_DEPRECATED, FROM_HERE, 52 BrowserContext::GetDOMStorageContext(profile);
53 dom_storage_context->task_runner()->PostTask(
54 FROM_HERE,
53 base::Bind( 55 base::Bind(
54 &ExtensionDataDeleter::DeleteLocalStorageOnWebkitThread, deleter, 56 &ExtensionDataDeleter::DeleteLocalStorageInSequencedTask, deleter,
55 make_scoped_refptr(BrowserContext::GetDOMStorageContext(profile)))); 57 dom_storage_context));
56 58
57 BrowserThread::PostTask( 59 BrowserThread::PostTask(
58 BrowserThread::WEBKIT_DEPRECATED, FROM_HERE, 60 BrowserThread::WEBKIT_DEPRECATED, FROM_HERE,
59 base::Bind( 61 base::Bind(
60 &ExtensionDataDeleter::DeleteIndexedDBOnWebkitThread, deleter, 62 &ExtensionDataDeleter::DeleteIndexedDBOnWebkitThread, deleter,
61 make_scoped_refptr(BrowserContext::GetIndexedDBContext(profile)))); 63 make_scoped_refptr(BrowserContext::GetIndexedDBContext(profile))));
62 64
63 BrowserThread::PostTask( 65 BrowserThread::PostTask(
64 BrowserThread::FILE, FROM_HERE, 66 BrowserThread::FILE, FROM_HERE,
65 base::Bind( 67 base::Bind(
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 storage_origin_, net::CookieMonster::DeleteCallback()); 120 storage_origin_, net::CookieMonster::DeleteCallback());
119 } 121 }
120 122
121 void ExtensionDataDeleter::DeleteDatabaseOnFileThread() { 123 void ExtensionDataDeleter::DeleteDatabaseOnFileThread() {
122 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 124 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
123 int rv = database_tracker_->DeleteDataForOrigin( 125 int rv = database_tracker_->DeleteDataForOrigin(
124 origin_id_, net::CompletionCallback()); 126 origin_id_, net::CompletionCallback());
125 DCHECK(rv == net::OK || rv == net::ERR_IO_PENDING); 127 DCHECK(rv == net::OK || rv == net::ERR_IO_PENDING);
126 } 128 }
127 129
128 void ExtensionDataDeleter::DeleteLocalStorageOnWebkitThread( 130 void ExtensionDataDeleter::DeleteLocalStorageInSequencedTask(
129 scoped_refptr<DOMStorageContext> dom_storage_context) { 131 DOMStorageContext* dom_storage_context) {
130 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); 132 DCHECK(dom_storage_context->task_runner()->RunsTasksOnCurrentThread());
131 dom_storage_context->DeleteForOrigin(origin_id_); 133 dom_storage_context->DeleteForOrigin(origin_id_);
132 } 134 }
133 135
134 void ExtensionDataDeleter::DeleteIndexedDBOnWebkitThread( 136 void ExtensionDataDeleter::DeleteIndexedDBOnWebkitThread(
135 scoped_refptr<IndexedDBContext> indexed_db_context) { 137 scoped_refptr<IndexedDBContext> indexed_db_context) {
136 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); 138 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
137 indexed_db_context->DeleteForOrigin(storage_origin_); 139 indexed_db_context->DeleteForOrigin(storage_origin_);
138 } 140 }
139 141
140 void ExtensionDataDeleter::DeleteFileSystemOnFileThread() { 142 void ExtensionDataDeleter::DeleteFileSystemOnFileThread() {
141 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 143 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
142 file_system_context_->DeleteDataForOriginOnFileThread(storage_origin_); 144 file_system_context_->DeleteDataForOriginOnFileThread(storage_origin_);
143 145
144 // TODO(creis): The following call fails because the request context is still 146 // TODO(creis): The following call fails because the request context is still
145 // around, and holding open file handles in this directory. 147 // around, and holding open file handles in this directory.
146 // See http://crbug.com/85127 148 // See http://crbug.com/85127
147 if (!isolated_app_path_.empty()) 149 if (!isolated_app_path_.empty())
148 file_util::Delete(isolated_app_path_, true); 150 file_util::Delete(isolated_app_path_, true);
149 } 151 }
150 152
151 void ExtensionDataDeleter::DeleteAppcachesOnIOThread(ResourceContext* context) { 153 void ExtensionDataDeleter::DeleteAppcachesOnIOThread(ResourceContext* context) {
152 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 154 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
153 ResourceContext::GetAppCacheService(context)->DeleteAppCachesForOrigin( 155 ResourceContext::GetAppCacheService(context)->DeleteAppCachesForOrigin(
154 storage_origin_, net::CompletionCallback()); 156 storage_origin_, net::CompletionCallback());
155 } 157 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_data_deleter.h ('k') | content/browser/in_process_webkit/dom_storage_context_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698