diff options
-rw-r--r-- | net/base/capturing_net_log.cc | 2 | ||||
-rw-r--r-- | net/base/net_log.cc | 14 | ||||
-rw-r--r-- | net/base/net_log.h | 8 | ||||
-rw-r--r-- | net/tools/gdig/file_net_log.cc | 2 | ||||
-rw-r--r-- | net/url_request/url_request_test_util.cc | 1 |
5 files changed, 20 insertions, 7 deletions
diff --git a/net/base/capturing_net_log.cc b/net/base/capturing_net_log.cc index 5132857..eb7f9e5 100644 --- a/net/base/capturing_net_log.cc +++ b/net/base/capturing_net_log.cc @@ -87,7 +87,7 @@ void CapturingNetLog::SetLogLevel(NetLog::LogLevel log_level) { void CapturingNetLog::OnAddEntry(const net::NetLog::Entry& entry) { // Only BoundNetLogs without a NetLog should have an invalid source. - DCHECK(entry.source().is_valid()); + CHECK(entry.source().IsValid()); // Using Dictionaries instead of Values makes checking values a little // simpler. diff --git a/net/base/net_log.cc b/net/base/net_log.cc index 372930d..b811db4 100644 --- a/net/base/net_log.cc +++ b/net/base/net_log.cc @@ -32,7 +32,7 @@ Value* BytesTransferredCallback(int byte_count, Value* SourceEventParametersCallback(const NetLog::Source source, NetLog::LogLevel /* log_level */) { - if (!source.is_valid()) + if (!source.IsValid()) return NULL; DictionaryValue* event_params = new DictionaryValue(); source.AddToEventParameters(event_params); @@ -73,6 +73,18 @@ Value* NetLogString16Callback(const char* name, } // namespace +const uint32 NetLog::Source::kInvalidId = 0; + +NetLog::Source::Source() : type(SOURCE_NONE), id(kInvalidId) { +} + +NetLog::Source::Source(SourceType type, uint32 id) : type(type), id(id) { +} + +bool NetLog::Source::IsValid() const { + return id != kInvalidId; +} + void NetLog::Source::AddToEventParameters(DictionaryValue* event_params) const { DictionaryValue* dict = new DictionaryValue(); dict->SetInteger("type", static_cast<int>(type)); diff --git a/net/base/net_log.h b/net/base/net_log.h index 4d8408a..dc0b1ec 100644 --- a/net/base/net_log.h +++ b/net/base/net_log.h @@ -83,11 +83,11 @@ class NET_EXPORT NetLog { // uniquely identify the source, and is used by log observers to infer // message groupings. Can use NetLog::NextID() to create unique IDs. struct NET_EXPORT Source { - static const uint32 kInvalidId = 0; + static const uint32 kInvalidId; - Source() : type(SOURCE_NONE), id(kInvalidId) {} - Source(SourceType type, uint32 id) : type(type), id(id) {} - bool is_valid() const { return id != kInvalidId; } + Source(); + Source(SourceType type, uint32 id); + bool IsValid() const; // Adds the source to a DictionaryValue containing event parameters, // using the name "source_dependency". diff --git a/net/tools/gdig/file_net_log.cc b/net/tools/gdig/file_net_log.cc index 90967de..51cf78d 100644 --- a/net/tools/gdig/file_net_log.cc +++ b/net/tools/gdig/file_net_log.cc @@ -26,7 +26,7 @@ FileNetLog::~FileNetLog() { void FileNetLog::OnAddEntry(const net::NetLog::Entry& entry) { // Only BoundNetLogs without a NetLog should have an invalid source. - DCHECK(entry.source().is_valid()); + DCHECK(entry.source().IsValid()); const char* source = SourceTypeToString(entry.source().type); const char* type = EventTypeToString(entry.type()); diff --git a/net/url_request/url_request_test_util.cc b/net/url_request/url_request_test_util.cc index 9648b78..9697b1f 100644 --- a/net/url_request/url_request_test_util.cc +++ b/net/url_request/url_request_test_util.cc @@ -100,6 +100,7 @@ void TestURLRequestContext::Init() { params.http_auth_handler_factory = http_auth_handler_factory(); params.network_delegate = network_delegate(); params.http_server_properties = http_server_properties(); + params.net_log = net_log(); if (!http_transaction_factory()) { context_storage_.set_http_transaction_factory(new HttpCache( |