summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-09 19:06:33 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-09 19:06:33 +0000
commit636b47441b3d992678b53a5a8f4fd8ea1c79a6ca (patch)
tree5bc229e7181338ae98ff6c285d311262dfd9f5d4
parent610db02a9a0a4f4bec8c9a4f4eb77b5d76be8fa0 (diff)
downloadchromium_src-636b47441b3d992678b53a5a8f4fd8ea1c79a6ca.zip
chromium_src-636b47441b3d992678b53a5a8f4fd8ea1c79a6ca.tar.gz
chromium_src-636b47441b3d992678b53a5a8f4fd8ea1c79a6ca.tar.bz2
(repair leak) Protect instance after commiting to use network
The code was incorrectly protecting an instance of Preconnect before deciding it would actually perform the async network calls, and need the instance to stay alive for a callback. The leak was caused when we exited the function, did not make the asnyc call, but still incref'ed the instance expecting a callback to come and decref it. BUG=51133 r=wtc Review URL: http://codereview.chromium.org/3086023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55435 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/net/preconnect.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/chrome/browser/net/preconnect.cc b/chrome/browser/net/preconnect.cc
index 3872d2a..a20f3c3 100644
--- a/chrome/browser/net/preconnect.cc
+++ b/chrome/browser/net/preconnect.cc
@@ -76,8 +76,6 @@ void Preconnect::Connect(const GURL& url) {
return;
}
- AddRef(); // Stay alive until socket is available.
-
URLRequestContext* context = getter->GetURLRequestContext();
if (preconnect_despite_proxy_) {
@@ -100,8 +98,10 @@ void Preconnect::Connect(const GURL& url) {
}
}
+ // We are now commited to doing the async preconnection call.
UMA_HISTOGRAM_ENUMERATION("Net.PreconnectMotivation", motivation_,
UrlInfo::MAX_MOTIVATED);
+ AddRef(); // Stay alive until socket is available.
net::HttpTransactionFactory* factory = context->http_transaction_factory();
net::HttpNetworkSession* session = factory->GetSession();