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

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

Issue 930363002: Remove adapter method on HistoryBackend delegating to AndroidProviderBackend (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 void HistoryService::AddObserver(history::HistoryServiceObserver* observer) { 344 void HistoryService::AddObserver(history::HistoryServiceObserver* observer) {
345 DCHECK(thread_checker_.CalledOnValidThread()); 345 DCHECK(thread_checker_.CalledOnValidThread());
346 observers_.AddObserver(observer); 346 observers_.AddObserver(observer);
347 } 347 }
348 348
349 void HistoryService::RemoveObserver(history::HistoryServiceObserver* observer) { 349 void HistoryService::RemoveObserver(history::HistoryServiceObserver* observer) {
350 DCHECK(thread_checker_.CalledOnValidThread()); 350 DCHECK(thread_checker_.CalledOnValidThread());
351 observers_.RemoveObserver(observer); 351 observers_.RemoveObserver(observer);
352 } 352 }
353 353
354 void HistoryService::ScheduleDBTask(scoped_ptr<history::HistoryDBTask> task, 354 base::CancelableTaskTracker::TaskId HistoryService::ScheduleDBTask(
355 base::CancelableTaskTracker* tracker) { 355 scoped_ptr<history::HistoryDBTask> task,
356 base::CancelableTaskTracker* tracker) {
356 DCHECK(thread_) << "History service being called after cleanup"; 357 DCHECK(thread_) << "History service being called after cleanup";
357 DCHECK(thread_checker_.CalledOnValidThread()); 358 DCHECK(thread_checker_.CalledOnValidThread());
358 base::CancelableTaskTracker::IsCanceledCallback is_canceled; 359 base::CancelableTaskTracker::IsCanceledCallback is_canceled;
359 tracker->NewTrackedTaskId(&is_canceled); 360 base::CancelableTaskTracker::TaskId task_id =
361 tracker->NewTrackedTaskId(&is_canceled);
360 // Use base::ThreadTaskRunnerHandler::Get() to get a message loop proxy to 362 // Use base::ThreadTaskRunnerHandler::Get() to get a message loop proxy to
361 // the current message loop so that we can forward the call to the method 363 // the current message loop so that we can forward the call to the method
362 // HistoryDBTask::DoneRunOnMainThread in the correct thread. 364 // HistoryDBTask::DoneRunOnMainThread() in the correct thread.
363 thread_->message_loop_proxy()->PostTask( 365 thread_->message_loop_proxy()->PostTask(
364 FROM_HERE, 366 FROM_HERE,
365 base::Bind(&HistoryBackend::ProcessDBTask, 367 base::Bind(&HistoryBackend::ProcessDBTask,
366 history_backend_.get(), 368 history_backend_.get(),
367 base::Passed(&task), 369 base::Passed(&task),
368 base::ThreadTaskRunnerHandle::Get(), 370 base::ThreadTaskRunnerHandle::Get(),
369 is_canceled)); 371 is_canceled));
372 return task_id;
370 } 373 }
371 374
372 void HistoryService::FlushForTest(const base::Closure& flushed) { 375 void HistoryService::FlushForTest(const base::Closure& flushed) {
373 thread_->message_loop_proxy()->PostTaskAndReply( 376 thread_->message_loop_proxy()->PostTaskAndReply(
374 FROM_HERE, base::Bind(&base::DoNothing), flushed); 377 FROM_HERE, base::Bind(&base::DoNothing), flushed);
375 } 378 }
376 379
377 void HistoryService::SetOnBackendDestroyTask(const base::Closure& task) { 380 void HistoryService::SetOnBackendDestroyTask(const base::Closure& task) {
378 DCHECK(thread_) << "History service being called after cleanup"; 381 DCHECK(thread_) << "History service being called after cleanup";
379 DCHECK(thread_checker_.CalledOnValidThread()); 382 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 const HistoryService::OnFaviconChangedCallback& callback) { 1278 const HistoryService::OnFaviconChangedCallback& callback) {
1276 DCHECK(thread_checker_.CalledOnValidThread()); 1279 DCHECK(thread_checker_.CalledOnValidThread());
1277 return favicon_changed_callback_list_.Add(callback); 1280 return favicon_changed_callback_list_.Add(callback);
1278 } 1281 }
1279 1282
1280 void HistoryService::NotifyFaviconChanged( 1283 void HistoryService::NotifyFaviconChanged(
1281 const std::set<GURL>& changed_favicons) { 1284 const std::set<GURL>& changed_favicons) {
1282 DCHECK(thread_checker_.CalledOnValidThread()); 1285 DCHECK(thread_checker_.CalledOnValidThread());
1283 favicon_changed_callback_list_.Notify(changed_favicons); 1286 favicon_changed_callback_list_.Notify(changed_favicons);
1284 } 1287 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698