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