diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-08 23:02:15 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-08 23:02:15 +0000 |
commit | fd4fe0b5f640e9a06b9fcf740a0e465f79bfe7d1 (patch) | |
tree | c30bf8c1f15e1a964b91490951958a0c58e119cc /net/base | |
parent | 1e8c93fe918da7180751eecca190a2a867c9addf (diff) | |
download | chromium_src-fd4fe0b5f640e9a06b9fcf740a0e465f79bfe7d1.zip chromium_src-fd4fe0b5f640e9a06b9fcf740a0e465f79bfe7d1.tar.gz chromium_src-fd4fe0b5f640e9a06b9fcf740a0e465f79bfe7d1.tar.bz2 |
Fix ClientSocketPoolBaseHelper to maintain order properly.
It used to be the case that when a disconnected socket is released, it would pop the front of the queue, and since it was a disconnected socket, would kick off another ConnectJob and then append the request to the back to the queue.
While doing this, I cleaned up the TYPE_SOCKET_WAITING_IN_QUEUE since it doesn't make sense. You're always waiting in a queue, unless the request gets fulfilled immediately. I've added strings to the LoadLog to distinguish this situation and also identify when the socket has been reused.
Review URL: http://codereview.chromium.org/583002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38408 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
-rw-r--r-- | net/base/load_log_event_type_list.h | 4 | ||||
-rw-r--r-- | net/base/load_log_unittest.h | 18 |
2 files changed, 16 insertions, 6 deletions
diff --git a/net/base/load_log_event_type_list.h b/net/base/load_log_event_type_list.h index e6b991e..a4eb5c4 100644 --- a/net/base/load_log_event_type_list.h +++ b/net/base/load_log_event_type_list.h @@ -112,10 +112,6 @@ EVENT_TYPE(SOCKET_POOL_CONNECT_JOB_TIMED_OUT) // The start/end of a client socket pool request for a socket. EVENT_TYPE(SOCKET_POOL) -// The start/end of when a request is sitting in the queue waiting for -// a connect job to finish. (Only applies to late_binding). -EVENT_TYPE(SOCKET_POOL_WAITING_IN_QUEUE) - // The request stalled because there are too many sockets in the pool. EVENT_TYPE(SOCKET_POOL_STALLED_MAX_SOCKETS) diff --git a/net/base/load_log_unittest.h b/net/base/load_log_unittest.h index 1efbd46b..b1922ef 100644 --- a/net/base/load_log_unittest.h +++ b/net/base/load_log_unittest.h @@ -30,9 +30,8 @@ inline ::testing::AssertionResult LogContainsEventHelper( if (j >= log.entries().size()) return ::testing::AssertionFailure() << j << " is out of bounds."; const LoadLog::Entry& entry = log.entries()[j]; - if (entry.type != LoadLog::Entry::TYPE_EVENT) { + if (entry.type != LoadLog::Entry::TYPE_EVENT) return ::testing::AssertionFailure() << "Not a TYPE_EVENT entry"; - } if (expected_event != entry.event.type) { return ::testing::AssertionFailure() << "Actual event: " << LoadLog::EventTypeToString(entry.event.type) @@ -91,6 +90,21 @@ inline ::testing::AssertionResult LogContainsEndEvent( return LogContainsEvent(log, i, expected_event, LoadLog::PHASE_END); } +inline ::testing::AssertionResult LogContainsEntryWithType( + const LoadLog& log, + int i, // Negative indices are reverse indices. + LoadLog::Entry::Type type) { + // Negative indices are reverse indices. + size_t j = (i < 0) ? log.entries().size() + i : i; + if (j >= log.entries().size()) + return ::testing::AssertionFailure() << j << " is out of bounds."; + const LoadLog::Entry& entry = log.entries()[j]; + if (entry.type != type) + return ::testing::AssertionFailure() << "Type does not match."; + return ::testing::AssertionSuccess(); +} + + // Expect that the log contains an event, but don't care about where // as long as the index where it is found is greater than min_index. // Returns the position where the event was found. |