Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Unified Diff: net/http/bidirectional_stream.cc

Issue 2315613002: Extracted NetLog class's inner enum types into their own enum classes and (Closed)
Patch Set: Ran "git cl format" on code. Much formatting ensued. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/ftp/ftp_network_transaction.cc ('k') | net/http/bidirectional_stream_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/bidirectional_stream.cc
diff --git a/net/http/bidirectional_stream.cc b/net/http/bidirectional_stream.cc
index d7a4a2ea6eebef7da97a03fd3b23aca1705c010d..1d3af661cfda74a0e9792896f767049859f7d721 100644
--- a/net/http/bidirectional_stream.cc
+++ b/net/http/bidirectional_stream.cc
@@ -23,6 +23,8 @@
#include "net/http/http_response_headers.h"
#include "net/http/http_stream.h"
#include "net/log/net_log_capture_mode.h"
+#include "net/log/net_log_event_type.h"
+#include "net/log/net_log_source_type.h"
#include "net/spdy/spdy_header_block.h"
#include "net/spdy/spdy_http_utils.h"
#include "net/ssl/ssl_cert_request_info.h"
@@ -80,7 +82,7 @@ BidirectionalStream::BidirectionalStream(
std::unique_ptr<base::Timer> timer)
: request_info_(std::move(request_info)),
net_log_(BoundNetLog::Make(session->net_log(),
- NetLog::SOURCE_BIDIRECTIONAL_STREAM)),
+ NetLogSourceType::BIDIRECTIONAL_STREAM)),
session_(session),
send_request_headers_automatically_(send_request_headers_automatically),
request_headers_sent_(false),
@@ -92,7 +94,7 @@ BidirectionalStream::BidirectionalStream(
if (net_log_.IsCapturing()) {
net_log_.BeginEvent(
- NetLog::TYPE_BIDIRECTIONAL_STREAM_ALIVE,
+ NetLogEventType::BIDIRECTIONAL_STREAM_ALIVE,
base::Bind(&NetLogCallback, &request_info_->url, &request_info_->method,
base::Unretained(&request_info_->extra_headers)));
}
@@ -128,7 +130,7 @@ BidirectionalStream::BidirectionalStream(
BidirectionalStream::~BidirectionalStream() {
UpdateHistograms();
if (net_log_.IsCapturing()) {
- net_log_.EndEvent(NetLog::TYPE_BIDIRECTIONAL_STREAM_ALIVE);
+ net_log_.EndEvent(NetLogEventType::BIDIRECTIONAL_STREAM_ALIVE);
}
}
@@ -147,13 +149,13 @@ int BidirectionalStream::ReadData(IOBuffer* buf, int buf_len) {
if (rv > 0) {
read_end_time_ = base::TimeTicks::Now();
net_log_.AddByteTransferEvent(
- NetLog::TYPE_BIDIRECTIONAL_STREAM_BYTES_RECEIVED, rv, buf->data());
+ NetLogEventType::BIDIRECTIONAL_STREAM_BYTES_RECEIVED, rv, buf->data());
} else if (rv == ERR_IO_PENDING) {
read_buffer_ = buf;
// Bytes will be logged in OnDataRead().
}
if (net_log_.IsCapturing()) {
- net_log_.AddEvent(NetLog::TYPE_BIDIRECTIONAL_STREAM_READ_DATA,
+ net_log_.AddEvent(NetLogEventType::BIDIRECTIONAL_STREAM_READ_DATA,
NetLog::IntCallback("rv", rv));
}
return rv;
@@ -167,7 +169,7 @@ void BidirectionalStream::SendData(const scoped_refptr<IOBuffer>& data,
DCHECK(write_buffer_len_list_.empty());
if (net_log_.IsCapturing()) {
- net_log_.AddEvent(NetLog::TYPE_BIDIRECTIONAL_STREAM_SEND_DATA);
+ net_log_.AddEvent(NetLogEventType::BIDIRECTIONAL_STREAM_SEND_DATA);
}
stream_impl_->SendData(data, length, end_stream);
write_buffer_list_.push_back(data);
@@ -184,7 +186,7 @@ void BidirectionalStream::SendvData(
DCHECK(write_buffer_len_list_.empty());
if (net_log_.IsCapturing()) {
- net_log_.AddEvent(NetLog::TYPE_BIDIRECTIONAL_STREAM_SENDV_DATA,
+ net_log_.AddEvent(NetLogEventType::BIDIRECTIONAL_STREAM_SENDV_DATA,
NetLog::IntCallback("num_buffers", buffers.size()));
}
stream_impl_->SendvData(buffers, lengths, end_stream);
@@ -219,7 +221,7 @@ void BidirectionalStream::OnStreamReady(bool request_headers_sent) {
request_headers_sent_ = request_headers_sent;
if (net_log_.IsCapturing()) {
net_log_.AddEvent(
- NetLog::TYPE_BIDIRECTIONAL_STREAM_READY,
+ NetLogEventType::BIDIRECTIONAL_STREAM_READY,
NetLog::BoolCallback("request_headers_sent", request_headers_sent));
}
send_start_time_ = base::TimeTicks::Now();
@@ -236,7 +238,7 @@ void BidirectionalStream::OnHeadersReceived(
return;
}
if (net_log_.IsCapturing()) {
- net_log_.AddEvent(NetLog::TYPE_BIDIRECTIONAL_STREAM_RECV_HEADERS,
+ net_log_.AddEvent(NetLogEventType::BIDIRECTIONAL_STREAM_RECV_HEADERS,
base::Bind(&NetLogHeadersCallback, &response_headers));
}
read_start_time_ = base::TimeTicks::Now();
@@ -252,7 +254,7 @@ void BidirectionalStream::OnDataRead(int bytes_read) {
if (net_log_.IsCapturing()) {
net_log_.AddByteTransferEvent(
- NetLog::TYPE_BIDIRECTIONAL_STREAM_BYTES_RECEIVED, bytes_read,
+ NetLogEventType::BIDIRECTIONAL_STREAM_BYTES_RECEIVED, bytes_read,
read_buffer_->data());
}
read_end_time_ = base::TimeTicks::Now();
@@ -267,17 +269,18 @@ void BidirectionalStream::OnDataSent() {
if (net_log_.IsCapturing()) {
if (write_buffer_list_.size() > 1) {
net_log_.BeginEvent(
- NetLog::TYPE_BIDIRECTIONAL_STREAM_BYTES_SENT_COALESCED,
+ NetLogEventType::BIDIRECTIONAL_STREAM_BYTES_SENT_COALESCED,
NetLog::IntCallback("num_buffers_coalesced",
write_buffer_list_.size()));
}
for (size_t i = 0; i < write_buffer_list_.size(); ++i) {
net_log_.AddByteTransferEvent(
- NetLog::TYPE_BIDIRECTIONAL_STREAM_BYTES_SENT,
+ NetLogEventType::BIDIRECTIONAL_STREAM_BYTES_SENT,
write_buffer_len_list_[i], write_buffer_list_[i]->data());
}
if (write_buffer_list_.size() > 1) {
- net_log_.EndEvent(NetLog::TYPE_BIDIRECTIONAL_STREAM_BYTES_SENT_COALESCED);
+ net_log_.EndEvent(
+ NetLogEventType::BIDIRECTIONAL_STREAM_BYTES_SENT_COALESCED);
}
}
send_end_time_ = base::TimeTicks::Now();
@@ -288,7 +291,7 @@ void BidirectionalStream::OnDataSent() {
void BidirectionalStream::OnTrailersReceived(const SpdyHeaderBlock& trailers) {
if (net_log_.IsCapturing()) {
- net_log_.AddEvent(NetLog::TYPE_BIDIRECTIONAL_STREAM_RECV_TRAILERS,
+ net_log_.AddEvent(NetLogEventType::BIDIRECTIONAL_STREAM_RECV_TRAILERS,
base::Bind(&NetLogHeadersCallback, &trailers));
}
read_end_time_ = base::TimeTicks::Now();
@@ -297,7 +300,7 @@ void BidirectionalStream::OnTrailersReceived(const SpdyHeaderBlock& trailers) {
void BidirectionalStream::OnFailed(int status) {
if (net_log_.IsCapturing()) {
- net_log_.AddEvent(NetLog::TYPE_BIDIRECTIONAL_STREAM_FAILED,
+ net_log_.AddEvent(NetLogEventType::BIDIRECTIONAL_STREAM_FAILED,
NetLog::IntCallback("net_error", status));
}
NotifyFailed(status);
« no previous file with comments | « net/ftp/ftp_network_transaction.cc ('k') | net/http/bidirectional_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698