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 |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "base/command_line.h" | 23 #include "base/command_line.h" |
24 #include "base/compiler_specific.h" | 24 #include "base/compiler_specific.h" |
25 #include "base/location.h" | 25 #include "base/location.h" |
26 #include "base/memory/ref_counted.h" | 26 #include "base/memory/ref_counted.h" |
27 #include "base/metrics/histogram_macros.h" | 27 #include "base/metrics/histogram_macros.h" |
28 #include "base/single_thread_task_runner.h" | 28 #include "base/single_thread_task_runner.h" |
29 #include "base/thread_task_runner_handle.h" | 29 #include "base/thread_task_runner_handle.h" |
30 #include "base/threading/thread.h" | 30 #include "base/threading/thread.h" |
31 #include "base/time/time.h" | 31 #include "base/time/time.h" |
32 #include "base/trace_event/trace_event.h" | 32 #include "base/trace_event/trace_event.h" |
| 33 #include "build/build_config.h" |
33 #include "components/history/core/browser/download_row.h" | 34 #include "components/history/core/browser/download_row.h" |
34 #include "components/history/core/browser/history_backend.h" | 35 #include "components/history/core/browser/history_backend.h" |
35 #include "components/history/core/browser/history_backend_client.h" | 36 #include "components/history/core/browser/history_backend_client.h" |
36 #include "components/history/core/browser/history_client.h" | 37 #include "components/history/core/browser/history_client.h" |
37 #include "components/history/core/browser/history_database_params.h" | 38 #include "components/history/core/browser/history_database_params.h" |
38 #include "components/history/core/browser/history_db_task.h" | 39 #include "components/history/core/browser/history_db_task.h" |
39 #include "components/history/core/browser/history_service_observer.h" | 40 #include "components/history/core/browser/history_service_observer.h" |
40 #include "components/history/core/browser/history_types.h" | 41 #include "components/history/core/browser/history_types.h" |
41 #include "components/history/core/browser/in_memory_database.h" | 42 #include "components/history/core/browser/in_memory_database.h" |
42 #include "components/history/core/browser/in_memory_history_backend.h" | 43 #include "components/history/core/browser/in_memory_history_backend.h" |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 | 740 |
740 // Handle updates for a particular download. This is a 'fire and forget' | 741 // Handle updates for a particular download. This is a 'fire and forget' |
741 // operation, so we don't need to be called back. | 742 // operation, so we don't need to be called back. |
742 void HistoryService::UpdateDownload(const DownloadRow& data) { | 743 void HistoryService::UpdateDownload(const DownloadRow& data) { |
743 DCHECK(thread_) << "History service being called after cleanup"; | 744 DCHECK(thread_) << "History service being called after cleanup"; |
744 DCHECK(thread_checker_.CalledOnValidThread()); | 745 DCHECK(thread_checker_.CalledOnValidThread()); |
745 ScheduleTask(PRIORITY_NORMAL, base::Bind(&HistoryBackend::UpdateDownload, | 746 ScheduleTask(PRIORITY_NORMAL, base::Bind(&HistoryBackend::UpdateDownload, |
746 history_backend_.get(), data)); | 747 history_backend_.get(), data)); |
747 } | 748 } |
748 | 749 |
749 void HistoryService::RemoveDownloads(const std::set<uint32>& ids) { | 750 void HistoryService::RemoveDownloads(const std::set<uint32_t>& ids) { |
750 DCHECK(thread_) << "History service being called after cleanup"; | 751 DCHECK(thread_) << "History service being called after cleanup"; |
751 DCHECK(thread_checker_.CalledOnValidThread()); | 752 DCHECK(thread_checker_.CalledOnValidThread()); |
752 ScheduleTask(PRIORITY_NORMAL, base::Bind(&HistoryBackend::RemoveDownloads, | 753 ScheduleTask(PRIORITY_NORMAL, base::Bind(&HistoryBackend::RemoveDownloads, |
753 history_backend_.get(), ids)); | 754 history_backend_.get(), ids)); |
754 } | 755 } |
755 | 756 |
756 base::CancelableTaskTracker::TaskId HistoryService::QueryHistory( | 757 base::CancelableTaskTracker::TaskId HistoryService::QueryHistory( |
757 const base::string16& text_query, | 758 const base::string16& text_query, |
758 const QueryOptions& options, | 759 const QueryOptions& options, |
759 const QueryHistoryCallback& callback, | 760 const QueryHistoryCallback& callback, |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 Time begin_time, | 1065 Time begin_time, |
1065 Time end_time, | 1066 Time end_time, |
1066 const base::Closure& callback, | 1067 const base::Closure& callback, |
1067 base::CancelableTaskTracker* tracker) { | 1068 base::CancelableTaskTracker* tracker) { |
1068 // TODO(dubroy): This should be factored out into a separate class that | 1069 // TODO(dubroy): This should be factored out into a separate class that |
1069 // dispatches deletions to the proper places. | 1070 // dispatches deletions to the proper places. |
1070 if (web_history) { | 1071 if (web_history) { |
1071 // TODO(dubroy): This API does not yet support deletion of specific URLs. | 1072 // TODO(dubroy): This API does not yet support deletion of specific URLs. |
1072 DCHECK(restrict_urls.empty()); | 1073 DCHECK(restrict_urls.empty()); |
1073 | 1074 |
1074 delete_directive_handler_.CreateDeleteDirectives(std::set<int64>(), | 1075 delete_directive_handler_.CreateDeleteDirectives(std::set<int64_t>(), |
1075 begin_time, end_time); | 1076 begin_time, end_time); |
1076 | 1077 |
1077 // Attempt online deletion from the history server, but ignore the result. | 1078 // Attempt online deletion from the history server, but ignore the result. |
1078 // Deletion directives ensure that the results will eventually be deleted. | 1079 // Deletion directives ensure that the results will eventually be deleted. |
1079 // | 1080 // |
1080 // TODO(davidben): |callback| should not run until this operation completes | 1081 // TODO(davidben): |callback| should not run until this operation completes |
1081 // too. | 1082 // too. |
1082 web_history->ExpireHistoryBetween(restrict_urls, begin_time, end_time, | 1083 web_history->ExpireHistoryBetween(restrict_urls, begin_time, end_time, |
1083 base::Bind(&ExpireWebHistoryComplete)); | 1084 base::Bind(&ExpireWebHistoryComplete)); |
1084 } | 1085 } |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 return favicon_changed_callback_list_.Add(callback); | 1181 return favicon_changed_callback_list_.Add(callback); |
1181 } | 1182 } |
1182 | 1183 |
1183 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, | 1184 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, |
1184 const GURL& icon_url) { | 1185 const GURL& icon_url) { |
1185 DCHECK(thread_checker_.CalledOnValidThread()); | 1186 DCHECK(thread_checker_.CalledOnValidThread()); |
1186 favicon_changed_callback_list_.Notify(page_urls, icon_url); | 1187 favicon_changed_callback_list_.Notify(page_urls, icon_url); |
1187 } | 1188 } |
1188 | 1189 |
1189 } // namespace history | 1190 } // namespace history |
OLD | NEW |