| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 const GURL& page_url, | 444 const GURL& page_url, |
| 445 CancelableRequestConsumerBase* consumer, | 445 CancelableRequestConsumerBase* consumer, |
| 446 ThumbnailDataCallback* callback) { | 446 ThumbnailDataCallback* callback) { |
| 447 return Schedule(PRIORITY_NORMAL, &HistoryBackend::GetPageThumbnail, consumer, | 447 return Schedule(PRIORITY_NORMAL, &HistoryBackend::GetPageThumbnail, consumer, |
| 448 new history::GetPageThumbnailRequest(callback), page_url); | 448 new history::GetPageThumbnailRequest(callback), page_url); |
| 449 } | 449 } |
| 450 | 450 |
| 451 void HistoryService::GetFavicon(FaviconService::GetFaviconRequest* request, | 451 void HistoryService::GetFavicon(FaviconService::GetFaviconRequest* request, |
| 452 const GURL& icon_url) { | 452 const GURL& icon_url) { |
| 453 Schedule(PRIORITY_NORMAL, &HistoryBackend::GetFavicon, NULL, request, | 453 Schedule(PRIORITY_NORMAL, &HistoryBackend::GetFavicon, NULL, request, |
| 454 icon_url, history::FAV_ICON); | 454 icon_url, history::FAVICON); |
| 455 } | 455 } |
| 456 | 456 |
| 457 void HistoryService::UpdateFaviconMappingAndFetch( | 457 void HistoryService::UpdateFaviconMappingAndFetch( |
| 458 FaviconService::GetFaviconRequest* request, | 458 FaviconService::GetFaviconRequest* request, |
| 459 const GURL& page_url, | 459 const GURL& page_url, |
| 460 const GURL& icon_url) { | 460 const GURL& icon_url) { |
| 461 Schedule(PRIORITY_NORMAL, &HistoryBackend::UpdateFavIconMappingAndFetch, NULL, | 461 Schedule(PRIORITY_NORMAL, &HistoryBackend::UpdateFavIconMappingAndFetch, NULL, |
| 462 request, page_url, icon_url, history::FAV_ICON); | 462 request, page_url, icon_url, history::FAVICON); |
| 463 } | 463 } |
| 464 | 464 |
| 465 void HistoryService::GetFaviconForURL( | 465 void HistoryService::GetFaviconForURL( |
| 466 FaviconService::GetFaviconRequest* request, | 466 FaviconService::GetFaviconRequest* request, |
| 467 const GURL& page_url) { | 467 const GURL& page_url) { |
| 468 Schedule(PRIORITY_NORMAL, &HistoryBackend::GetFavIconForURL, NULL, request, | 468 Schedule(PRIORITY_NORMAL, &HistoryBackend::GetFavIconForURL, NULL, request, |
| 469 page_url, history::FAV_ICON); | 469 page_url, history::FAVICON); |
| 470 } | 470 } |
| 471 | 471 |
| 472 void HistoryService::SetFavicon(const GURL& page_url, | 472 void HistoryService::SetFavicon(const GURL& page_url, |
| 473 const GURL& icon_url, | 473 const GURL& icon_url, |
| 474 const std::vector<unsigned char>& image_data) { | 474 const std::vector<unsigned char>& image_data) { |
| 475 if (!CanAddURL(page_url)) | 475 if (!CanAddURL(page_url)) |
| 476 return; | 476 return; |
| 477 | 477 |
| 478 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::SetFavicon, | 478 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::SetFavicon, |
| 479 page_url, icon_url, | 479 page_url, icon_url, |
| 480 scoped_refptr<RefCountedMemory>(new RefCountedBytes(image_data)), | 480 scoped_refptr<RefCountedMemory>(new RefCountedBytes(image_data)), |
| 481 history::FAV_ICON); | 481 history::FAVICON); |
| 482 } | 482 } |
| 483 | 483 |
| 484 void HistoryService::SetFaviconOutOfDateForPage(const GURL& page_url) { | 484 void HistoryService::SetFaviconOutOfDateForPage(const GURL& page_url) { |
| 485 ScheduleAndForget(PRIORITY_NORMAL, | 485 ScheduleAndForget(PRIORITY_NORMAL, |
| 486 &HistoryBackend::SetFaviconOutOfDateForPage, page_url); | 486 &HistoryBackend::SetFaviconOutOfDateForPage, page_url); |
| 487 } | 487 } |
| 488 | 488 |
| 489 void HistoryService::SetImportedFavicons( | 489 void HistoryService::SetImportedFavicons( |
| 490 const std::vector<history::ImportedFavIconUsage>& favicon_usage) { | 490 const std::vector<history::ImportedFavIconUsage>& favicon_usage) { |
| 491 ScheduleAndForget(PRIORITY_NORMAL, | 491 ScheduleAndForget(PRIORITY_NORMAL, |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 history::TopSites* ts = profile_->GetTopSitesWithoutCreating(); | 807 history::TopSites* ts = profile_->GetTopSitesWithoutCreating(); |
| 808 if (ts) | 808 if (ts) |
| 809 ts->MigrateFromHistory(); | 809 ts->MigrateFromHistory(); |
| 810 } | 810 } |
| 811 } | 811 } |
| 812 | 812 |
| 813 void HistoryService::OnTopSitesReady() { | 813 void HistoryService::OnTopSitesReady() { |
| 814 ScheduleAndForget(PRIORITY_NORMAL, | 814 ScheduleAndForget(PRIORITY_NORMAL, |
| 815 &HistoryBackend::MigrateThumbnailsDatabase); | 815 &HistoryBackend::MigrateThumbnailsDatabase); |
| 816 } | 816 } |
| OLD | NEW |