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

Unified Diff: net/dns/dns_transaction.cc

Issue 2315613002: Extracted NetLog class's inner enum types into their own enum classes and (Closed)
Patch Set: 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
Index: net/dns/dns_transaction.cc
diff --git a/net/dns/dns_transaction.cc b/net/dns/dns_transaction.cc
index c5f61abf8d977a0b9db1779f3c2cda1e76b04a1a..e3de873bb22e45b6783845d78eb956e79fdcf8dc 100644
--- a/net/dns/dns_transaction.cc
+++ b/net/dns/dns_transaction.cc
@@ -38,6 +38,7 @@
#include "net/dns/dns_session.h"
#include "net/dns/dns_util.h"
#include "net/log/net_log.h"
+#include "net/log/net_log_event_type.h"
#include "net/socket/stream_socket.h"
#include "net/udp/datagram_client_socket.h"
@@ -580,7 +581,7 @@ class DnsTransactionImpl : public DnsTransaction,
~DnsTransactionImpl() override {
if (!callback_.is_null()) {
- net_log_.EndEventWithNetErrorCode(NetLog::TYPE_DNS_TRANSACTION,
+ net_log_.EndEventWithNetErrorCode(NetLogEventType::DNS_TRANSACTION,
ERR_ABORTED);
} // otherwise logged in DoCallback or Start
}
@@ -598,7 +599,7 @@ class DnsTransactionImpl : public DnsTransaction,
void Start() override {
DCHECK(!callback_.is_null());
DCHECK(attempts_.empty());
- net_log_.BeginEvent(NetLog::TYPE_DNS_TRANSACTION,
+ net_log_.BeginEvent(NetLogEventType::DNS_TRANSACTION,
base::Bind(&NetLogStartCallback, &hostname_, qtype_));
AttemptResult result(PrepareSearch(), NULL);
if (result.rv == OK) {
@@ -697,7 +698,8 @@ class DnsTransactionImpl : public DnsTransaction,
DnsTransactionFactory::CallbackType callback = callback_;
callback_.Reset();
- net_log_.EndEventWithNetErrorCode(NetLog::TYPE_DNS_TRANSACTION, result.rv);
+ net_log_.EndEventWithNetErrorCode(NetLogEventType::DNS_TRANSACTION,
+ result.rv);
callback.Run(this, result.rv, response);
}
@@ -736,7 +738,7 @@ class DnsTransactionImpl : public DnsTransaction,
return AttemptResult(ERR_CONNECTION_REFUSED, NULL);
net_log_.AddEvent(
- NetLog::TYPE_DNS_TRANSACTION_ATTEMPT,
+ NetLogEventType::DNS_TRANSACTION_ATTEMPT,
attempt->GetSocketNetLog().source().ToEventParametersCallback());
int rv = attempt->Start(
@@ -779,7 +781,7 @@ class DnsTransactionImpl : public DnsTransaction,
had_tcp_attempt_ = true;
net_log_.AddEvent(
- NetLog::TYPE_DNS_TRANSACTION_TCP_ATTEMPT,
+ NetLogEventType::DNS_TRANSACTION_TCP_ATTEMPT,
attempt->GetSocketNetLog().source().ToEventParametersCallback());
int rv = attempt->Start(base::Bind(&DnsTransactionImpl::OnAttemptComplete,
@@ -796,7 +798,7 @@ class DnsTransactionImpl : public DnsTransaction,
// Begins query for the current name. Makes the first attempt.
AttemptResult StartQuery() {
std::string dotted_qname = DNSDomainToString(qnames_.front());
- net_log_.BeginEvent(NetLog::TYPE_DNS_TRANSACTION_QUERY,
+ net_log_.BeginEvent(NetLogEventType::DNS_TRANSACTION_QUERY,
NetLog::StringCallback("qname", &dotted_qname));
first_server_index_ = session_->NextFirstServerIndex();
@@ -857,7 +859,7 @@ class DnsTransactionImpl : public DnsTransaction,
void LogResponse(const DnsAttempt* attempt) {
if (attempt && attempt->GetResponse()) {
net_log_.AddEvent(
- NetLog::TYPE_DNS_TRANSACTION_RESPONSE,
+ NetLogEventType::DNS_TRANSACTION_RESPONSE,
base::Bind(&DnsAttempt::NetLogResponseCallback,
base::Unretained(attempt)));
}
@@ -879,15 +881,17 @@ class DnsTransactionImpl : public DnsTransaction,
switch (result.rv) {
case OK:
session_->RecordServerSuccess(result.attempt->server_index());
- net_log_.EndEventWithNetErrorCode(NetLog::TYPE_DNS_TRANSACTION_QUERY,
- result.rv);
+ net_log_.EndEventWithNetErrorCode(
+ NetLogEventType::DNS_TRANSACTION_QUERY,
+ result.rv);
DCHECK(result.attempt);
DCHECK(result.attempt->GetResponse());
return result;
case ERR_NAME_NOT_RESOLVED:
session_->RecordServerSuccess(result.attempt->server_index());
- net_log_.EndEventWithNetErrorCode(NetLog::TYPE_DNS_TRANSACTION_QUERY,
- result.rv);
+ net_log_.EndEventWithNetErrorCode(
+ NetLogEventType::DNS_TRANSACTION_QUERY,
+ result.rv);
// Try next suffix.
qnames_.pop_front();
if (qnames_.empty()) {

Powered by Google App Engine
This is Rietveld 408576698