| OLD | NEW |
| 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 |
| 11 // ----------- -------------- | 11 // ----------- -------------- |
| 12 // HistoryService <----------------> HistoryBackend | 12 // HistoryService <----------------> HistoryBackend |
| 13 // -> HistoryDatabase | 13 // -> HistoryDatabase |
| 14 // -> SQLite connection to History | 14 // -> SQLite connection to History |
| 15 // -> ArchivedDatabase | 15 // -> ArchivedDatabase |
| 16 // -> SQLite connection to Archived History | 16 // -> SQLite connection to Archived History |
| 17 // -> TextDatabaseManager | |
| 18 // -> SQLite connection to one month's data | |
| 19 // -> SQLite connection to one month's data | |
| 20 // ... | |
| 21 // -> ThumbnailDatabase | 17 // -> ThumbnailDatabase |
| 22 // -> SQLite connection to Thumbnails | 18 // -> SQLite connection to Thumbnails |
| 23 // (and favicons) | 19 // (and favicons) |
| 24 | 20 |
| 25 #include "chrome/browser/history/history_service.h" | 21 #include "chrome/browser/history/history_service.h" |
| 26 | 22 |
| 27 #include "base/bind_helpers.h" | 23 #include "base/bind_helpers.h" |
| 28 #include "base/callback.h" | 24 #include "base/callback.h" |
| 29 #include "base/command_line.h" | 25 #include "base/command_line.h" |
| 30 #include "base/compiler_specific.h" | 26 #include "base/compiler_specific.h" |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 ++i) | 586 ++i) |
| 591 urls.push_back(i->url()); | 587 urls.push_back(i->url()); |
| 592 | 588 |
| 593 visitedlink_master_->AddURLs(urls); | 589 visitedlink_master_->AddURLs(urls); |
| 594 } | 590 } |
| 595 | 591 |
| 596 ScheduleAndForget(PRIORITY_NORMAL, | 592 ScheduleAndForget(PRIORITY_NORMAL, |
| 597 &HistoryBackend::AddPagesWithDetails, info, visit_source); | 593 &HistoryBackend::AddPagesWithDetails, info, visit_source); |
| 598 } | 594 } |
| 599 | 595 |
| 600 void HistoryService::SetPageContents(const GURL& url, | |
| 601 const string16& contents) { | |
| 602 DCHECK(thread_checker_.CalledOnValidThread()); | |
| 603 if (!CanAddURL(url)) | |
| 604 return; | |
| 605 | |
| 606 ScheduleAndForget(PRIORITY_LOW, &HistoryBackend::SetPageContents, | |
| 607 url, contents); | |
| 608 } | |
| 609 | |
| 610 HistoryService::Handle HistoryService::GetPageThumbnail( | 596 HistoryService::Handle HistoryService::GetPageThumbnail( |
| 611 const GURL& page_url, | 597 const GURL& page_url, |
| 612 CancelableRequestConsumerBase* consumer, | 598 CancelableRequestConsumerBase* consumer, |
| 613 const ThumbnailDataCallback& callback) { | 599 const ThumbnailDataCallback& callback) { |
| 614 DCHECK(thread_checker_.CalledOnValidThread()); | 600 DCHECK(thread_checker_.CalledOnValidThread()); |
| 615 return Schedule(PRIORITY_NORMAL, &HistoryBackend::GetPageThumbnail, consumer, | 601 return Schedule(PRIORITY_NORMAL, &HistoryBackend::GetPageThumbnail, consumer, |
| 616 new history::GetPageThumbnailRequest(callback), page_url); | 602 new history::GetPageThumbnailRequest(callback), page_url); |
| 617 } | 603 } |
| 618 | 604 |
| 619 CancelableTaskTracker::TaskId HistoryService::GetFavicons( | 605 CancelableTaskTracker::TaskId HistoryService::GetFavicons( |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1288 DCHECK(thread_checker_.CalledOnValidThread()); | 1274 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1289 visit_database_observers_.RemoveObserver(observer); | 1275 visit_database_observers_.RemoveObserver(observer); |
| 1290 } | 1276 } |
| 1291 | 1277 |
| 1292 void HistoryService::NotifyVisitDBObserversOnAddVisit( | 1278 void HistoryService::NotifyVisitDBObserversOnAddVisit( |
| 1293 const history::BriefVisitInfo& info) { | 1279 const history::BriefVisitInfo& info) { |
| 1294 DCHECK(thread_checker_.CalledOnValidThread()); | 1280 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1295 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, | 1281 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, |
| 1296 OnAddVisit(info)); | 1282 OnAddVisit(info)); |
| 1297 } | 1283 } |
| OLD | NEW |