summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net/http_pipelining_compatibility_client.cc
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-18 01:01:19 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-18 01:01:19 +0000
commit7613faaea65b29a00c8bba44b440227fe7b0cade (patch)
treed699a5d92652a10f816960e8bde3c7e3ead6d59f /chrome/browser/net/http_pipelining_compatibility_client.cc
parent1bd51ce010efeb0123072ad38a2f27cb8505725d (diff)
downloadchromium_src-7613faaea65b29a00c8bba44b440227fe7b0cade.zip
chromium_src-7613faaea65b29a00c8bba44b440227fe7b0cade.tar.gz
chromium_src-7613faaea65b29a00c8bba44b440227fe7b0cade.tar.bz2
Fix HttpPipeliningCompatibilityClient ownership.
Previously it was unowned. Now IOThread::Globals owns it. Due to this, move the CHECK for no leaking URLRequests to the IOThread::Globals destructor. Also, fix up some lifetime ordering issues with HttpPipeliningCompatibilityClient. This lets us delete the HttpPipeliningCompatibilityClient synchronously from within the finishing callback. BUG=123830 TEST=none Review URL: http://codereview.chromium.org/10041008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132715 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net/http_pipelining_compatibility_client.cc')
-rw-r--r--chrome/browser/net/http_pipelining_compatibility_client.cc24
1 files changed, 9 insertions, 15 deletions
diff --git a/chrome/browser/net/http_pipelining_compatibility_client.cc b/chrome/browser/net/http_pipelining_compatibility_client.cc
index 1fc294f..0708404 100644
--- a/chrome/browser/net/http_pipelining_compatibility_client.cc
+++ b/chrome/browser/net/http_pipelining_compatibility_client.cc
@@ -437,24 +437,18 @@ internal::PipelineTestRequest::Status ProcessStatsResponse(
namespace {
-void DeleteClient(HttpPipeliningCompatibilityClient* client) {
- delete client;
-}
-
-void DelayedDeleteClient(HttpPipeliningCompatibilityClient* client, int rv) {
- content::BrowserThread::PostTask(
- content::BrowserThread::IO,
- FROM_HERE,
- base::Bind(&DeleteClient, client));
+void DeleteClient(IOThread* io_thread, int /* rv */) {
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ io_thread->globals()->http_pipelining_compatibility_client.reset();
}
void CollectPipeliningCapabilityStatsOnIOThread(
const std::string& pipeline_test_server,
- net::URLRequestContextGetter* url_request_context_getter) {
+ IOThread* io_thread) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
net::URLRequestContext* url_request_context =
- url_request_context_getter->GetURLRequestContext();
+ io_thread->globals()->system_request_context.get();
if (!url_request_context->proxy_service()->config().proxy_rules().empty()) {
// Pipelining with explicitly configured proxies is disabled for now.
return;
@@ -516,8 +510,9 @@ void CollectPipeliningCapabilityStatsOnIOThread(
new HttpPipeliningCompatibilityClient(NULL);
client->Start(pipeline_test_server, requests,
HttpPipeliningCompatibilityClient::PIPE_TEST_CANARY_AND_STATS,
- base::Bind(&DelayedDeleteClient, client),
- url_request_context_getter->GetURLRequestContext());
+ base::Bind(&DeleteClient, io_thread),
+ url_request_context);
+ io_thread->globals()->http_pipelining_compatibility_client.reset(client);
}
} // anonymous namespace
@@ -533,8 +528,7 @@ void CollectPipeliningCapabilityStatsOnUIThread(
FROM_HERE,
base::Bind(&CollectPipeliningCapabilityStatsOnIOThread,
pipeline_test_server,
- make_scoped_refptr(
- io_thread->system_url_request_context_getter())));
+ io_thread));
}
} // namespace chrome_browser_net