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

Side by Side Diff: components/history/core/browser/history_service.cc

Issue 2828173002: [Refactor] Simplify HistoryBackend::UpdateFaviconMappingsAndFetchImpl() signature (Closed)
Patch Set: Merge branch 'master' into icon_type0 Created 3 years, 7 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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 for (const auto& row : info) 495 for (const auto& row : info)
496 urls.push_back(row.url()); 496 urls.push_back(row.url());
497 visit_delegate_->AddURLs(urls); 497 visit_delegate_->AddURLs(urls);
498 } 498 }
499 499
500 ScheduleTask(PRIORITY_NORMAL, 500 ScheduleTask(PRIORITY_NORMAL,
501 base::Bind(&HistoryBackend::AddPagesWithDetails, 501 base::Bind(&HistoryBackend::AddPagesWithDetails,
502 history_backend_, info, visit_source)); 502 history_backend_, info, visit_source));
503 } 503 }
504 504
505 base::CancelableTaskTracker::TaskId HistoryService::GetFavicons( 505 base::CancelableTaskTracker::TaskId HistoryService::GetFavicon(
506 const std::vector<GURL>& icon_urls, 506 const GURL& icon_url,
507 int icon_types, 507 favicon_base::IconType icon_type,
508 const std::vector<int>& desired_sizes, 508 const std::vector<int>& desired_sizes,
509 const favicon_base::FaviconResultsCallback& callback, 509 const favicon_base::FaviconResultsCallback& callback,
510 base::CancelableTaskTracker* tracker) { 510 base::CancelableTaskTracker* tracker) {
511 TRACE_EVENT0("browser", "HistoryService::GetFavicons"); 511 TRACE_EVENT0("browser", "HistoryService::GetFavicons");
512 DCHECK(backend_task_runner_) << "History service being called after cleanup"; 512 DCHECK(backend_task_runner_) << "History service being called after cleanup";
513 DCHECK(thread_checker_.CalledOnValidThread()); 513 DCHECK(thread_checker_.CalledOnValidThread());
514 std::vector<favicon_base::FaviconRawBitmapResult>* results = 514 std::vector<favicon_base::FaviconRawBitmapResult>* results =
515 new std::vector<favicon_base::FaviconRawBitmapResult>(); 515 new std::vector<favicon_base::FaviconRawBitmapResult>();
516 return tracker->PostTaskAndReply( 516 return tracker->PostTaskAndReply(
517 backend_task_runner_.get(), FROM_HERE, 517 backend_task_runner_.get(), FROM_HERE,
518 base::Bind(&HistoryBackend::GetFavicons, history_backend_, icon_urls, 518 base::Bind(&HistoryBackend::GetFavicon, history_backend_, icon_url,
519 icon_types, desired_sizes, results), 519 icon_type, desired_sizes, results),
520 base::Bind(&RunWithFaviconResults, callback, base::Owned(results))); 520 base::Bind(&RunWithFaviconResults, callback, base::Owned(results)));
521 } 521 }
522 522
523 base::CancelableTaskTracker::TaskId HistoryService::GetFaviconsForURL( 523 base::CancelableTaskTracker::TaskId HistoryService::GetFaviconsForURL(
524 const GURL& page_url, 524 const GURL& page_url,
525 int icon_types, 525 int icon_types,
526 const std::vector<int>& desired_sizes, 526 const std::vector<int>& desired_sizes,
527 const favicon_base::FaviconResultsCallback& callback, 527 const favicon_base::FaviconResultsCallback& callback,
528 base::CancelableTaskTracker* tracker) { 528 base::CancelableTaskTracker* tracker) {
529 TRACE_EVENT0("browser", "HistoryService::GetFaviconsForURL"); 529 TRACE_EVENT0("browser", "HistoryService::GetFaviconsForURL");
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 return tracker->PostTaskAndReply( 568 return tracker->PostTaskAndReply(
569 backend_task_runner_.get(), FROM_HERE, 569 backend_task_runner_.get(), FROM_HERE,
570 base::Bind(&HistoryBackend::GetFaviconForID, history_backend_, favicon_id, 570 base::Bind(&HistoryBackend::GetFaviconForID, history_backend_, favicon_id,
571 desired_size, results), 571 desired_size, results),
572 base::Bind(&RunWithFaviconResults, callback, base::Owned(results))); 572 base::Bind(&RunWithFaviconResults, callback, base::Owned(results)));
573 } 573 }
574 574
575 base::CancelableTaskTracker::TaskId 575 base::CancelableTaskTracker::TaskId
576 HistoryService::UpdateFaviconMappingsAndFetch( 576 HistoryService::UpdateFaviconMappingsAndFetch(
577 const GURL& page_url, 577 const GURL& page_url,
578 const std::vector<GURL>& icon_urls, 578 const GURL& icon_url,
579 int icon_types, 579 favicon_base::IconType icon_type,
580 const std::vector<int>& desired_sizes, 580 const std::vector<int>& desired_sizes,
581 const favicon_base::FaviconResultsCallback& callback, 581 const favicon_base::FaviconResultsCallback& callback,
582 base::CancelableTaskTracker* tracker) { 582 base::CancelableTaskTracker* tracker) {
583 TRACE_EVENT0("browser", "HistoryService::UpdateFaviconMappingsAndFetch"); 583 TRACE_EVENT0("browser", "HistoryService::UpdateFaviconMappingsAndFetch");
584 DCHECK(backend_task_runner_) << "History service being called after cleanup"; 584 DCHECK(backend_task_runner_) << "History service being called after cleanup";
585 DCHECK(thread_checker_.CalledOnValidThread()); 585 DCHECK(thread_checker_.CalledOnValidThread());
586 std::vector<favicon_base::FaviconRawBitmapResult>* results = 586 std::vector<favicon_base::FaviconRawBitmapResult>* results =
587 new std::vector<favicon_base::FaviconRawBitmapResult>(); 587 new std::vector<favicon_base::FaviconRawBitmapResult>();
588 return tracker->PostTaskAndReply( 588 return tracker->PostTaskAndReply(
589 backend_task_runner_.get(), FROM_HERE, 589 backend_task_runner_.get(), FROM_HERE,
590 base::Bind(&HistoryBackend::UpdateFaviconMappingsAndFetch, 590 base::Bind(&HistoryBackend::UpdateFaviconMappingsAndFetch,
591 history_backend_, page_url, icon_urls, icon_types, 591 history_backend_, page_url, icon_url, icon_type, desired_sizes,
592 desired_sizes, results), 592 results),
593 base::Bind(&RunWithFaviconResults, callback, base::Owned(results))); 593 base::Bind(&RunWithFaviconResults, callback, base::Owned(results)));
594 } 594 }
595 595
596 void HistoryService::MergeFavicon( 596 void HistoryService::MergeFavicon(
597 const GURL& page_url, 597 const GURL& page_url,
598 const GURL& icon_url, 598 const GURL& icon_url,
599 favicon_base::IconType icon_type, 599 favicon_base::IconType icon_type,
600 scoped_refptr<base::RefCountedMemory> bitmap_data, 600 scoped_refptr<base::RefCountedMemory> bitmap_data,
601 const gfx::Size& pixel_size) { 601 const gfx::Size& pixel_size) {
602 TRACE_EVENT0("browser", "HistoryService::MergeFavicon"); 602 TRACE_EVENT0("browser", "HistoryService::MergeFavicon");
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 return favicon_changed_callback_list_.Add(callback); 1167 return favicon_changed_callback_list_.Add(callback);
1168 } 1168 }
1169 1169
1170 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, 1170 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls,
1171 const GURL& icon_url) { 1171 const GURL& icon_url) {
1172 DCHECK(thread_checker_.CalledOnValidThread()); 1172 DCHECK(thread_checker_.CalledOnValidThread());
1173 favicon_changed_callback_list_.Notify(page_urls, icon_url); 1173 favicon_changed_callback_list_.Notify(page_urls, icon_url);
1174 } 1174 }
1175 1175
1176 } // namespace history 1176 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698