summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorvandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-17 19:07:21 +0000
committervandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-17 19:07:21 +0000
commit1239d2873c81b96ba283981b7fc35bcf566ca7d1 (patch)
tree12c4c23ebf238b669e3580bb1076de8b0f8b98ac /net
parent90610762cb7f004ad28dde9b9763714bf95731d7 (diff)
downloadchromium_src-1239d2873c81b96ba283981b7fc35bcf566ca7d1.zip
chromium_src-1239d2873c81b96ba283981b7fc35bcf566ca7d1.tar.gz
chromium_src-1239d2873c81b96ba283981b7fc35bcf566ca7d1.tar.bz2
Add more load log points near HttpNetworkTransaction::ReadHeaders
TEST=none BUG=27324 Review URL: http://codereview.chromium.org/501034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34853 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/load_log_event_type_list.h7
-rw-r--r--net/http/http_basic_stream.cc4
-rw-r--r--net/http/http_basic_stream.h3
-rw-r--r--net/http/http_network_transaction.cc6
-rw-r--r--net/http/http_stream_parser.cc8
-rw-r--r--net/http/http_stream_parser.h6
6 files changed, 26 insertions, 8 deletions
diff --git a/net/base/load_log_event_type_list.h b/net/base/load_log_event_type_list.h
index eeccfd3..5b063de 100644
--- a/net/base/load_log_event_type_list.h
+++ b/net/base/load_log_event_type_list.h
@@ -178,6 +178,13 @@ EVENT_TYPE(FLIP_TRANSACTION_READ_HEADERS)
EVENT_TYPE(FLIP_TRANSACTION_READ_BODY)
// ------------------------------------------------------------------------
+// HttpStreamParser
+// ------------------------------------------------------------------------
+
+// Measures the time to read HTTP response headers from the server.
+EVENT_TYPE(HTTP_STREAM_PARSER_READ_HEADERS)
+
+// ------------------------------------------------------------------------
// SocketStream
// ------------------------------------------------------------------------
diff --git a/net/http/http_basic_stream.cc b/net/http/http_basic_stream.cc
index 220996b..f587ab4 100644
--- a/net/http/http_basic_stream.cc
+++ b/net/http/http_basic_stream.cc
@@ -6,9 +6,9 @@
namespace net {
-HttpBasicStream::HttpBasicStream(ClientSocketHandle* handle)
+HttpBasicStream::HttpBasicStream(ClientSocketHandle* handle, LoadLog* load_log)
: read_buf_(new GrowableIOBuffer()),
- parser_(new HttpStreamParser(handle, read_buf_)) {
+ parser_(new HttpStreamParser(handle, read_buf_, load_log)) {
}
int HttpBasicStream::SendRequest(const HttpRequestInfo* request,
diff --git a/net/http/http_basic_stream.h b/net/http/http_basic_stream.h
index 53675a3..0a12baf 100644
--- a/net/http/http_basic_stream.h
+++ b/net/http/http_basic_stream.h
@@ -21,11 +21,12 @@ namespace net {
class ClientSocketHandle;
class HttpRequestInfo;
class HttpResponseInfo;
+class LoadLog;
class UploadDataStream;
class HttpBasicStream : public HttpStream {
public:
- explicit HttpBasicStream(ClientSocketHandle* handle);
+ HttpBasicStream(ClientSocketHandle* handle, LoadLog* load_log);
virtual ~HttpBasicStream() {}
// HttpStream methods:
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index a45d3ab..3a964c8 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -636,7 +636,7 @@ int HttpNetworkTransaction::DoInitConnectionComplete(int result) {
}
}
headers_valid_ = false;
- http_stream_.reset(new HttpBasicStream(&connection_));
+ http_stream_.reset(new HttpBasicStream(&connection_, load_log_));
return OK;
}
@@ -855,7 +855,7 @@ int HttpNetworkTransaction::DoReadHeadersComplete(int result) {
next_state_ = STATE_SSL_CONNECT;
// Reset for the real request and response headers.
request_headers_.clear();
- http_stream_.reset(new HttpBasicStream(&connection_));
+ http_stream_.reset(new HttpBasicStream(&connection_, load_log_));
headers_valid_ = false;
establishing_tunnel_ = false;
return OK;
@@ -1340,7 +1340,7 @@ void HttpNetworkTransaction::ResetStateForRestart() {
pending_auth_target_ = HttpAuth::AUTH_NONE;
read_buf_ = NULL;
read_buf_len_ = 0;
- http_stream_.reset(new HttpBasicStream(&connection_));
+ http_stream_.reset(new HttpBasicStream(&connection_, load_log_));
headers_valid_ = false;
request_headers_.clear();
response_ = HttpResponseInfo();
diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc
index cd58ee2..a83616b 100644
--- a/net/http/http_stream_parser.cc
+++ b/net/http/http_stream_parser.cc
@@ -14,7 +14,8 @@
namespace net {
HttpStreamParser::HttpStreamParser(ClientSocketHandle* connection,
- GrowableIOBuffer* read_buffer)
+ GrowableIOBuffer* read_buffer,
+ LoadLog* load_log)
: io_state_(STATE_NONE),
request_(NULL),
request_headers_(NULL),
@@ -29,6 +30,7 @@ HttpStreamParser::HttpStreamParser(ClientSocketHandle* connection,
user_read_buf_len_(0),
user_callback_(NULL),
connection_(connection),
+ load_log_(load_log),
ALLOW_THIS_IN_INITIALIZER_LIST(
io_callback_(this, &HttpStreamParser::OnIOComplete)) {
DCHECK_EQ(0, read_buffer->offset());
@@ -141,10 +143,14 @@ int HttpStreamParser::DoLoop(int result) {
break;
case STATE_READ_HEADERS:
TRACE_EVENT_BEGIN("http.read_headers", request_, request_->url.spec());
+ LoadLog::BeginEvent(load_log_,
+ LoadLog::TYPE_HTTP_STREAM_PARSER_READ_HEADERS);
result = DoReadHeaders();
break;
case STATE_READ_HEADERS_COMPLETE:
result = DoReadHeadersComplete(result);
+ LoadLog::EndEvent(load_log_,
+ LoadLog::TYPE_HTTP_STREAM_PARSER_READ_HEADERS);
TRACE_EVENT_END("http.read_headers", request_, request_->url.spec());
break;
case STATE_BODY_PENDING:
diff --git a/net/http/http_stream_parser.h b/net/http/http_stream_parser.h
index 4ccc6ee..c47d09e 100644
--- a/net/http/http_stream_parser.h
+++ b/net/http/http_stream_parser.h
@@ -9,6 +9,7 @@
#include "base/basictypes.h"
#include "net/base/io_buffer.h"
+#include "net/base/load_log.h"
#include "net/base/upload_data_stream.h"
#include "net/http/http_chunked_decoder.h"
#include "net/http/http_response_info.h"
@@ -27,7 +28,8 @@ class HttpStreamParser {
// buffer's offset will be set to the first free byte. |read_buffer| may
// have its capacity changed.
HttpStreamParser(ClientSocketHandle* connection,
- GrowableIOBuffer* read_buffer);
+ GrowableIOBuffer* read_buffer,
+ LoadLog* load_log);
~HttpStreamParser() {}
// These functions implement the interface described in HttpStream with
@@ -160,6 +162,8 @@ class HttpStreamParser {
// The underlying socket.
ClientSocketHandle* const connection_;
+ scoped_refptr<LoadLog> load_log_;
+
// Callback to be used when doing IO.
CompletionCallbackImpl<HttpStreamParser> io_callback_;