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

Unified Diff: chrome/browser/chrome_to_mobile_service.cc

Issue 10914147: Manage ChromeToMobile URLFetcher lifetimes with a ScopedVector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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/chrome_to_mobile_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_to_mobile_service.cc
diff --git a/chrome/browser/chrome_to_mobile_service.cc b/chrome/browser/chrome_to_mobile_service.cc
index 117f9bcd434700beda576a285c18e9fc8f6e7a6c..af269aff422056b37fe6049251555564a3288b78 100644
--- a/chrome/browser/chrome_to_mobile_service.cc
+++ b/chrome/browser/chrome_to_mobile_service.cc
@@ -312,6 +312,15 @@ void ChromeToMobileService::OnURLFetchComplete(const net::URLFetcher* source) {
HandleSearchResponse(source);
else
HandleSubmitResponse(source);
+
+ // Remove the URLFetcher from the ScopedVector; this deletes the URLFetcher.
+ for (ScopedVector<net::URLFetcher>::iterator it = url_fetchers_.begin();
+ it != url_fetchers_.end(); ++it) {
+ if (*it == source) {
+ url_fetchers_.erase(it);
+ break;
+ }
+ }
}
void ChromeToMobileService::Observe(
@@ -422,6 +431,7 @@ net::URLFetcher* ChromeToMobileService::CreateRequest() {
net::URLFetcher* request = net::URLFetcher::Create(
cloud_print::GetUrlForSubmit(cloud_print_url_),
net::URLFetcher::POST, this);
+ url_fetchers_.push_back(request);
InitRequest(request);
return request;
}
@@ -513,6 +523,7 @@ void ChromeToMobileService::RequestDeviceSearch() {
net::URLFetcher* search_request = net::URLFetcher::Create(
GetSearchURL(cloud_print_url_), net::URLFetcher::GET, this);
+ url_fetchers_.push_back(search_request);
InitRequest(search_request);
search_request->Start();
}
« no previous file with comments | « chrome/browser/chrome_to_mobile_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698