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

Side by Side Diff: chrome/browser/history/history_service.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
« no previous file with comments | « chrome/browser/history/history_service.h ('k') | chrome/browser/history/history_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // The history system runs on a background thread so that potentially slow 5 // The history system runs on a background thread so that potentially slow
6 // database operations don't delay the browser. This backend processing is 6 // database operations don't delay the browser. This backend processing is
7 // represented by HistoryBackend. The HistoryService's job is to dispatch to 7 // represented by HistoryBackend. The HistoryService's job is to dispatch to
8 // that thread. 8 // that thread.
9 // 9 //
10 // Main thread History thread 10 // Main thread History thread
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 ScheduleAndForget(PRIORITY_UI, &HistoryBackend::DeleteMatchingURLsForKeyword, 371 ScheduleAndForget(PRIORITY_UI, &HistoryBackend::DeleteMatchingURLsForKeyword,
372 keyword_id, term); 372 keyword_id, term);
373 } 373 }
374 374
375 void HistoryService::URLsNoLongerBookmarked(const std::set<GURL>& urls) { 375 void HistoryService::URLsNoLongerBookmarked(const std::set<GURL>& urls) {
376 DCHECK(thread_checker_.CalledOnValidThread()); 376 DCHECK(thread_checker_.CalledOnValidThread());
377 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::URLsNoLongerBookmarked, 377 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::URLsNoLongerBookmarked,
378 urls); 378 urls);
379 } 379 }
380 380
381 void HistoryService::ScheduleDBTask(scoped_refptr<history::HistoryDBTask> task, 381 void HistoryService::ScheduleDBTask(scoped_ptr<history::HistoryDBTask> task,
382 base::CancelableTaskTracker* tracker) { 382 base::CancelableTaskTracker* tracker) {
383 DCHECK(thread_checker_.CalledOnValidThread()); 383 DCHECK(thread_checker_.CalledOnValidThread());
384 base::CancelableTaskTracker::IsCanceledCallback is_canceled; 384 base::CancelableTaskTracker::IsCanceledCallback is_canceled;
385 tracker->NewTrackedTaskId(&is_canceled); 385 tracker->NewTrackedTaskId(&is_canceled);
386 // Use base::ThreadTaskRunnerHandler::Get() to get a message loop proxy to 386 // Use base::ThreadTaskRunnerHandler::Get() to get a message loop proxy to
387 // the current message loop so that we can forward the call to the method 387 // the current message loop so that we can forward the call to the method
388 // HistoryDBTask::DoneRunOnMainThread in the correct thread. 388 // HistoryDBTask::DoneRunOnMainThread in the correct thread.
389 thread_->message_loop_proxy()->PostTask( 389 thread_->message_loop_proxy()->PostTask(
390 FROM_HERE, 390 FROM_HERE,
391 base::Bind(&HistoryBackend::ProcessDBTask, 391 base::Bind(&HistoryBackend::ProcessDBTask,
392 history_backend_.get(), 392 history_backend_.get(),
393 task, 393 base::Passed(&task),
394 base::ThreadTaskRunnerHandle::Get(), 394 base::ThreadTaskRunnerHandle::Get(),
395 is_canceled)); 395 is_canceled));
396 } 396 }
397 397
398 void HistoryService::FlushForTest(const base::Closure& flushed) { 398 void HistoryService::FlushForTest(const base::Closure& flushed) {
399 thread_->message_loop_proxy()->PostTaskAndReply( 399 thread_->message_loop_proxy()->PostTaskAndReply(
400 FROM_HERE, base::Bind(&base::DoNothing), flushed); 400 FROM_HERE, base::Bind(&base::DoNothing), flushed);
401 } 401 }
402 402
403 void HistoryService::SetOnBackendDestroyTask(const base::Closure& task) { 403 void HistoryService::SetOnBackendDestroyTask(const base::Closure& task) {
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 DCHECK(thread_checker_.CalledOnValidThread()); 1194 DCHECK(thread_checker_.CalledOnValidThread());
1195 visit_database_observers_.RemoveObserver(observer); 1195 visit_database_observers_.RemoveObserver(observer);
1196 } 1196 }
1197 1197
1198 void HistoryService::NotifyVisitDBObserversOnAddVisit( 1198 void HistoryService::NotifyVisitDBObserversOnAddVisit(
1199 const history::BriefVisitInfo& info) { 1199 const history::BriefVisitInfo& info) {
1200 DCHECK(thread_checker_.CalledOnValidThread()); 1200 DCHECK(thread_checker_.CalledOnValidThread());
1201 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, 1201 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_,
1202 OnAddVisit(info)); 1202 OnAddVisit(info));
1203 } 1203 }
OLDNEW
« no previous file with comments | « chrome/browser/history/history_service.h ('k') | chrome/browser/history/history_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698