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

Unified Diff: chrome/browser/ui/webui/history_ui.cc

Issue 164703002: Don't leak WebHistoryService::Request on HistoryService shutdown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remnant of previous version. 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/ui/webui/history_ui.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/history_ui.cc
diff --git a/chrome/browser/ui/webui/history_ui.cc b/chrome/browser/ui/webui/history_ui.cc
index 7f9a513c507431e8ad30ad43a66a80efe063d06f..7f1098646052d182a3adb12268b234b5f0f86eb3 100644
--- a/chrome/browser/ui/webui/history_ui.cc
+++ b/chrome/browser/ui/webui/history_ui.cc
@@ -386,7 +386,9 @@ bool BrowsingHistoryHandler::HistoryEntry::SortByTimeDescending(
return entry1.time > entry2.time;
}
-BrowsingHistoryHandler::BrowsingHistoryHandler() {}
+BrowsingHistoryHandler::BrowsingHistoryHandler()
+ : pending_delete_requests_(0), weak_factory_(this) {
sky 2014/02/19 23:20:10 nit: one param per line (when you wrap).
davidben 2014/02/19 23:21:21 Done.
+}
BrowsingHistoryHandler::~BrowsingHistoryHandler() {
history_request_consumer_.CancelAllRequests();
@@ -612,10 +614,11 @@ void BrowsingHistoryHandler::HandleRemoveVisits(const base::ListValue* args) {
&delete_task_tracker_);
if (web_history) {
- web_history_delete_request_ = web_history->ExpireHistory(
+ pending_delete_requests_++;
+ web_history->ExpireHistory(
expire_list,
base::Bind(&BrowsingHistoryHandler::RemoveWebHistoryComplete,
- base::Unretained(this)));
+ weak_factory_.GetWeakPtr()));
}
#if defined(ENABLE_EXTENSIONS)
@@ -886,14 +889,13 @@ void BrowsingHistoryHandler::RemoveComplete() {
// Notify the page that the deletion request is complete, but only if a web
// history delete request is not still pending.
- if (!(web_history_delete_request_.get() &&
- web_history_delete_request_->is_pending())) {
+ if (pending_delete_requests_ == 0) {
web_ui()->CallJavascriptFunction("deleteComplete");
}
}
-void BrowsingHistoryHandler::RemoveWebHistoryComplete(
- history::WebHistoryService::Request* request, bool success) {
+void BrowsingHistoryHandler::RemoveWebHistoryComplete(bool success) {
+ pending_delete_requests_--;
// TODO(dubroy): Should we handle failure somehow? Delete directives will
// ensure that the visits are eventually deleted, so maybe it's not necessary.
if (!delete_task_tracker_.HasTrackedTasks())
« no previous file with comments | « chrome/browser/ui/webui/history_ui.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698