Commit 844d50d7 authored by pkasting@chromium.org's avatar pkasting@chromium.org

Fix leak of callback object in r86518.

BUG=81741,83836
TEST=Memory bots go green
Review URL: http://codereview.chromium.org/7053004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86690 0039d316-1c4b-4281-b951-d872f2087c98
parent 1414e78b
......@@ -24,6 +24,13 @@ DownloadHistory::DownloadHistory(Profile* profile)
}
DownloadHistory::~DownloadHistory() {
// For any outstanding requests to HistoryService::GetVisitCountToHost(),
// since they'll be cancelled and thus not call back to
// OnGotVisitCountToHost(), we need to delete the associated
// VisitedBeforeDoneCallbacks.
for (VisitedBeforeRequestsMap::iterator i(visited_before_requests_.begin());
i != visited_before_requests_.end(); ++i)
delete i->second.second;
}
void DownloadHistory::Load(HistoryService::DownloadQueryCallback* callback) {
......@@ -56,6 +63,7 @@ void DownloadHistory::CheckVisitedReferrerBefore(
}
}
callback->Run(download_id, false);
delete callback;
}
void DownloadHistory::AddEntry(
......@@ -145,4 +153,5 @@ void DownloadHistory::OnGotVisitCountToHost(HistoryService::Handle handle,
visited_before_requests_.erase(request);
callback->Run(download_id, found_visits && count &&
(first_visit.LocalMidnight() < base::Time::Now().LocalMidnight()));
delete callback;
}
......@@ -34,7 +34,8 @@ class DownloadHistory {
// Retrieves DownloadCreateInfos saved in the history.
void Load(HistoryService::DownloadQueryCallback* callback);
// Checks whether |referrer_url| has been visited before today.
// Checks whether |referrer_url| has been visited before today. This takes
// ownership of |callback|.
void CheckVisitedReferrerBefore(int32 download_id,
const GURL& referrer_url,
VisitedBeforeDoneCallback* callback);
......
......@@ -1610,16 +1610,3 @@
fun:net::ClientSocketPoolManager::InitSocketHandleForRawConnect
fun:notifier::ProxyResolvingClientSocket::ProcessProxyResolveDone
}
{
bug_83836
Heapcheck:Leak
fun:Callback2::Type* NewCallback
fun:DownloadManager::CheckDownloadUrlDone
fun:void DispatchToMethod
fun:CallbackImpl::RunWithParams
fun:CallbackRunner::Run
fun:DownloadSBClient::SafeBrowsingCheckUrlDone
fun:void DispatchToMethod
fun:RunnableMethod::Run
fun:::TaskClosureAdapter::Run
}
......@@ -4615,20 +4615,6 @@
fun:_ZN14RunnableMethodIN3net16HostResolverImpl3JobEMS2_FvRKN4base9TimeTicksEjE6Tuple2IS4_jEED0Ev
fun:_ZN4base12_GLOBAL__N_112WorkerThread10ThreadMainEv
}
{
bug_83836
Memcheck:Leak
fun:_Znw*
fun:_Z11NewCallbackI15DownloadManageribEPN9Callback2IT0_T1_E4TypeEPT_MS7_FvS2_S3_E
fun:_ZN15DownloadManager20CheckDownloadUrlDoneEib
fun:_Z16DispatchToMethodI15DownloadManagerMS0_FvibEibEvPT_T0_RK6Tuple2IT1_T2_E
fun:_ZN12CallbackImplI15DownloadManagerMS0_FvibE6Tuple2IibEE13RunWithParamsERKS4_
fun:_ZN14CallbackRunnerI6Tuple2IibEE3RunIibEEvRKT_RKT0_
fun:_ZN16DownloadSBClient24SafeBrowsingCheckUrlDoneEN19SafeBrowsingService14UrlCheckResultE
fun:_Z16DispatchToMethodI16DownloadSBClientMS0_FvN19SafeBrowsingService14UrlCheckResultEES2_EvPT_T0_RK6Tuple1IT1_E
fun:_ZN14RunnableMethodI16DownloadSBClientMS0_FvN19SafeBrowsingService14UrlCheckResultEE6Tuple1IS2_EE3RunEv
fun:_ZN12_GLOBAL__N_118TaskClosureAdapter3RunEv
}
#-----------------------------------------------------------------------
# These only occur on our Google workstations
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment