Commit 25577ef9 authored by jhawkins@chromium.org's avatar jhawkins@chromium.org

Web Intents: Fix a leak.

Delete the query after notifying the consumer. Also clean up a style issue.

BUG=91950
TEST=none

R=groby@chromium.org

Review URL: http://codereview.chromium.org/7541062

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95842 0039d316-1c4b-4281-b951-d872f2087c98
parent 1fd3ddc6
......@@ -24,7 +24,7 @@ WebIntentsRegistry::WebIntentsRegistry() : next_query_id_(0) {}
WebIntentsRegistry::~WebIntentsRegistry() {
// Cancel all pending queries, since we can't handle them any more.
for (QueryMap::iterator it(queries.begin()); it != queries.end(); ++it) {
for (QueryMap::iterator it(queries_.begin()); it != queries_.end(); ++it) {
wds_->CancelRequest(it->first);
delete it->second;
}
......@@ -40,18 +40,19 @@ void WebIntentsRegistry::OnWebDataServiceRequestDone(
DCHECK(result);
DCHECK(result->GetType() == WEB_INTENTS_RESULT);
QueryMap::iterator it = queries.find(h);
DCHECK(it != queries.end());
QueryMap::iterator it = queries_.find(h);
DCHECK(it != queries_.end());
IntentsQuery* query(it->second);
DCHECK(query);
queries.erase(it);
queries_.erase(it);
// TODO(groby): Filtering goes here.
std::vector<WebIntentData> intents = static_cast<
const WDResult<std::vector<WebIntentData> >*>(result)->GetValue();
query->consumer_->OnIntentsQueryDone(query->query_id_, intents);
delete query;
}
WebIntentsRegistry::QueryID WebIntentsRegistry::GetIntentProviders(
......@@ -64,7 +65,7 @@ WebIntentsRegistry::QueryID WebIntentsRegistry::GetIntentProviders(
query->query_id_ = next_query_id_++;
query->consumer_ = consumer;
query->pending_query_ = wds_->GetWebIntents(action, this);
queries[query->pending_query_] = query;
queries_[query->pending_query_] = query;
return query->query_id_;
}
......
......@@ -59,7 +59,7 @@ class WebIntentsRegistry : public WebDataServiceConsumer {
const WDTypedResult* result);
// Map for all in-flight web data requests/intent queries.
QueryMap queries;
QueryMap queries_;
// Unique identifier for next intent query.
QueryID next_query_id_;
......
......@@ -1999,9 +1999,3 @@
...
fun:MediaLeakTest_VideoBear_Test::TestBody
}
{
bug_91950
Heapcheck:Leak
fun:WebIntentsRegistry::GetIntentProviders
fun:WebIntentsRegistryTest_BasicTests_Test::TestBody
}
......@@ -5430,13 +5430,6 @@
fun:_ZN27BrowserAccessibilityManager19CreateEmptyDocumentEP6NSViewN11webkit_glue16WebAccessibility5StateEP28BrowserAccessibilityDelegateP27BrowserAccessibilityFactory
fun:_ZN60BrowserAccessibilityManagerTest_TestCreateEmptyDocument_Test8TestBodyEv
}
{
bug_91950
Memcheck:Leak
fun:_Znw*
fun:_ZN18WebIntentsRegistry18GetIntentProvidersERKSbItN4base20string16_char_traitsESaItEEPNS_8ConsumerE
fun:_ZN38WebIntentsRegistryTest_BasicTests_Test8TestBodyEv
}
#-----------------------------------------------------------------------
# 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