1ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen// Copyright (c) 2011 The Chromium Authors. All rights reserved. 2c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Use of this source code is governed by a BSD-style license that can be 3c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// found in the LICENSE file. 4c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 5c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#include "net/base/net_log.h" 63f50c38dc070f4bb515c1b64450dae14f316474eKristian Monsen 73345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick#include "base/logging.h" 83345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick#include "base/string_number_conversions.h" 9c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#include "base/time.h" 103345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick#include "base/utf_string_conversions.h" 11c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#include "base/values.h" 123f50c38dc070f4bb515c1b64450dae14f316474eKristian Monsen#include "net/base/net_errors.h" 13c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 14c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochnamespace net { 15c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 163345a6884c488ff3a535c2c9acdd33d74b37e311Iain MerrickValue* NetLog::Source::ToValue() const { 173345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick DictionaryValue* dict = new DictionaryValue(); 183345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick dict->SetInteger("type", static_cast<int>(type)); 193345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick dict->SetInteger("id", static_cast<int>(id)); 203345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick return dict; 213345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick} 223345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick 23c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// static 24731df977c0511bca2206b5f333555b1205ff1f43Iain Merrickstd::string NetLog::TickCountToString(const base::TimeTicks& time) { 25731df977c0511bca2206b5f333555b1205ff1f43Iain Merrick int64 delta_time = (time - base::TimeTicks()).InMilliseconds(); 26731df977c0511bca2206b5f333555b1205ff1f43Iain Merrick return base::Int64ToString(delta_time); 27731df977c0511bca2206b5f333555b1205ff1f43Iain Merrick} 28731df977c0511bca2206b5f333555b1205ff1f43Iain Merrick 29731df977c0511bca2206b5f333555b1205ff1f43Iain Merrick// static 30c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochconst char* NetLog::EventTypeToString(EventType event) { 31c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch switch (event) { 32c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#define EVENT_TYPE(label) case TYPE_ ## label: return #label; 33c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#include "net/base/net_log_event_type_list.h" 34c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#undef EVENT_TYPE 35c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch } 36c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch return NULL; 37c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch} 38c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 39c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// static 40c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochstd::vector<NetLog::EventType> NetLog::GetAllEventTypes() { 41c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch std::vector<NetLog::EventType> types; 42c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#define EVENT_TYPE(label) types.push_back(TYPE_ ## label); 43c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#include "net/base/net_log_event_type_list.h" 44c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#undef EVENT_TYPE 45c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch return types; 46c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch} 47c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 483345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick// static 493345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrickconst char* NetLog::SourceTypeToString(SourceType source) { 503345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick switch (source) { 513345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick#define SOURCE_TYPE(label, id) case id: return #label; 523345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick#include "net/base/net_log_source_type_list.h" 533345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick#undef SOURCE_TYPE 543345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick } 553345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick NOTREACHED(); 563345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick return NULL; 573345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick} 583345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick 593345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick// static 603345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrickconst char* NetLog::EventPhaseToString(EventPhase phase) { 613345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick switch (phase) { 623345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick case PHASE_BEGIN: 633345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick return "PHASE_BEGIN"; 643345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick case PHASE_END: 653345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick return "PHASE_END"; 663345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick case PHASE_NONE: 673345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick return "PHASE_NONE"; 683345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick } 693345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick NOTREACHED(); 703345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick return NULL; 713345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick} 723345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick 733345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick// static 74ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian MonsenValue* NetLog::EntryToDictionaryValue(NetLog::EventType type, 753345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick const base::TimeTicks& time, 76ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen const NetLog::Source& source, 77ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen NetLog::EventPhase phase, 78ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen NetLog::EventParameters* params, 793345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick bool use_strings) { 803345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick DictionaryValue* entry_dict = new DictionaryValue(); 813345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick 82731df977c0511bca2206b5f333555b1205ff1f43Iain Merrick entry_dict->SetString("time", TickCountToString(time)); 833345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick 843345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick // Set the entry source. 853345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick DictionaryValue* source_dict = new DictionaryValue(); 863345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick source_dict->SetInteger("id", source.id); 873345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick if (!use_strings) { 883345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick source_dict->SetInteger("type", static_cast<int>(source.type)); 893345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick } else { 903345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick source_dict->SetString("type", 91ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen NetLog::SourceTypeToString(source.type)); 923345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick } 933345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick entry_dict->Set("source", source_dict); 943345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick 953345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick // Set the event info. 963345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick if (!use_strings) { 973345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick entry_dict->SetInteger("type", static_cast<int>(type)); 983345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick entry_dict->SetInteger("phase", static_cast<int>(phase)); 993345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick } else { 100ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen entry_dict->SetString("type", NetLog::EventTypeToString(type)); 101ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen entry_dict->SetString("phase", NetLog::EventPhaseToString(phase)); 1023345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick } 1033345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick 1043345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick // Set the event-specific parameters. 1053345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick if (params) 1063345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick entry_dict->Set("params", params->ToValue()); 1073345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick 1083345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick return entry_dict; 1093345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick} 1103345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick 111c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochvoid BoundNetLog::AddEntry( 112c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch NetLog::EventType type, 113c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch NetLog::EventPhase phase, 114c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch const scoped_refptr<NetLog::EventParameters>& params) const { 115c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch if (net_log_) { 116c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch net_log_->AddEntry(type, base::TimeTicks::Now(), source_, phase, params); 117c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch } 118c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch} 119c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 120c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochvoid BoundNetLog::AddEntryWithTime( 121c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch NetLog::EventType type, 122c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch const base::TimeTicks& time, 123c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch NetLog::EventPhase phase, 124c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch const scoped_refptr<NetLog::EventParameters>& params) const { 125c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch if (net_log_) { 126c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch net_log_->AddEntry(type, time, source_, phase, params); 127c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch } 128c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch} 129c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 130c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochvoid BoundNetLog::AddEvent( 131c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch NetLog::EventType event_type, 132c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch const scoped_refptr<NetLog::EventParameters>& params) const { 133c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch AddEntry(event_type, NetLog::PHASE_NONE, params); 134c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch} 135c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 136c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochvoid BoundNetLog::BeginEvent( 137c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch NetLog::EventType event_type, 138c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch const scoped_refptr<NetLog::EventParameters>& params) const { 139c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch AddEntry(event_type, NetLog::PHASE_BEGIN, params); 140c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch} 141c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 142c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochvoid BoundNetLog::EndEvent( 143c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch NetLog::EventType event_type, 144c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch const scoped_refptr<NetLog::EventParameters>& params) const { 145c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch AddEntry(event_type, NetLog::PHASE_END, params); 146c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch} 147c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 1483f50c38dc070f4bb515c1b64450dae14f316474eKristian Monsenvoid BoundNetLog::EndEventWithNetErrorCode(NetLog::EventType event_type, 1493f50c38dc070f4bb515c1b64450dae14f316474eKristian Monsen int net_error) const { 150ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen DCHECK_NE(net_error, ERR_IO_PENDING); 1513f50c38dc070f4bb515c1b64450dae14f316474eKristian Monsen if (net_error >= 0) { 1523f50c38dc070f4bb515c1b64450dae14f316474eKristian Monsen EndEvent(event_type, NULL); 1533f50c38dc070f4bb515c1b64450dae14f316474eKristian Monsen } else { 1543f50c38dc070f4bb515c1b64450dae14f316474eKristian Monsen EndEvent( 1553f50c38dc070f4bb515c1b64450dae14f316474eKristian Monsen event_type, 1563f50c38dc070f4bb515c1b64450dae14f316474eKristian Monsen make_scoped_refptr(new NetLogIntegerParameter("net_error", net_error))); 1573f50c38dc070f4bb515c1b64450dae14f316474eKristian Monsen } 1583f50c38dc070f4bb515c1b64450dae14f316474eKristian Monsen} 1593f50c38dc070f4bb515c1b64450dae14f316474eKristian Monsen 16072a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian MonsenNetLog::LogLevel BoundNetLog::GetLogLevel() const { 16172a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen if (net_log_) 16272a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen return net_log_->GetLogLevel(); 16372a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen return NetLog::LOG_BASIC; 16472a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen} 16572a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen 16672a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsenbool BoundNetLog::IsLoggingBytes() const { 16772a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen return GetLogLevel() == NetLog::LOG_ALL; 16872a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen} 16972a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen 17072a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsenbool BoundNetLog::IsLoggingAllEvents() const { 17172a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen return GetLogLevel() <= NetLog::LOG_ALL_BUT_BYTES; 17272a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen} 17372a454cd3513ac24fbdd0e0cb9ad70b86a99b801Kristian Monsen 174c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// static 175c407dc5cd9bdc5668497f21b26b09d988ab439deBen MurdochBoundNetLog BoundNetLog::Make(NetLog* net_log, 176c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch NetLog::SourceType source_type) { 177c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch if (!net_log) 178c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch return BoundNetLog(); 179c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 180c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch NetLog::Source source(source_type, net_log->NextID()); 181c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch return BoundNetLog(source, net_log); 182c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch} 183c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 184c407dc5cd9bdc5668497f21b26b09d988ab439deBen MurdochNetLogStringParameter::NetLogStringParameter(const char* name, 185c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch const std::string& value) 186c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch : name_(name), value_(value) { 187c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch} 188c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 1893345a6884c488ff3a535c2c9acdd33d74b37e311Iain MerrickNetLogStringParameter::~NetLogStringParameter() { 1903345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick} 1913345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick 192c407dc5cd9bdc5668497f21b26b09d988ab439deBen MurdochValue* NetLogIntegerParameter::ToValue() const { 193c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch DictionaryValue* dict = new DictionaryValue(); 1943345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick dict->SetInteger(name_, value_); 195c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch return dict; 196c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch} 197c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 198c407dc5cd9bdc5668497f21b26b09d988ab439deBen MurdochValue* NetLogStringParameter::ToValue() const { 199c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch DictionaryValue* dict = new DictionaryValue(); 2003345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick dict->SetString(name_, value_); 201c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch return dict; 202c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch} 203c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 204c407dc5cd9bdc5668497f21b26b09d988ab439deBen MurdochValue* NetLogSourceParameter::ToValue() const { 205c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch DictionaryValue* dict = new DictionaryValue(); 206c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 2073345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick dict->Set(name_, value_.ToValue()); 208c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch return dict; 209c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch} 210c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 21121d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian MonsenScopedNetLogEvent::ScopedNetLogEvent( 21221d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen const BoundNetLog& net_log, 21321d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen NetLog::EventType event_type, 21421d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen const scoped_refptr<NetLog::EventParameters>& params) 21521d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen : net_log_(net_log), 21621d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen event_type_(event_type) { 21721d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen net_log_.BeginEvent(event_type, params); 21821d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen} 21921d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen 22021d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian MonsenScopedNetLogEvent::~ScopedNetLogEvent() { 22121d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen net_log_.EndEvent(event_type_, end_event_params_); 22221d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen} 22321d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen 22421d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsenvoid ScopedNetLogEvent::SetEndEventParameters( 22521d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen const scoped_refptr<NetLog::EventParameters>& end_event_params) { 22621d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen DCHECK(!end_event_params_.get()); 22721d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen end_event_params_ = end_event_params; 22821d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen} 22921d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen 23021d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsenconst BoundNetLog& ScopedNetLogEvent::net_log() const { 23121d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen return net_log_; 23221d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen} 23321d179b334e59e9a3bfcaed4c4430bef1bc5759dKristian Monsen 234c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch} // namespace net 235