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

Side by Side Diff: chrome/browser/ui/webui/history_ui.h

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 | « chrome/browser/history/web_history_service.cc ('k') | chrome/browser/ui/webui/history_ui.cc » ('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 #ifndef CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_
6 #define CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_ 6 #define CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/weak_ptr.h"
10 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
11 #include "base/task/cancelable_task_tracker.h" 12 #include "base/task/cancelable_task_tracker.h"
12 #include "base/timer/timer.h" 13 #include "base/timer/timer.h"
13 #include "base/values.h" 14 #include "base/values.h"
14 #include "chrome/browser/common/cancelable_request.h" 15 #include "chrome/browser/common/cancelable_request.h"
15 #include "chrome/browser/history/history_service.h" 16 #include "chrome/browser/history/history_service.h"
16 #include "chrome/browser/history/web_history_service.h" 17 #include "chrome/browser/history/web_history_service.h"
17 #include "content/public/browser/notification_registrar.h" 18 #include "content/public/browser/notification_registrar.h"
18 #include "content/public/browser/web_ui_controller.h" 19 #include "content/public/browser/web_ui_controller.h"
19 #include "content/public/browser/web_ui_message_handler.h" 20 #include "content/public/browser/web_ui_message_handler.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 void WebHistoryQueryComplete(const base::string16& search_text, 151 void WebHistoryQueryComplete(const base::string16& search_text,
151 const history::QueryOptions& options, 152 const history::QueryOptions& options,
152 base::TimeTicks start_time, 153 base::TimeTicks start_time,
153 history::WebHistoryService::Request* request, 154 history::WebHistoryService::Request* request,
154 const base::DictionaryValue* results_value); 155 const base::DictionaryValue* results_value);
155 156
156 // Callback from the history system when visits were deleted. 157 // Callback from the history system when visits were deleted.
157 void RemoveComplete(); 158 void RemoveComplete();
158 159
159 // Callback from history server when visits were deleted. 160 // Callback from history server when visits were deleted.
160 void RemoveWebHistoryComplete(history::WebHistoryService::Request* request, 161 void RemoveWebHistoryComplete(bool success);
161 bool success);
162 162
163 bool ExtractIntegerValueAtIndex( 163 bool ExtractIntegerValueAtIndex(
164 const base::ListValue* value, int index, int* out_int); 164 const base::ListValue* value, int index, int* out_int);
165 165
166 // Sets the query options for a week-wide query, |offset| weeks ago. 166 // Sets the query options for a week-wide query, |offset| weeks ago.
167 void SetQueryTimeInWeeks(int offset, history::QueryOptions* options); 167 void SetQueryTimeInWeeks(int offset, history::QueryOptions* options);
168 168
169 // Sets the query options for a monthly query, |offset| months ago. 169 // Sets the query options for a monthly query, |offset| months ago.
170 void SetQueryTimeInMonths(int offset, history::QueryOptions* options); 170 void SetQueryTimeInMonths(int offset, history::QueryOptions* options);
171 171
172 // kAcceptLanguages pref value. 172 // kAcceptLanguages pref value.
173 std::string GetAcceptLanguages() const; 173 std::string GetAcceptLanguages() const;
174 174
175 content::NotificationRegistrar registrar_; 175 content::NotificationRegistrar registrar_;
176 176
177 // Consumer for search requests to the history service. 177 // Consumer for search requests to the history service.
178 CancelableRequestConsumerT<int, 0> history_request_consumer_; 178 CancelableRequestConsumerT<int, 0> history_request_consumer_;
179 179
180 // The currently-executing request for synced history results. 180 // The currently-executing request for synced history results.
181 // Deleting the request will cancel it. 181 // Deleting the request will cancel it.
182 scoped_ptr<history::WebHistoryService::Request> web_history_request_; 182 scoped_ptr<history::WebHistoryService::Request> web_history_request_;
183 183
184 // The currently-executing delete request for synced history. 184 // True if there is a pending delete requests to the history service.
185 // Deleting the request will cancel it. 185 bool has_pending_delete_request_;
186 scoped_ptr<history::WebHistoryService::Request> web_history_delete_request_;
187 186
188 // Tracker for delete requests to the history service. 187 // Tracker for delete requests to the history service.
189 base::CancelableTaskTracker delete_task_tracker_; 188 base::CancelableTaskTracker delete_task_tracker_;
190 189
191 // The list of URLs that are in the process of being deleted. 190 // The list of URLs that are in the process of being deleted.
192 std::set<GURL> urls_to_be_deleted_; 191 std::set<GURL> urls_to_be_deleted_;
193 192
194 // The info value that is returned to the front end with the query results. 193 // The info value that is returned to the front end with the query results.
195 base::DictionaryValue results_info_value_; 194 base::DictionaryValue results_info_value_;
196 195
197 // The list of query results received from the history service. 196 // The list of query results received from the history service.
198 std::vector<HistoryEntry> query_results_; 197 std::vector<HistoryEntry> query_results_;
199 198
200 // The list of query results received from the history server. 199 // The list of query results received from the history server.
201 std::vector<HistoryEntry> web_history_query_results_; 200 std::vector<HistoryEntry> web_history_query_results_;
202 201
203 // Timer used to implement a timeout on a Web History response. 202 // Timer used to implement a timeout on a Web History response.
204 base::OneShotTimer<BrowsingHistoryHandler> web_history_timer_; 203 base::OneShotTimer<BrowsingHistoryHandler> web_history_timer_;
205 204
205 base::WeakPtrFactory<BrowsingHistoryHandler> weak_factory_;
206
206 DISALLOW_COPY_AND_ASSIGN(BrowsingHistoryHandler); 207 DISALLOW_COPY_AND_ASSIGN(BrowsingHistoryHandler);
207 }; 208 };
208 209
209 class HistoryUI : public content::WebUIController { 210 class HistoryUI : public content::WebUIController {
210 public: 211 public:
211 explicit HistoryUI(content::WebUI* web_ui); 212 explicit HistoryUI(content::WebUI* web_ui);
212 213
213 // Return the URL for a given search term. 214 // Return the URL for a given search term.
214 static const GURL GetHistoryURLWithSearchText(const base::string16& text); 215 static const GURL GetHistoryURLWithSearchText(const base::string16& text);
215 216
216 static base::RefCountedMemory* GetFaviconResourceBytes( 217 static base::RefCountedMemory* GetFaviconResourceBytes(
217 ui::ScaleFactor scale_factor); 218 ui::ScaleFactor scale_factor);
218 219
219 private: 220 private:
220 DISALLOW_COPY_AND_ASSIGN(HistoryUI); 221 DISALLOW_COPY_AND_ASSIGN(HistoryUI);
221 }; 222 };
222 223
223 #endif // CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_ 224 #endif // CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_
OLDNEW
« no previous file with comments | « chrome/browser/history/web_history_service.cc ('k') | chrome/browser/ui/webui/history_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698