| Index: net/log/net_log.cc
|
| diff --git a/net/log/net_log.cc b/net/log/net_log.cc
|
| index b038519651a229f369f5b64febb9430f1964bcda..66283dbc749540e7124772720397663c83c3e174 100644
|
| --- a/net/log/net_log.cc
|
| +++ b/net/log/net_log.cc
|
| @@ -110,10 +110,11 @@ std::unique_ptr<base::Value> NetLogString16Callback(
|
| // LoadTimingInfo requires this be 0.
|
| const uint32_t NetLog::Source::kInvalidId = 0;
|
|
|
| -NetLog::Source::Source() : type(SOURCE_NONE), id(kInvalidId) {
|
| +NetLog::Source::Source() : type(NetLogSourceType::NONE), id(kInvalidId) {
|
| }
|
|
|
| -NetLog::Source::Source(SourceType type, uint32_t id) : type(type), id(id) {}
|
| +NetLog::Source::Source(NetLogSourceType type, uint32_t id)
|
| + : type(type), id(id) {}
|
|
|
| bool NetLog::Source::IsValid() const {
|
| return id != kInvalidId;
|
| @@ -137,7 +138,7 @@ bool NetLog::Source::FromEventParameters(base::Value* event_params,
|
| base::DictionaryValue* dict = NULL;
|
| base::DictionaryValue* source_dict = NULL;
|
| int source_id = -1;
|
| - int source_type = NetLog::SOURCE_COUNT;
|
| + int source_type = static_cast<int>(NetLogSourceType::COUNT);
|
| if (!event_params || !event_params->GetAsDictionary(&dict) ||
|
| !dict->GetDictionary("source_dependency", &source_dict) ||
|
| !source_dict->GetInteger("id", &source_id) ||
|
| @@ -147,8 +148,8 @@ bool NetLog::Source::FromEventParameters(base::Value* event_params,
|
| }
|
|
|
| DCHECK_GE(source_id, 0);
|
| - DCHECK_LT(source_type, NetLog::SOURCE_COUNT);
|
| - *source = Source(static_cast<SourceType>(source_type), source_id);
|
| + DCHECK_LT(source_type, static_cast<int>(NetLogSourceType::COUNT));
|
| + *source = Source(static_cast<NetLogSourceType>(source_type), source_id);
|
| return true;
|
| }
|
|
|
| @@ -186,9 +187,9 @@ std::unique_ptr<base::Value> NetLog::Entry::ParametersToValue() const {
|
| return nullptr;
|
| }
|
|
|
| -NetLog::EntryData::EntryData(EventType type,
|
| +NetLog::EntryData::EntryData(NetLogEventType type,
|
| Source source,
|
| - EventPhase phase,
|
| + NetLogEventPhase phase,
|
| base::TimeTicks time,
|
| const ParametersCallback* parameters_callback)
|
| : type(type),
|
| @@ -237,16 +238,16 @@ NetLog::NetLog() : last_id_(0), is_capturing_(0) {
|
| NetLog::~NetLog() {
|
| }
|
|
|
| -void NetLog::AddGlobalEntry(EventType type) {
|
| - AddEntry(type, Source(NetLog::SOURCE_NONE, NextID()), NetLog::PHASE_NONE,
|
| - NULL);
|
| +void NetLog::AddGlobalEntry(NetLogEventType type) {
|
| + AddEntry(type, Source(NetLogSourceType::NONE, NextID()),
|
| + NetLogEventPhase::NONE, NULL);
|
| }
|
|
|
| void NetLog::AddGlobalEntry(
|
| - EventType type,
|
| + NetLogEventType type,
|
| const NetLog::ParametersCallback& parameters_callback) {
|
| - AddEntry(type, Source(NetLog::SOURCE_NONE, NextID()), NetLog::PHASE_NONE,
|
| - ¶meters_callback);
|
| + AddEntry(type, Source(NetLogSourceType::NONE, NextID()),
|
| + NetLogEventPhase::NONE, ¶meters_callback);
|
| }
|
|
|
| uint32_t NetLog::NextID() {
|
| @@ -301,10 +302,10 @@ std::string NetLog::TickCountToString(const base::TimeTicks& time) {
|
| }
|
|
|
| // static
|
| -const char* NetLog::EventTypeToString(EventType event) {
|
| +const char* NetLog::EventTypeToString(NetLogEventType event) {
|
| switch (event) {
|
| #define EVENT_TYPE(label) \
|
| - case TYPE_##label: \
|
| + case NetLogEventType::label: \
|
| return #label;
|
| #include "net/log/net_log_event_type_list.h"
|
| #undef EVENT_TYPE
|
| @@ -317,17 +318,17 @@ const char* NetLog::EventTypeToString(EventType event) {
|
| // static
|
| base::Value* NetLog::GetEventTypesAsValue() {
|
| std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
|
| - for (int i = 0; i < EVENT_COUNT; ++i) {
|
| - dict->SetInteger(EventTypeToString(static_cast<EventType>(i)), i);
|
| + for (int i = 0; i < static_cast<int>(NetLogEventType::COUNT); ++i) {
|
| + dict->SetInteger(EventTypeToString(static_cast<NetLogEventType>(i)), i);
|
| }
|
| return dict.release();
|
| }
|
|
|
| // static
|
| -const char* NetLog::SourceTypeToString(SourceType source) {
|
| +const char* NetLog::SourceTypeToString(NetLogSourceType source) {
|
| switch (source) {
|
| #define SOURCE_TYPE(label) \
|
| - case SOURCE_##label: \
|
| + case NetLogSourceType::label: \
|
| return #label;
|
| #include "net/log/net_log_source_type_list.h"
|
| #undef SOURCE_TYPE
|
| @@ -340,20 +341,20 @@ const char* NetLog::SourceTypeToString(SourceType source) {
|
| // static
|
| base::Value* NetLog::GetSourceTypesAsValue() {
|
| std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
|
| - for (int i = 0; i < SOURCE_COUNT; ++i) {
|
| - dict->SetInteger(SourceTypeToString(static_cast<SourceType>(i)), i);
|
| + for (int i = 0; i < static_cast<int>(NetLogSourceType::COUNT); ++i) {
|
| + dict->SetInteger(SourceTypeToString(static_cast<NetLogSourceType>(i)), i);
|
| }
|
| return dict.release();
|
| }
|
|
|
| // static
|
| -const char* NetLog::EventPhaseToString(EventPhase phase) {
|
| +const char* NetLog::EventPhaseToString(NetLogEventPhase phase) {
|
| switch (phase) {
|
| - case PHASE_BEGIN:
|
| + case NetLogEventPhase::BEGIN:
|
| return "PHASE_BEGIN";
|
| - case PHASE_END:
|
| + case NetLogEventPhase::END:
|
| return "PHASE_END";
|
| - case PHASE_NONE:
|
| + case NetLogEventPhase::NONE:
|
| return "PHASE_NONE";
|
| }
|
| NOTREACHED();
|
| @@ -397,9 +398,9 @@ NetLog::ParametersCallback NetLog::StringCallback(const char* name,
|
| return base::Bind(&NetLogString16Callback, name, value);
|
| }
|
|
|
| -void NetLog::AddEntry(EventType type,
|
| +void NetLog::AddEntry(NetLogEventType type,
|
| const Source& source,
|
| - EventPhase phase,
|
| + NetLogEventPhase phase,
|
| const NetLog::ParametersCallback* parameters_callback) {
|
| if (!IsCapturing())
|
| return;
|
| @@ -415,8 +416,8 @@ BoundNetLog::~BoundNetLog() {
|
| liveness_ = DEAD;
|
| }
|
|
|
| -void BoundNetLog::AddEntry(NetLog::EventType type,
|
| - NetLog::EventPhase phase) const {
|
| +void BoundNetLog::AddEntry(NetLogEventType type,
|
| + NetLogEventPhase phase) const {
|
| CrashIfInvalid();
|
|
|
| if (!net_log_)
|
| @@ -425,8 +426,8 @@ void BoundNetLog::AddEntry(NetLog::EventType type,
|
| }
|
|
|
| void BoundNetLog::AddEntry(
|
| - NetLog::EventType type,
|
| - NetLog::EventPhase phase,
|
| + NetLogEventType type,
|
| + NetLogEventPhase phase,
|
| const NetLog::ParametersCallback& get_parameters) const {
|
| CrashIfInvalid();
|
|
|
| @@ -435,37 +436,37 @@ void BoundNetLog::AddEntry(
|
| net_log_->AddEntry(type, source_, phase, &get_parameters);
|
| }
|
|
|
| -void BoundNetLog::AddEvent(NetLog::EventType type) const {
|
| - AddEntry(type, NetLog::PHASE_NONE);
|
| +void BoundNetLog::AddEvent(NetLogEventType type) const {
|
| + AddEntry(type, NetLogEventPhase::NONE);
|
| }
|
|
|
| void BoundNetLog::AddEvent(
|
| - NetLog::EventType type,
|
| + NetLogEventType type,
|
| const NetLog::ParametersCallback& get_parameters) const {
|
| - AddEntry(type, NetLog::PHASE_NONE, get_parameters);
|
| + AddEntry(type, NetLogEventPhase::NONE, get_parameters);
|
| }
|
|
|
| -void BoundNetLog::BeginEvent(NetLog::EventType type) const {
|
| - AddEntry(type, NetLog::PHASE_BEGIN);
|
| +void BoundNetLog::BeginEvent(NetLogEventType type) const {
|
| + AddEntry(type, NetLogEventPhase::BEGIN);
|
| }
|
|
|
| void BoundNetLog::BeginEvent(
|
| - NetLog::EventType type,
|
| + NetLogEventType type,
|
| const NetLog::ParametersCallback& get_parameters) const {
|
| - AddEntry(type, NetLog::PHASE_BEGIN, get_parameters);
|
| + AddEntry(type, NetLogEventPhase::BEGIN, get_parameters);
|
| }
|
|
|
| -void BoundNetLog::EndEvent(NetLog::EventType type) const {
|
| - AddEntry(type, NetLog::PHASE_END);
|
| +void BoundNetLog::EndEvent(NetLogEventType type) const {
|
| + AddEntry(type, NetLogEventPhase::END);
|
| }
|
|
|
| void BoundNetLog::EndEvent(
|
| - NetLog::EventType type,
|
| + NetLogEventType type,
|
| const NetLog::ParametersCallback& get_parameters) const {
|
| - AddEntry(type, NetLog::PHASE_END, get_parameters);
|
| + AddEntry(type, NetLogEventPhase::END, get_parameters);
|
| }
|
|
|
| -void BoundNetLog::AddEventWithNetErrorCode(NetLog::EventType event_type,
|
| +void BoundNetLog::AddEventWithNetErrorCode(NetLogEventType event_type,
|
| int net_error) const {
|
| DCHECK_NE(ERR_IO_PENDING, net_error);
|
| if (net_error >= 0) {
|
| @@ -475,7 +476,7 @@ void BoundNetLog::AddEventWithNetErrorCode(NetLog::EventType event_type,
|
| }
|
| }
|
|
|
| -void BoundNetLog::EndEventWithNetErrorCode(NetLog::EventType event_type,
|
| +void BoundNetLog::EndEventWithNetErrorCode(NetLogEventType event_type,
|
| int net_error) const {
|
| DCHECK_NE(ERR_IO_PENDING, net_error);
|
| if (net_error >= 0) {
|
| @@ -485,7 +486,7 @@ void BoundNetLog::EndEventWithNetErrorCode(NetLog::EventType event_type,
|
| }
|
| }
|
|
|
| -void BoundNetLog::AddByteTransferEvent(NetLog::EventType event_type,
|
| +void BoundNetLog::AddByteTransferEvent(NetLogEventType event_type,
|
| int byte_count,
|
| const char* bytes) const {
|
| AddEvent(event_type, base::Bind(BytesTransferredCallback, byte_count, bytes));
|
| @@ -497,7 +498,7 @@ bool BoundNetLog::IsCapturing() const {
|
| }
|
|
|
| // static
|
| -BoundNetLog BoundNetLog::Make(NetLog* net_log, NetLog::SourceType source_type) {
|
| +BoundNetLog BoundNetLog::Make(NetLog* net_log, NetLogSourceType source_type) {
|
| if (!net_log)
|
| return BoundNetLog();
|
|
|
|
|