OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |