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

Unified Diff: chrome/browser/history/web_history_service.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/history/history_service.cc ('k') | chrome/browser/history/web_history_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/web_history_service.h
diff --git a/chrome/browser/history/web_history_service.h b/chrome/browser/history/web_history_service.h
index 94dc680d72dd9b4d3b384f5dad15e794c06e99ca..f339d324151c55a3d588993ab05d5907fe4b657f 100644
--- a/chrome/browser/history/web_history_service.h
+++ b/chrome/browser/history/web_history_service.h
@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_HISTORY_WEB_HISTORY_SERVICE_H_
#define CHROME_BROWSER_HISTORY_WEB_HISTORY_SERVICE_H_
+#include <set>
+
#include "base/memory/weak_ptr.h"
#include "chrome/browser/history/history_types.h"
#include "chrome/browser/profiles/profile.h"
@@ -46,8 +48,7 @@ class WebHistoryService : public BrowserContextKeyedService {
typedef base::Callback<void(Request*, const base::DictionaryValue*)>
QueryWebHistoryCallback;
- typedef base::Callback<void(Request*, bool success)>
- ExpireWebHistoryCallback;
+ typedef base::Callback<void(bool success)> ExpireWebHistoryCallback;
explicit WebHistoryService(Profile* profile);
virtual ~WebHistoryService();
@@ -65,19 +66,15 @@ class WebHistoryService : public BrowserContextKeyedService {
// Removes all visits to specified URLs in specific time ranges.
// This is the of equivalent HistoryService::ExpireHistory().
- // The caller takes ownership of the returned Request. If it is destroyed, the
- // request is cancelled.
- scoped_ptr<Request> ExpireHistory(
- const std::vector<ExpireHistoryArgs>& expire_list,
- const ExpireWebHistoryCallback& callback);
+ void ExpireHistory(const std::vector<ExpireHistoryArgs>& expire_list,
+ const ExpireWebHistoryCallback& callback);
// Removes all visits to specified URLs in the given time range.
// This is the of equivalent HistoryService::ExpireHistoryBetween().
- scoped_ptr<Request> ExpireHistoryBetween(
- const std::set<GURL>& restrict_urls,
- base::Time begin_time,
- base::Time end_time,
- const ExpireWebHistoryCallback& callback);
+ void ExpireHistoryBetween(const std::set<GURL>& restrict_urls,
+ base::Time begin_time,
+ base::Time end_time,
+ const ExpireWebHistoryCallback& callback);
private:
// Called by |request| when a web history query has completed. Unpacks the
@@ -103,6 +100,10 @@ class WebHistoryService : public BrowserContextKeyedService {
// subsequent reads see a version of the data that includes the mutation.
std::string server_version_info_;
+ // Pending expiration requests to be canceled if not complete by profile
+ // shutdown.
+ std::set<Request*> pending_expire_requests_;
+
base::WeakPtrFactory<WebHistoryService> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(WebHistoryService);
« no previous file with comments | « chrome/browser/history/history_service.cc ('k') | chrome/browser/history/web_history_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698