summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-27 21:27:29 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-27 21:27:29 +0000
commit4d3b05dee1fe0de431cbc45bba0885673162359c (patch)
tree73bc3d3565693bb2eb9012458a0921c25d2d17f0 /webkit
parent031c396f71d36aa193c262be346a0632f93d3f9b (diff)
downloadchromium_src-4d3b05dee1fe0de431cbc45bba0885673162359c.zip
chromium_src-4d3b05dee1fe0de431cbc45bba0885673162359c.tar.gz
chromium_src-4d3b05dee1fe0de431cbc45bba0885673162359c.tar.bz2
Switch on socket late binding - Take 2.
Re-enable socket late binding. The mac valgrind errors happened due to threading bugs in test_shell_tests. The ui thread would TearDown() the test object, which deleted the TestURLRequestContext, which eventually deletes the TCPClientSocketPool, which deletes its ConnectJobs. However, those ConnectJobs might be running simultaneously on the io thread. Therefore, we have a race condition. This change fixes that. Histograms for the 4.0.266.0 dev channel release indicate the following changes for late binding: (a) Net.TCPSocketType shows a decrease (from 41.85% to 39.29%) in used of newly connected sockets. Part of this decrease is due to using previously used sockets more often (increase from 58.15% to 58.53%), but is primarily due to being able to use sockets that were connected, but not immediately handed over to a socket request (increased from 0 [not supported without late binding] to 2.18%). (b) Net.SocketIdleTimeBeforeNextUse_ReusedSocket indicates that reused sockets are getting used more quickly than before, with a decrease of mean idle time from 11.65 seconds to 11.34 seconds. (c) Net.Transaction_Connected_Under_10 indicates shows that the mean for time until the first byte of the transaction response decreased from 1585ms to 1481ms. The code change deletes the old non socket late binding code paths, cleaning up the code significantly. It also deletes duplicated tests in ClientSocketPoolBase which covered both pathways. A TCPClientSocketPool test had to be updated as well. BUG=http://crbug.com/30354. Review URL: http://codereview.chromium.org/549093 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37311 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/appcache/appcache_update_job_unittest.cc26
1 files changed, 16 insertions, 10 deletions
diff --git a/webkit/appcache/appcache_update_job_unittest.cc b/webkit/appcache/appcache_update_job_unittest.cc
index 9285689..d07234f 100644
--- a/webkit/appcache/appcache_update_job_unittest.cc
+++ b/webkit/appcache/appcache_update_job_unittest.cc
@@ -289,18 +289,24 @@ class AppCacheUpdateJobTest : public testing::Test,
}
static void SetUpTestCase() {
- io_thread_.reset(new base::Thread("AppCacheUpdateJob IO test thread"));
+ io_thread_ = new base::Thread("AppCacheUpdateJob IO test thread");
base::Thread::Options options(MessageLoop::TYPE_IO, 0);
io_thread_->StartWithOptions(options);
- http_server_ =
- HTTPTestServer::CreateServer(kDocRoot, io_thread_->message_loop());
+ http_server_ = HTTPTestServer::CreateServer(
+ kDocRoot, io_thread_->message_loop()).release();
ASSERT_TRUE(http_server_);
+ request_context_ = new TestURLRequestContext();
+ request_context_->AddRef();
}
static void TearDownTestCase() {
+ http_server_->Release();
http_server_ = NULL;
- io_thread_.reset(NULL);
+ delete io_thread_;
+ io_thread_ = NULL;
+ request_context_->Release();
+ request_context_ = NULL;
}
// Use a separate IO thread to run a test. Thread will be destroyed
@@ -2477,7 +2483,6 @@ class AppCacheUpdateJobTest : public testing::Test,
void MakeService() {
service_.reset(new MockAppCacheService());
- request_context_ = new TestURLRequestContext();
service_->set_request_context(request_context_);
}
@@ -2762,12 +2767,12 @@ class AppCacheUpdateJobTest : public testing::Test,
PENDING_MASTER_NO_UPDATE,
};
- static scoped_ptr<base::Thread> io_thread_;
- static scoped_refptr<HTTPTestServer> http_server_;
+ static base::Thread* io_thread_;
+ static HTTPTestServer* http_server_;
+ static TestURLRequestContext* request_context_;
ScopedRunnableMethodFactory<AppCacheUpdateJobTest> method_factory_;
scoped_ptr<MockAppCacheService> service_;
- scoped_refptr<TestURLRequestContext> request_context_;
scoped_refptr<AppCacheGroup> group_;
scoped_refptr<AppCache> protect_newest_cache_;
scoped_ptr<base::WaitableEvent> event_;
@@ -2797,8 +2802,9 @@ class AppCacheUpdateJobTest : public testing::Test,
};
// static
-scoped_ptr<base::Thread> AppCacheUpdateJobTest::io_thread_;
-scoped_refptr<HTTPTestServer> AppCacheUpdateJobTest::http_server_;
+base::Thread* AppCacheUpdateJobTest::io_thread_ = NULL;
+HTTPTestServer* AppCacheUpdateJobTest::http_server_ = NULL;
+TestURLRequestContext* AppCacheUpdateJobTest::request_context_ = NULL;
TEST_F(AppCacheUpdateJobTest, AlreadyChecking) {
MockAppCacheService service;