Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: chrome/browser/history/history_service.cc

Issue 164703002: Don't leak WebHistoryService::Request on HistoryService shutdown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: dubroy comments Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/history/web_history_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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));
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
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 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/history/web_history_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698