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

Side by Side Diff: chrome/browser/history/in_memory_url_index.cc

Issue 387923002: Make HistoryDBTask not refcounted, and ensure it's destroyed on its origin thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert unnecessary changes Created 6 years, 5 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/history/in_memory_url_index.h" 5 #include "chrome/browser/history/in_memory_url_index.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 } 289 }
290 } 290 }
291 291
292 // Restoring from the History DB ----------------------------------------------- 292 // Restoring from the History DB -----------------------------------------------
293 293
294 void InMemoryURLIndex::ScheduleRebuildFromHistory() { 294 void InMemoryURLIndex::ScheduleRebuildFromHistory() {
295 HistoryService* service = 295 HistoryService* service =
296 HistoryServiceFactory::GetForProfile(profile_, 296 HistoryServiceFactory::GetForProfile(profile_,
297 Profile::EXPLICIT_ACCESS); 297 Profile::EXPLICIT_ACCESS);
298 service->ScheduleDBTask( 298 service->ScheduleDBTask(
299 new InMemoryURLIndex::RebuildPrivateDataFromHistoryDBTask( 299 scoped_ptr<history::HistoryDBTask>(
300 this, languages_, scheme_whitelist_), 300 new InMemoryURLIndex::RebuildPrivateDataFromHistoryDBTask(
301 this, languages_, scheme_whitelist_)),
301 &cache_reader_tracker_); 302 &cache_reader_tracker_);
302 } 303 }
303 304
304 void InMemoryURLIndex::DoneRebuidingPrivateDataFromHistoryDB( 305 void InMemoryURLIndex::DoneRebuidingPrivateDataFromHistoryDB(
305 bool succeeded, 306 bool succeeded,
306 scoped_refptr<URLIndexPrivateData> private_data) { 307 scoped_refptr<URLIndexPrivateData> private_data) {
307 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 308 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
308 if (succeeded) { 309 if (succeeded) {
309 private_data_tracker_.TryCancelAll(); 310 private_data_tracker_.TryCancelAll();
310 private_data_ = private_data; 311 private_data_ = private_data;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 base::Bind(DeleteCacheFile, path)); 352 base::Bind(DeleteCacheFile, path));
352 } 353 }
353 } 354 }
354 355
355 void InMemoryURLIndex::OnCacheSaveDone(bool succeeded) { 356 void InMemoryURLIndex::OnCacheSaveDone(bool succeeded) {
356 if (save_cache_observer_) 357 if (save_cache_observer_)
357 save_cache_observer_->OnCacheSaveFinished(succeeded); 358 save_cache_observer_->OnCacheSaveFinished(succeeded);
358 } 359 }
359 360
360 } // namespace history 361 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/history_unittest.cc ('k') | chrome/browser/history/top_sites_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698