diff options
author | ukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-23 06:40:20 +0000 |
---|---|---|
committer | ukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-23 06:40:20 +0000 |
commit | d11a34ba95bc98cf2c4b6caa2ce6ed469ae229ce (patch) | |
tree | 8fa98acc717a288be407c236b05ec250126483f7 /net/socket_stream | |
parent | b7e7113680de40698775c7d9b9d33bb02065c114 (diff) | |
download | chromium_src-d11a34ba95bc98cf2c4b6caa2ce6ed469ae229ce.zip chromium_src-d11a34ba95bc98cf2c4b6caa2ce6ed469ae229ce.tar.gz chromium_src-d11a34ba95bc98cf2c4b6caa2ce6ed469ae229ce.tar.bz2 |
Try to fix flaky websocket tests again.
Some websoket layout tests became flaky from r41818.
This is because it adds websocket throttling in WebSocketJob.
Make sure Close() will call OnClose() even if it is waiting resolving or waiting
in throttling queue, so that WebSocketJob is removed from throttling queue
and wake up next WebSocketJob.
r42074 was reverted because failure in SocketStreamMetrics::OnClose
on Linux Builder (Views dbg).
Ignore UMA record if the connection has not been established.
TBR=tyoshino
BUG=38397
TEST=layout tests websocket/tests passes
Review URL: http://codereview.chromium.org/1134004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42320 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket_stream')
-rw-r--r-- | net/socket_stream/socket_stream.cc | 5 | ||||
-rw-r--r-- | net/socket_stream/socket_stream_metrics.cc | 22 |
2 files changed, 14 insertions, 13 deletions
diff --git a/net/socket_stream/socket_stream.cc b/net/socket_stream/socket_stream.cc index b6d3a65..1d10ad5 100644 --- a/net/socket_stream/socket_stream.cc +++ b/net/socket_stream/socket_stream.cc @@ -167,9 +167,8 @@ void SocketStream::Close() { "The current MessageLoop must exist"; DCHECK_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()) << "The current MessageLoop must be TYPE_IO"; - if (!socket_.get() || !socket_->IsConnected() || next_state_ == STATE_NONE) - return; - socket_->Disconnect(); + if (socket_.get() && socket_->IsConnected()) + socket_->Disconnect(); next_state_ = STATE_CLOSE; // Close asynchronously, so that delegate won't be called // back before returning Close(). diff --git a/net/socket_stream/socket_stream_metrics.cc b/net/socket_stream/socket_stream_metrics.cc index 625a491..71239af 100644 --- a/net/socket_stream/socket_stream_metrics.cc +++ b/net/socket_stream/socket_stream_metrics.cc @@ -70,16 +70,18 @@ void SocketStreamMetrics::OnWrite(int len) { void SocketStreamMetrics::OnClose() { base::TimeTicks closed_time = base::TimeTicks::Now(); - UMA_HISTOGRAM_LONG_TIMES("Net.SocketStream.Duration", - closed_time - connect_establish_time_); - UMA_HISTOGRAM_COUNTS("Net.SocketStream.ReceivedBytes", - received_bytes_); - UMA_HISTOGRAM_COUNTS("Net.SocketStream.ReceivedCounts", - received_counts_); - UMA_HISTOGRAM_COUNTS("Net.SocketStream.SentBytes", - sent_bytes_); - UMA_HISTOGRAM_COUNTS("Net.SocketStream.SentCounts", - sent_counts_); + if (!connect_establish_time_.is_null()) { + UMA_HISTOGRAM_LONG_TIMES("Net.SocketStream.Duration", + closed_time - connect_establish_time_); + UMA_HISTOGRAM_COUNTS("Net.SocketStream.ReceivedBytes", + received_bytes_); + UMA_HISTOGRAM_COUNTS("Net.SocketStream.ReceivedCounts", + received_counts_); + UMA_HISTOGRAM_COUNTS("Net.SocketStream.SentBytes", + sent_bytes_); + UMA_HISTOGRAM_COUNTS("Net.SocketStream.SentCounts", + sent_counts_); + } } void SocketStreamMetrics::CountProtocolType(ProtocolType protocol_type) { |