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

Side by Side Diff: chrome/browser/browsing_data_remover.cc

Issue 306032: Simplify threading in browser thread by making only ChromeThread deal with di... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: a few more simplifications Created 11 years, 2 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/browsing_data_remover.h" 5 #include "chrome/browser/browsing_data_remover.h"
6 6
7 #include "chrome/browser/chrome_thread.h" 7 #include "chrome/browser/chrome_thread.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/download/download_manager.h" 9 #include "chrome/browser/download/download_manager.h"
10 #include "chrome/browser/history/history.h" 10 #include "chrome/browser/history/history.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 220
221 NotifyAndDeleteIfDone(); 221 NotifyAndDeleteIfDone();
222 } 222 }
223 223
224 void BrowsingDataRemover::ClearCacheOnIOThread( 224 void BrowsingDataRemover::ClearCacheOnIOThread(
225 URLRequestContextGetter* context_getter, 225 URLRequestContextGetter* context_getter,
226 base::Time delete_begin, 226 base::Time delete_begin,
227 base::Time delete_end, 227 base::Time delete_end,
228 MessageLoop* ui_loop) { 228 MessageLoop* ui_loop) {
229 // This function should be called on the IO thread. 229 // This function should be called on the IO thread.
230 DCHECK(MessageLoop::current() == 230 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
231 ChromeThread::GetMessageLoop(ChromeThread::IO));
232 231
233 // Get a pointer to the cache. 232 // Get a pointer to the cache.
234 net::HttpTransactionFactory* factory = 233 net::HttpTransactionFactory* factory =
235 context_getter->GetURLRequestContext()->http_transaction_factory(); 234 context_getter->GetURLRequestContext()->http_transaction_factory();
236 disk_cache::Backend* cache = factory->GetCache()->disk_cache(); 235 disk_cache::Backend* cache = factory->GetCache()->disk_cache();
237 236
238 // |cache| can be null since it is lazily initialized, in this case we do 237 // |cache| can be null since it is lazily initialized, in this case we do
239 // nothing. 238 // nothing.
240 if (cache) { 239 if (cache) {
241 if (delete_begin.is_null()) 240 if (delete_begin.is_null())
(...skipping 13 matching lines...) Expand all
255 if (delete_begin.is_null()) 254 if (delete_begin.is_null())
256 cache->DoomAllEntries(); 255 cache->DoomAllEntries();
257 else 256 else
258 cache->DoomEntriesBetween(delete_begin, delete_end); 257 cache->DoomEntriesBetween(delete_begin, delete_end);
259 } 258 }
260 259
261 // Notify the UI thread that we are done. 260 // Notify the UI thread that we are done.
262 ui_loop->PostTask(FROM_HERE, NewRunnableMethod( 261 ui_loop->PostTask(FROM_HERE, NewRunnableMethod(
263 this, &BrowsingDataRemover::ClearedCache)); 262 this, &BrowsingDataRemover::ClearedCache));
264 } 263 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698