Extracted NetLog class's inner enum types into their own enum classes and
refactored codebase accordingly. This is the first step towards achieving
the "Don't use so many inner classes for NetLog" cleanup ticket, which
seeks to make the codebase more "Include what you use" clean.
There are many "net/log/net_log.h" includes in the codebase. Since 'net_log.h'
has many includes itself, this leaves the codebase susceptible to the
undesirable scenario where clients of 'net_log.h' could be relying upon
'net_log.h' not for its contents but its inner includes.
Extracting NetLog's inner classes into their own files will help with the
above issue. For instance, once these inner NetLog classes are extracted:
ThreadSafeObserver, Entry, EntryData, NetLog enum types, then
ThreadSafeObserver clients will not need to include "net_log.h".
Here are a couple historical notes:
1) In refactoring "NetLog::TYPE_SSL_PRIVATE_KEY_OPERATION" to
"NetLogEventType::SSL_PRIVATE_KEY_OPERATION", the removal of "TYPE_" from
"TYPE_SSL_PRIVATE_KEY_OPERATION" created a compiler error when compiling
an ssl-based object file because it turns out that SSL_PRIVATE_KEY_OPERATION
is a macro definition in the ssl translation unit; this resulted in
a macro collision. To resolve, "NetLogEventType::SSL_PRIVATE_KEY_OPERATION"
was changed to "NetLogEventType::SSL_PRIVATE_KEY_OP".
- There aren't any dependencies in the [netlog viewer] code
that depend on the old naming so this should be fine.
2) The new enum classes, as opposed to enums, made it so that
[NetLogEnumClass]::LABEL needed to be statically cast to int at times.
-e.g.- In NetLog::GetEventTypesAsValue()'s for loop to
iterate through all enums.
- Also had to do this in 2 or 3 instances outside of net_log.cc.
BUG=473710
[email protected],[email protected]
[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
Review-Url: https://codereview.chromium.org/2315613002
Cr-Commit-Position: refs/heads/master@{#417358}
diff --git a/net/quic/chromium/bidirectional_stream_quic_impl_unittest.cc b/net/quic/chromium/bidirectional_stream_quic_impl_unittest.cc
index 68b206f..56786ead 100644
--- a/net/quic/chromium/bidirectional_stream_quic_impl_unittest.cc
+++ b/net/quic/chromium/bidirectional_stream_quic_impl_unittest.cc
@@ -14,6 +14,7 @@
#include "net/base/net_errors.h"
#include "net/http/bidirectional_stream_request_info.h"
#include "net/http/transport_security_state.h"
+#include "net/log/net_log_event_type.h"
#include "net/log/test_net_log.h"
#include "net/log/test_net_log_util.h"
#include "net/quic/chromium/quic_chromium_alarm_factory.h"
@@ -705,16 +706,16 @@
net_log().GetEntries(&entries);
size_t pos = ExpectLogContainsSomewhere(
entries, /*min_offset=*/0,
- NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS,
- NetLog::PHASE_NONE);
+ NetLogEventType::QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS,
+ NetLogEventPhase::NONE);
pos = ExpectLogContainsSomewhere(
entries, /*min_offset=*/pos,
- NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS,
- NetLog::PHASE_NONE);
+ NetLogEventType::QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS,
+ NetLogEventPhase::NONE);
ExpectLogContainsSomewhere(
entries, /*min_offset=*/pos,
- NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS,
- NetLog::PHASE_NONE);
+ NetLogEventType::QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS,
+ NetLogEventPhase::NONE);
}
// Tests that when request headers are not delayed, only data buffers are
diff --git a/net/quic/chromium/quic_chromium_client_session.cc b/net/quic/chromium/quic_chromium_client_session.cc
index 5a1ae05..e2759c45 100644
--- a/net/quic/chromium/quic_chromium_client_session.cc
+++ b/net/quic/chromium/quic_chromium_client_session.cc
@@ -21,6 +21,8 @@
#include "net/base/network_activity_monitor.h"
#include "net/http/http_log_util.h"
#include "net/http/transport_security_state.h"
+#include "net/log/net_log_event_type.h"
+#include "net/log/net_log_source_type.h"
#include "net/quic/chromium/crypto/proof_verifier_chromium.h"
#include "net/quic/chromium/quic_chromium_connection_helper.h"
#include "net/quic/chromium/quic_chromium_packet_writer.h"
@@ -225,7 +227,7 @@
pkp_bypassed_(false),
num_total_streams_(0),
task_runner_(task_runner),
- net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)),
+ net_log_(BoundNetLog::Make(net_log, NetLogSourceType::QUIC_SESSION)),
dns_resolution_end_time_(dns_resolution_end_time),
logger_(new QuicConnectionLogger(this,
connection_description,
@@ -251,7 +253,7 @@
crypto_config));
connection->set_debug_visitor(logger_.get());
connection->set_creator_debug_delegate(logger_.get());
- net_log_.BeginEvent(NetLog::TYPE_QUIC_SESSION,
+ net_log_.BeginEvent(NetLogEventType::QUIC_SESSION,
base::Bind(NetLogQuicClientSessionCallback, &server_id,
cert_verify_flags, require_confirmation_));
IPEndPoint address;
@@ -279,7 +281,7 @@
CloseAllObservers(ERR_UNEXPECTED);
connection()->set_debug_visitor(nullptr);
- net_log_.EndEvent(NetLog::TYPE_QUIC_SESSION);
+ net_log_.EndEvent(NetLogEventType::QUIC_SESSION);
while (!stream_requests_.empty()) {
StreamRequest* request = stream_requests_.front();
@@ -1038,7 +1040,7 @@
}
CloseAllStreams(net_error);
CloseAllObservers(net_error);
- net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_CLOSE_ON_ERROR,
+ net_log_.AddEvent(NetLogEventType::QUIC_SESSION_CLOSE_ON_ERROR,
NetLog::IntCallback("net_error", net_error));
if (connection()->connected())
@@ -1221,7 +1223,7 @@
QuicStreamId promised_id,
const SpdyHeaderBlock& headers) {
QuicClientSessionBase::HandlePromised(id, promised_id, headers);
- net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_PUSH_PROMISE_RECEIVED,
+ net_log_.AddEvent(NetLogEventType::QUIC_SESSION_PUSH_PROMISE_RECEIVED,
base::Bind(&NetLogQuicPushPromiseReceivedCallback, &headers,
id, promised_id));
}
diff --git a/net/quic/chromium/quic_chromium_client_stream.cc b/net/quic/chromium/quic_chromium_client_stream.cc
index 47f61b3..c151703 100644
--- a/net/quic/chromium/quic_chromium_client_stream.cc
+++ b/net/quic/chromium/quic_chromium_client_stream.cc
@@ -12,6 +12,7 @@
#include "base/threading/thread_task_runner_handle.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
+#include "net/log/net_log_event_type.h"
#include "net/quic/chromium/quic_chromium_client_session.h"
#include "net/quic/core/quic_http_utils.h"
#include "net/quic/core/quic_spdy_session.h"
@@ -167,7 +168,7 @@
DCHECK_NE("POST", entry->second);
}
net_log_.AddEvent(
- NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS,
+ NetLogEventType::QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS,
base::Bind(&QuicRequestNetLogCallback, id(), &header_block,
QuicSpdyStream::priority()));
return QuicSpdyStream::WriteHeaders(std::move(header_block), fin,
@@ -282,12 +283,12 @@
MarkTrailersConsumed(decompressed_trailers().length());
MarkTrailersDelivered();
net_log_.AddEvent(
- NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_READ_RESPONSE_TRAILERS,
+ NetLogEventType::QUIC_CHROMIUM_CLIENT_STREAM_READ_RESPONSE_TRAILERS,
base::Bind(&SpdyHeaderBlockNetLogCallback, &headers));
} else {
headers_delivered_ = true;
net_log_.AddEvent(
- NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_READ_RESPONSE_HEADERS,
+ NetLogEventType::QUIC_CHROMIUM_CLIENT_STREAM_READ_RESPONSE_HEADERS,
base::Bind(&SpdyHeaderBlockNetLogCallback, &headers));
}
diff --git a/net/quic/chromium/quic_connection_logger.cc b/net/quic/chromium/quic_connection_logger.cc
index ff95f309..dd098b5 100644
--- a/net/quic/chromium/quic_connection_logger.cc
+++ b/net/quic/chromium/quic_connection_logger.cc
@@ -20,6 +20,7 @@
#include "base/values.h"
#include "net/base/ip_address.h"
#include "net/cert/x509_certificate.h"
+#include "net/log/net_log_event_type.h"
#include "net/quic/core/crypto/crypto_handshake_message.h"
#include "net/quic/core/crypto/crypto_protocol.h"
#include "net/quic/core/quic_address_mismatch.h"
@@ -353,45 +354,46 @@
break;
case STREAM_FRAME:
net_log_.AddEvent(
- NetLog::TYPE_QUIC_SESSION_STREAM_FRAME_SENT,
+ NetLogEventType::QUIC_SESSION_STREAM_FRAME_SENT,
base::Bind(&NetLogQuicStreamFrameCallback, frame.stream_frame));
break;
case ACK_FRAME: {
net_log_.AddEvent(
- NetLog::TYPE_QUIC_SESSION_ACK_FRAME_SENT,
+ NetLogEventType::QUIC_SESSION_ACK_FRAME_SENT,
base::Bind(&NetLogQuicAckFrameCallback, frame.ack_frame));
break;
}
case RST_STREAM_FRAME:
UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.RstStreamErrorCodeClient",
frame.rst_stream_frame->error_code);
- net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_RST_STREAM_FRAME_SENT,
+ net_log_.AddEvent(NetLogEventType::QUIC_SESSION_RST_STREAM_FRAME_SENT,
base::Bind(&NetLogQuicRstStreamFrameCallback,
frame.rst_stream_frame));
break;
case CONNECTION_CLOSE_FRAME:
- net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_CONNECTION_CLOSE_FRAME_SENT,
- base::Bind(&NetLogQuicConnectionCloseFrameCallback,
- frame.connection_close_frame));
+ net_log_.AddEvent(
+ NetLogEventType::QUIC_SESSION_CONNECTION_CLOSE_FRAME_SENT,
+ base::Bind(&NetLogQuicConnectionCloseFrameCallback,
+ frame.connection_close_frame));
break;
case GOAWAY_FRAME:
net_log_.AddEvent(
- NetLog::TYPE_QUIC_SESSION_GOAWAY_FRAME_SENT,
+ NetLogEventType::QUIC_SESSION_GOAWAY_FRAME_SENT,
base::Bind(&NetLogQuicGoAwayFrameCallback, frame.goaway_frame));
break;
case WINDOW_UPDATE_FRAME:
- net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_WINDOW_UPDATE_FRAME_SENT,
+ net_log_.AddEvent(NetLogEventType::QUIC_SESSION_WINDOW_UPDATE_FRAME_SENT,
base::Bind(&NetLogQuicWindowUpdateFrameCallback,
frame.window_update_frame));
break;
case BLOCKED_FRAME:
++num_blocked_frames_sent_;
net_log_.AddEvent(
- NetLog::TYPE_QUIC_SESSION_BLOCKED_FRAME_SENT,
+ NetLogEventType::QUIC_SESSION_BLOCKED_FRAME_SENT,
base::Bind(&NetLogQuicBlockedFrameCallback, frame.blocked_frame));
break;
case STOP_WAITING_FRAME:
- net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_STOP_WAITING_FRAME_SENT,
+ net_log_.AddEvent(NetLogEventType::QUIC_SESSION_STOP_WAITING_FRAME_SENT,
base::Bind(&NetLogQuicStopWaitingFrameCallback,
frame.stop_waiting_frame));
break;
@@ -401,11 +403,11 @@
UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.StreamFlowControlBlocked",
session_->IsStreamFlowControlBlocked());
// PingFrame has no contents to log, so just record that it was sent.
- net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_PING_FRAME_SENT);
+ net_log_.AddEvent(NetLogEventType::QUIC_SESSION_PING_FRAME_SENT);
break;
case MTU_DISCOVERY_FRAME:
// MtuDiscoveryFrame is PingFrame on wire, it does not have any payload.
- net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_MTU_DISCOVERY_FRAME_SENT);
+ net_log_.AddEvent(NetLogEventType::QUIC_SESSION_MTU_DISCOVERY_FRAME_SENT);
break;
default:
DCHECK(false) << "Illegal frame type: " << frame.type;
@@ -420,12 +422,12 @@
QuicTime sent_time) {
if (original_packet_number == 0) {
net_log_.AddEvent(
- NetLog::TYPE_QUIC_SESSION_PACKET_SENT,
+ NetLogEventType::QUIC_SESSION_PACKET_SENT,
base::Bind(&NetLogQuicPacketSentCallback, serialized_packet,
transmission_type, sent_time));
} else {
net_log_.AddEvent(
- NetLog::TYPE_QUIC_SESSION_PACKET_RETRANSMITTED,
+ NetLogEventType::QUIC_SESSION_PACKET_RETRANSMITTED,
base::Bind(&NetLogQuicPacketRetransmittedCallback,
original_packet_number, serialized_packet.packet_number));
}
@@ -443,7 +445,7 @@
previous_received_packet_size_ = last_received_packet_size_;
last_received_packet_size_ = packet.length();
- net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_PACKET_RECEIVED,
+ net_log_.AddEvent(NetLogEventType::QUIC_SESSION_PACKET_RECEIVED,
base::Bind(&NetLogQuicPacketCallback, &self_address,
&peer_address, packet.length()));
}
@@ -451,7 +453,7 @@
void QuicConnectionLogger::OnUnauthenticatedHeader(
const QuicPacketHeader& header) {
net_log_.AddEvent(
- NetLog::TYPE_QUIC_SESSION_UNAUTHENTICATED_PACKET_HEADER_RECEIVED,
+ NetLogEventType::QUIC_SESSION_UNAUTHENTICATED_PACKET_HEADER_RECEIVED,
base::Bind(&NetLogQuicPacketHeaderCallback, &header));
}
@@ -466,7 +468,7 @@
void QuicConnectionLogger::OnDuplicatePacket(QuicPacketNumber packet_number) {
net_log_.AddEvent(
- NetLog::TYPE_QUIC_SESSION_DUPLICATE_PACKET_RECEIVED,
+ NetLogEventType::QUIC_SESSION_DUPLICATE_PACKET_RECEIVED,
base::Bind(&NetLogQuicDuplicatePacketCallback, packet_number));
++num_duplicate_packets_;
}
@@ -477,7 +479,7 @@
}
void QuicConnectionLogger::OnPacketHeader(const QuicPacketHeader& header) {
- net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_PACKET_AUTHENTICATED);
+ net_log_.AddEvent(NetLogEventType::QUIC_SESSION_PACKET_AUTHENTICATED);
++num_packets_received_;
if (largest_received_packet_number_ < header.packet_number) {
QuicPacketNumber delta =
@@ -507,12 +509,12 @@
}
void QuicConnectionLogger::OnStreamFrame(const QuicStreamFrame& frame) {
- net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_STREAM_FRAME_RECEIVED,
+ net_log_.AddEvent(NetLogEventType::QUIC_SESSION_STREAM_FRAME_RECEIVED,
base::Bind(&NetLogQuicStreamFrameCallback, &frame));
}
void QuicConnectionLogger::OnAckFrame(const QuicAckFrame& frame) {
- net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_ACK_FRAME_RECEIVED,
+ net_log_.AddEvent(NetLogEventType::QUIC_SESSION_ACK_FRAME_RECEIVED,
base::Bind(&NetLogQuicAckFrameCallback, &frame));
const size_t kApproximateLargestSoloAckBytes = 100;
@@ -565,33 +567,33 @@
void QuicConnectionLogger::OnStopWaitingFrame(
const QuicStopWaitingFrame& frame) {
- net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_STOP_WAITING_FRAME_RECEIVED,
+ net_log_.AddEvent(NetLogEventType::QUIC_SESSION_STOP_WAITING_FRAME_RECEIVED,
base::Bind(&NetLogQuicStopWaitingFrameCallback, &frame));
}
void QuicConnectionLogger::OnRstStreamFrame(const QuicRstStreamFrame& frame) {
UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.RstStreamErrorCodeServer",
frame.error_code);
- net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_RST_STREAM_FRAME_RECEIVED,
+ net_log_.AddEvent(NetLogEventType::QUIC_SESSION_RST_STREAM_FRAME_RECEIVED,
base::Bind(&NetLogQuicRstStreamFrameCallback, &frame));
}
void QuicConnectionLogger::OnConnectionCloseFrame(
const QuicConnectionCloseFrame& frame) {
net_log_.AddEvent(
- NetLog::TYPE_QUIC_SESSION_CONNECTION_CLOSE_FRAME_RECEIVED,
+ NetLogEventType::QUIC_SESSION_CONNECTION_CLOSE_FRAME_RECEIVED,
base::Bind(&NetLogQuicConnectionCloseFrameCallback, &frame));
}
void QuicConnectionLogger::OnWindowUpdateFrame(
const QuicWindowUpdateFrame& frame) {
- net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_WINDOW_UPDATE_FRAME_RECEIVED,
+ net_log_.AddEvent(NetLogEventType::QUIC_SESSION_WINDOW_UPDATE_FRAME_RECEIVED,
base::Bind(&NetLogQuicWindowUpdateFrameCallback, &frame));
}
void QuicConnectionLogger::OnBlockedFrame(const QuicBlockedFrame& frame) {
++num_blocked_frames_received_;
- net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_BLOCKED_FRAME_RECEIVED,
+ net_log_.AddEvent(NetLogEventType::QUIC_SESSION_BLOCKED_FRAME_RECEIVED,
base::Bind(&NetLogQuicBlockedFrameCallback, &frame));
}
@@ -599,18 +601,18 @@
UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.GoAwayReceivedForConnectionMigration",
frame.error_code == QUIC_ERROR_MIGRATING_PORT);
- net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_GOAWAY_FRAME_RECEIVED,
+ net_log_.AddEvent(NetLogEventType::QUIC_SESSION_GOAWAY_FRAME_RECEIVED,
base::Bind(&NetLogQuicGoAwayFrameCallback, &frame));
}
void QuicConnectionLogger::OnPingFrame(const QuicPingFrame& frame) {
// PingFrame has no contents to log, so just record that it was received.
- net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_PING_FRAME_RECEIVED);
+ net_log_.AddEvent(NetLogEventType::QUIC_SESSION_PING_FRAME_RECEIVED);
}
void QuicConnectionLogger::OnPublicResetPacket(
const QuicPublicResetPacket& packet) {
- net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_PUBLIC_RESET_PACKET_RECEIVED);
+ net_log_.AddEvent(NetLogEventType::QUIC_SESSION_PUBLIC_RESET_PACKET_RECEIVED);
UpdatePublicResetAddressMismatchHistogram(local_address_from_shlo_,
packet.client_address);
}
@@ -618,14 +620,14 @@
void QuicConnectionLogger::OnVersionNegotiationPacket(
const QuicVersionNegotiationPacket& packet) {
net_log_.AddEvent(
- NetLog::TYPE_QUIC_SESSION_VERSION_NEGOTIATION_PACKET_RECEIVED,
+ NetLogEventType::QUIC_SESSION_VERSION_NEGOTIATION_PACKET_RECEIVED,
base::Bind(&NetLogQuicVersionNegotiationPacketCallback, &packet));
}
void QuicConnectionLogger::OnCryptoHandshakeMessageReceived(
const CryptoHandshakeMessage& message) {
net_log_.AddEvent(
- NetLog::TYPE_QUIC_SESSION_CRYPTO_HANDSHAKE_MESSAGE_RECEIVED,
+ NetLogEventType::QUIC_SESSION_CRYPTO_HANDSHAKE_MESSAGE_RECEIVED,
base::Bind(&NetLogQuicCryptoHandshakeMessageCallback, &message));
if (message.tag() == kSHLO) {
@@ -645,7 +647,7 @@
void QuicConnectionLogger::OnCryptoHandshakeMessageSent(
const CryptoHandshakeMessage& message) {
net_log_.AddEvent(
- NetLog::TYPE_QUIC_SESSION_CRYPTO_HANDSHAKE_MESSAGE_SENT,
+ NetLogEventType::QUIC_SESSION_CRYPTO_HANDSHAKE_MESSAGE_SENT,
base::Bind(&NetLogQuicCryptoHandshakeMessageCallback, &message));
}
@@ -653,14 +655,14 @@
const string& error_details,
ConnectionCloseSource source) {
net_log_.AddEvent(
- NetLog::TYPE_QUIC_SESSION_CLOSED,
+ NetLogEventType::QUIC_SESSION_CLOSED,
base::Bind(&NetLogQuicOnConnectionClosedCallback, error, source));
}
void QuicConnectionLogger::OnSuccessfulVersionNegotiation(
const QuicVersion& version) {
string quic_version = QuicVersionToString(version);
- net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_VERSION_NEGOTIATED,
+ net_log_.AddEvent(NetLogEventType::QUIC_SESSION_VERSION_NEGOTIATED,
NetLog::StringCallback("version", &quic_version));
}
@@ -677,11 +679,11 @@
void QuicConnectionLogger::OnCertificateVerified(
const CertVerifyResult& result) {
if (result.cert_status == CERT_STATUS_INVALID) {
- net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_CERTIFICATE_VERIFY_FAILED);
+ net_log_.AddEvent(NetLogEventType::QUIC_SESSION_CERTIFICATE_VERIFY_FAILED);
return;
}
net_log_.AddEvent(
- NetLog::TYPE_QUIC_SESSION_CERTIFICATE_VERIFIED,
+ NetLogEventType::QUIC_SESSION_CERTIFICATE_VERIFIED,
base::Bind(&NetLogQuicCertificateVerifiedCallback, result.verified_cert));
}
diff --git a/net/quic/chromium/quic_http_stream.cc b/net/quic/chromium/quic_http_stream.cc
index 9a2e248..9ec364ce 100644
--- a/net/quic/chromium/quic_http_stream.cc
+++ b/net/quic/chromium/quic_http_stream.cc
@@ -15,6 +15,7 @@
#include "net/base/net_errors.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_util.h"
+#include "net/log/net_log_event_type.h"
#include "net/quic/core/quic_client_promised_info.h"
#include "net/quic/core/quic_http_utils.h"
#include "net/quic/core/quic_utils.h"
@@ -115,11 +116,11 @@
if (stream) {
next_state_ = STATE_OPEN;
stream_net_log_.AddEvent(
- NetLog::TYPE_QUIC_HTTP_STREAM_ADOPTED_PUSH_STREAM,
+ NetLogEventType::QUIC_HTTP_STREAM_ADOPTED_PUSH_STREAM,
base::Bind(&NetLogQuicPushStreamCallback, stream_->id(),
&request_info_->url));
session_->net_log().AddEvent(
- NetLog::TYPE_QUIC_HTTP_STREAM_ADOPTED_PUSH_STREAM,
+ NetLogEventType::QUIC_HTTP_STREAM_ADOPTED_PUSH_STREAM,
base::Bind(&NetLogQuicPushStreamCallback, stream_->id(),
&request_info_->url));
DoCallback(OK);
@@ -142,7 +143,7 @@
: ERR_QUIC_HANDSHAKE_FAILED;
stream_net_log.AddEvent(
- NetLog::TYPE_HTTP_STREAM_REQUEST_BOUND_TO_QUIC_SESSION,
+ NetLogEventType::HTTP_STREAM_REQUEST_BOUND_TO_QUIC_SESSION,
session_->net_log().source().ToEventParametersCallback());
stream_net_log_ = stream_net_log;
@@ -160,11 +161,11 @@
if (promised) {
found_promise_ = true;
stream_net_log_.AddEvent(
- NetLog::TYPE_QUIC_HTTP_STREAM_PUSH_PROMISE_RENDEZVOUS,
+ NetLogEventType::QUIC_HTTP_STREAM_PUSH_PROMISE_RENDEZVOUS,
base::Bind(&NetLogQuicPushStreamCallback, promised->id(),
&request_info_->url));
session_->net_log().AddEvent(
- NetLog::TYPE_QUIC_HTTP_STREAM_PUSH_PROMISE_RENDEZVOUS,
+ NetLogEventType::QUIC_HTTP_STREAM_PUSH_PROMISE_RENDEZVOUS,
base::Bind(&NetLogQuicPushStreamCallback, promised->id(),
&request_info_->url));
return OK;
@@ -224,11 +225,11 @@
next_state_ = STATE_OPEN;
if (!CancelPromiseIfHasBody()) {
stream_net_log_.AddEvent(
- NetLog::TYPE_QUIC_HTTP_STREAM_ADOPTED_PUSH_STREAM,
+ NetLogEventType::QUIC_HTTP_STREAM_ADOPTED_PUSH_STREAM,
base::Bind(&NetLogQuicPushStreamCallback, stream_->id(),
&request_info_->url));
session_->net_log().AddEvent(
- NetLog::TYPE_QUIC_HTTP_STREAM_ADOPTED_PUSH_STREAM,
+ NetLogEventType::QUIC_HTTP_STREAM_ADOPTED_PUSH_STREAM,
base::Bind(&NetLogQuicPushStreamCallback, stream_->id(),
&request_info_->url));
// Avoid the call to |DoLoop()| below, which would reset
@@ -690,7 +691,7 @@
// Log the actual request with the URL Request's net log.
stream_net_log_.AddEvent(
- NetLog::TYPE_HTTP_TRANSACTION_QUIC_SEND_REQUEST_HEADERS,
+ NetLogEventType::HTTP_TRANSACTION_QUIC_SEND_REQUEST_HEADERS,
base::Bind(&QuicRequestNetLogCallback, stream_->id(), &request_headers_,
priority_));
bool has_upload_data = request_body_stream_ != nullptr;
diff --git a/net/quic/chromium/quic_http_stream_test.cc b/net/quic/chromium/quic_http_stream_test.cc
index c4461f2..ecd179b 100644
--- a/net/quic/chromium/quic_http_stream_test.cc
+++ b/net/quic/chromium/quic_http_stream_test.cc
@@ -20,6 +20,7 @@
#include "net/base/upload_bytes_element_reader.h"
#include "net/http/http_response_headers.h"
#include "net/http/transport_security_state.h"
+#include "net/log/net_log_event_type.h"
#include "net/log/test_net_log.h"
#include "net/log/test_net_log_util.h"
#include "net/quic/chromium/crypto/proof_verifier_chromium.h"
@@ -727,16 +728,16 @@
net_log_.GetEntries(&entries);
size_t pos = ExpectLogContainsSomewhere(
entries, /*min_offset=*/0,
- NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS,
- NetLog::PHASE_NONE);
+ NetLogEventType::QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS,
+ NetLogEventPhase::NONE);
pos = ExpectLogContainsSomewhere(
entries, /*min_offset=*/pos,
- NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS,
- NetLog::PHASE_NONE);
+ NetLogEventType::QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS,
+ NetLogEventPhase::NONE);
ExpectLogContainsSomewhere(
entries, /*min_offset=*/pos,
- NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS,
- NetLog::PHASE_NONE);
+ NetLogEventType::QUIC_CHROMIUM_CLIENT_STREAM_SEND_REQUEST_HEADERS,
+ NetLogEventPhase::NONE);
}
// Regression test for http://crbug.com/288128
diff --git a/net/quic/chromium/quic_network_transaction_unittest.cc b/net/quic/chromium/quic_network_transaction_unittest.cc
index aabcf52ea..84835591 100644
--- a/net/quic/chromium/quic_network_transaction_unittest.cc
+++ b/net/quic/chromium/quic_network_transaction_unittest.cc
@@ -28,6 +28,7 @@
#include "net/http/http_stream_factory.h"
#include "net/http/http_transaction_test_util.h"
#include "net/http/transport_security_state.h"
+#include "net/log/net_log_event_type.h"
#include "net/log/test_net_log.h"
#include "net/log/test_net_log_entry.h"
#include "net/log/test_net_log_util.h"
@@ -744,15 +745,15 @@
// Check that we logged a QUIC_SESSION_PACKET_RECEIVED.
int pos = ExpectLogContainsSomewhere(
- entries, 0, NetLog::TYPE_QUIC_SESSION_PACKET_RECEIVED,
- NetLog::PHASE_NONE);
+ entries, 0, NetLogEventType::QUIC_SESSION_PACKET_RECEIVED,
+ NetLogEventPhase::NONE);
EXPECT_LT(0, pos);
// ... and also a TYPE_QUIC_SESSION_UNAUTHENTICATED_PACKET_HEADER_RECEIVED.
pos = ExpectLogContainsSomewhere(
entries, 0,
- NetLog::TYPE_QUIC_SESSION_UNAUTHENTICATED_PACKET_HEADER_RECEIVED,
- NetLog::PHASE_NONE);
+ NetLogEventType::QUIC_SESSION_UNAUTHENTICATED_PACKET_HEADER_RECEIVED,
+ NetLogEventPhase::NONE);
EXPECT_LT(0, pos);
std::string packet_number;
@@ -761,14 +762,14 @@
// ... and also a TYPE_QUIC_SESSION_PACKET_AUTHENTICATED.
pos = ExpectLogContainsSomewhere(
- entries, 0, NetLog::TYPE_QUIC_SESSION_PACKET_AUTHENTICATED,
- NetLog::PHASE_NONE);
+ entries, 0, NetLogEventType::QUIC_SESSION_PACKET_AUTHENTICATED,
+ NetLogEventPhase::NONE);
EXPECT_LT(0, pos);
// ... and also a QUIC_SESSION_STREAM_FRAME_RECEIVED.
pos = ExpectLogContainsSomewhere(
- entries, 0, NetLog::TYPE_QUIC_SESSION_STREAM_FRAME_RECEIVED,
- NetLog::PHASE_NONE);
+ entries, 0, NetLogEventType::QUIC_SESSION_STREAM_FRAME_RECEIVED,
+ NetLogEventPhase::NONE);
EXPECT_LT(0, pos);
int log_stream_id;
@@ -2554,8 +2555,8 @@
// Check that we logged a QUIC_HTTP_STREAM_ADOPTED_PUSH_STREAM
int pos = ExpectLogContainsSomewhere(
- entries, 0, NetLog::TYPE_QUIC_HTTP_STREAM_ADOPTED_PUSH_STREAM,
- NetLog::PHASE_NONE);
+ entries, 0, NetLogEventType::QUIC_HTTP_STREAM_ADOPTED_PUSH_STREAM,
+ NetLogEventPhase::NONE);
EXPECT_LT(0, pos);
}
diff --git a/net/quic/chromium/quic_stream_factory.cc b/net/quic/chromium/quic_stream_factory.cc
index 598e5ff..92c8a3e15 100644
--- a/net/quic/chromium/quic_stream_factory.cc
+++ b/net/quic/chromium/quic_stream_factory.cc
@@ -31,6 +31,8 @@
#include "net/cert/ct_verifier.h"
#include "net/dns/host_resolver.h"
#include "net/http/bidirectional_stream_impl.h"
+#include "net/log/net_log_event_type.h"
+#include "net/log/net_log_source_type.h"
#include "net/quic/chromium/bidirectional_stream_quic_impl.h"
#include "net/quic/chromium/crypto/channel_id_chromium.h"
#include "net/quic/chromium/crypto/proof_verifier_chromium.h"
@@ -120,15 +122,16 @@
class ScopedConnectionMigrationEventLog {
public:
ScopedConnectionMigrationEventLog(NetLog* net_log, std::string trigger)
- : net_log_(BoundNetLog::Make(net_log,
- NetLog::SOURCE_QUIC_CONNECTION_MIGRATION)) {
+ : net_log_(
+ BoundNetLog::Make(net_log,
+ NetLogSourceType::QUIC_CONNECTION_MIGRATION)) {
net_log_.BeginEvent(
- NetLog::TYPE_QUIC_CONNECTION_MIGRATION_TRIGGERED,
+ NetLogEventType::QUIC_CONNECTION_MIGRATION_TRIGGERED,
base::Bind(&NetLogQuicConnectionMigrationTriggerCallback, trigger));
}
~ScopedConnectionMigrationEventLog() {
- net_log_.EndEvent(NetLog::TYPE_QUIC_CONNECTION_MIGRATION_TRIGGERED);
+ net_log_.EndEvent(NetLogEventType::QUIC_CONNECTION_MIGRATION_TRIGGERED);
}
const BoundNetLog& net_log() { return net_log_; }
@@ -148,7 +151,7 @@
std::string reason) {
UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.ConnectionMigration", status,
MIGRATION_STATUS_MAX);
- net_log.AddEvent(NetLog::TYPE_QUIC_CONNECTION_MIGRATION_FAILURE,
+ net_log.AddEvent(NetLogEventType::QUIC_CONNECTION_MIGRATION_FAILURE,
base::Bind(&NetLogQuicConnectionMigrationFailureCallback,
connection_id, reason));
}
@@ -1658,7 +1661,7 @@
}
HistogramMigrationStatus(MIGRATION_STATUS_SUCCESS);
bound_net_log.AddEvent(
- NetLog::TYPE_QUIC_CONNECTION_MIGRATION_SUCCESS,
+ NetLogEventType::QUIC_CONNECTION_MIGRATION_SUCCESS,
base::Bind(&NetLogQuicConnectionMigrationSuccessCallback,
session->connection_id()));
}