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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
108 } | 108 } |
109 | 109 |
110 private: | 110 private: |
111 history::URLRows::const_iterator itr_; | 111 history::URLRows::const_iterator itr_; |
112 history::URLRows::const_iterator end_; | 112 history::URLRows::const_iterator end_; |
113 | 113 |
114 DISALLOW_COPY_AND_ASSIGN(URLIteratorFromURLRows); | 114 DISALLOW_COPY_AND_ASSIGN(URLIteratorFromURLRows); |
115 }; | 115 }; |
116 | 116 |
117 // Callback from WebHistoryService::ExpireWebHistory(). | 117 // Callback from WebHistoryService::ExpireWebHistory(). |
118 void ExpireWebHistoryComplete( | 118 void ExpireWebHistoryComplete(bool success) { |
119 history::WebHistoryService::Request* request, | 119 // Ignore the result. |
120 bool success) { | 120 // |
121 // Ignore the result and delete the request. | 121 // TODO(davidben): ExpireLocalAndRemoteHistoryBetween callback should not fire |
122 delete request; | 122 // until this completes. |
123 } | 123 } |
124 | 124 |
125 } // namespace | 125 } // namespace |
126 | 126 |
127 // Sends messages from the backend to us on the main thread. This must be a | 127 // Sends messages from the backend to us on the main thread. This must be a |
128 // separate class from the history service so that it can hold a reference to | 128 // separate class from the history service so that it can hold a reference to |
129 // the history service (otherwise we would have to manually AddRef and | 129 // the history service (otherwise we would have to manually AddRef and |
130 // Release when the Backend has a reference to us). | 130 // Release when the Backend has a reference to us). |
131 class HistoryService::BackendDelegate : public HistoryBackend::Delegate { | 131 class HistoryService::BackendDelegate : public HistoryBackend::Delegate { |
132 public: | 132 public: |
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1156 WebHistoryServiceFactory::GetForProfile(profile_); | 1156 WebHistoryServiceFactory::GetForProfile(profile_); |
1157 if (web_history) { | 1157 if (web_history) { |
1158 // TODO(dubroy): This API does not yet support deletion of specific URLs. | 1158 // TODO(dubroy): This API does not yet support deletion of specific URLs. |
1159 DCHECK(restrict_urls.empty()); | 1159 DCHECK(restrict_urls.empty()); |
1160 | 1160 |
1161 delete_directive_handler_.CreateDeleteDirectives( | 1161 delete_directive_handler_.CreateDeleteDirectives( |
1162 std::set<int64>(), begin_time, end_time); | 1162 std::set<int64>(), begin_time, end_time); |
1163 | 1163 |
1164 // Attempt online deletion from the history server, but ignore the result. | 1164 // Attempt online deletion from the history server, but ignore the result. |
1165 // Deletion directives ensure that the results will eventually be deleted. | 1165 // Deletion directives ensure that the results will eventually be deleted. |
1166 // Pass ownership of the request to the callback. | 1166 // |
1167 scoped_ptr<history::WebHistoryService::Request> request = | 1167 // TODO(davidben): |callback| should not run until this operation completes |
1168 web_history->ExpireHistoryBetween( | 1168 // too. |
1169 restrict_urls, begin_time, end_time, | 1169 web_history->ExpireHistoryBetween( |
1170 base::Bind(&ExpireWebHistoryComplete)); | 1170 restrict_urls, begin_time, end_time, |
1171 | 1171 base::Bind(&ExpireWebHistoryComplete)); |
Patrick Dubroy
2014/02/20 12:56:55
I'd just use base::DoNothing() here.
davidben
2014/02/20 18:08:01
Hrm. Does that work? There's an extra argument to
| |
1172 // The request will be freed when the callback is called. | |
1173 CHECK(request.release()); | |
1174 } | 1172 } |
1175 ExpireHistoryBetween(restrict_urls, begin_time, end_time, callback, tracker); | 1173 ExpireHistoryBetween(restrict_urls, begin_time, end_time, callback, tracker); |
1176 } | 1174 } |
1177 | 1175 |
1178 void HistoryService::BroadcastNotificationsHelper( | 1176 void HistoryService::BroadcastNotificationsHelper( |
1179 int type, | 1177 int type, |
1180 history::HistoryDetails* details) { | 1178 history::HistoryDetails* details) { |
1181 DCHECK(thread_checker_.CalledOnValidThread()); | 1179 DCHECK(thread_checker_.CalledOnValidThread()); |
1182 // TODO(evanm): this is currently necessitated by generate_profile, which | 1180 // TODO(evanm): this is currently necessitated by generate_profile, which |
1183 // runs without a browser process. generate_profile should really create | 1181 // runs without a browser process. generate_profile should really create |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1255 DCHECK(thread_checker_.CalledOnValidThread()); | 1253 DCHECK(thread_checker_.CalledOnValidThread()); |
1256 visit_database_observers_.RemoveObserver(observer); | 1254 visit_database_observers_.RemoveObserver(observer); |
1257 } | 1255 } |
1258 | 1256 |
1259 void HistoryService::NotifyVisitDBObserversOnAddVisit( | 1257 void HistoryService::NotifyVisitDBObserversOnAddVisit( |
1260 const history::BriefVisitInfo& info) { | 1258 const history::BriefVisitInfo& info) { |
1261 DCHECK(thread_checker_.CalledOnValidThread()); | 1259 DCHECK(thread_checker_.CalledOnValidThread()); |
1262 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, | 1260 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, |
1263 OnAddVisit(info)); | 1261 OnAddVisit(info)); |
1264 } | 1262 } |
OLD | NEW |