Index: net/log/net_log.cc |
diff --git a/net/log/net_log.cc b/net/log/net_log.cc |
index 01f2446a7ccbb64d77c3d84c8f5d704cebe53a69..01e7fca84c83c2bc2db93ad1e3d098cbee671ea0 100644 |
--- a/net/log/net_log.cc |
+++ b/net/log/net_log.cc |
@@ -21,64 +21,70 @@ namespace { |
// the number of bytes transferred. If the capture mode allows logging byte |
// contents and |byte_count| > 0, then will include the actual bytes. The |
// bytes are hex-encoded, since base::StringValue only supports UTF-8. |
-base::Value* BytesTransferredCallback(int byte_count, |
- const char* bytes, |
- NetLogCaptureMode capture_mode) { |
- base::DictionaryValue* dict = new base::DictionaryValue(); |
+scoped_ptr<base::Value> BytesTransferredCallback( |
+ int byte_count, |
+ const char* bytes, |
+ NetLogCaptureMode capture_mode) { |
+ scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
dict->SetInteger("byte_count", byte_count); |
if (capture_mode.include_socket_bytes() && byte_count > 0) |
dict->SetString("hex_encoded_bytes", base::HexEncode(bytes, byte_count)); |
- return dict; |
+ return dict.Pass(); |
} |
-base::Value* SourceEventParametersCallback( |
+scoped_ptr<base::Value> SourceEventParametersCallback( |
const NetLog::Source source, |
NetLogCaptureMode /* capture_mode */) { |
if (!source.IsValid()) |
return NULL; |
- base::DictionaryValue* event_params = new base::DictionaryValue(); |
- source.AddToEventParameters(event_params); |
- return event_params; |
+ scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue()); |
+ source.AddToEventParameters(event_params.release()); |
+ return event_params.Pass(); |
} |
-base::Value* NetLogBoolCallback(const char* name, |
- bool value, |
- NetLogCaptureMode /* capture_mode */) { |
- base::DictionaryValue* event_params = new base::DictionaryValue(); |
+scoped_ptr<base::Value> NetLogBoolCallback( |
+ const char* name, |
+ bool value, |
+ NetLogCaptureMode /* capture_mode */) { |
+ scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue()); |
event_params->SetBoolean(name, value); |
- return event_params; |
+ return event_params.Pass(); |
} |
-base::Value* NetLogIntegerCallback(const char* name, |
- int value, |
- NetLogCaptureMode /* capture_mode */) { |
- base::DictionaryValue* event_params = new base::DictionaryValue(); |
+scoped_ptr<base::Value> NetLogIntegerCallback( |
+ const char* name, |
+ int value, |
+ NetLogCaptureMode /* capture_mode */) { |
+ scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue()); |
event_params->SetInteger(name, value); |
- return event_params; |
+ return event_params.Pass(); |
} |
-base::Value* NetLogInt64Callback(const char* name, |
- int64 value, |
- NetLogCaptureMode /* capture_mode */) { |
- base::DictionaryValue* event_params = new base::DictionaryValue(); |
+scoped_ptr<base::Value> NetLogInt64Callback( |
+ const char* name, |
+ int64 value, |
+ NetLogCaptureMode /* capture_mode */) { |
+ scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue()); |
event_params->SetString(name, base::Int64ToString(value)); |
- return event_params; |
+ return event_params.Pass(); |
} |
-base::Value* NetLogStringCallback(const char* name, |
- const std::string* value, |
- NetLogCaptureMode /* capture_mode */) { |
- base::DictionaryValue* event_params = new base::DictionaryValue(); |
+scoped_ptr<base::Value> NetLogStringCallback( |
+ const char* name, |
+ const std::string* value, |
+ NetLogCaptureMode /* capture_mode */) { |
+ scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue()); |
event_params->SetString(name, *value); |
- return event_params; |
+ return event_params.Pass(); |
} |
-base::Value* NetLogString16Callback(const char* name, |
- const base::string16* value, |
- NetLogCaptureMode /* capture_mode */) { |
- base::DictionaryValue* event_params = new base::DictionaryValue(); |
+scoped_ptr<base::Value> NetLogString16Callback( |
+ const char* name, |
+ const base::string16* value, |
+ NetLogCaptureMode /* capture_mode */) { |
+ scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue()); |
event_params->SetString(name, *value); |
- return event_params; |
+ return event_params.Pass(); |
} |
} // namespace |
@@ -105,7 +111,7 @@ void NetLog::Source::AddToEventParameters( |
} |
NetLog::ParametersCallback NetLog::Source::ToEventParametersCallback() const { |
- return base::Bind(&SourceEventParametersCallback, *this); |
+ return base::Bind(SourceEventParametersCallback, *this); |
} |
// static |
@@ -129,8 +135,8 @@ bool NetLog::Source::FromEventParameters(base::Value* event_params, |
return true; |
} |
-base::Value* NetLog::Entry::ToValue() const { |
- base::DictionaryValue* entry_dict(new base::DictionaryValue()); |
+scoped_ptr<base::Value> NetLog::Entry::ToValue() const { |
+ scoped_ptr<base::DictionaryValue> entry_dict(new base::DictionaryValue()); |
entry_dict->SetString("time", TickCountToString(data_->time)); |
@@ -152,10 +158,10 @@ base::Value* NetLog::Entry::ToValue() const { |
entry_dict->Set("params", value.Pass()); |
} |
- return entry_dict; |
+ return entry_dict.Pass(); |
} |
-base::Value* NetLog::Entry::ParametersToValue() const { |
+scoped_ptr<base::Value> NetLog::Entry::ParametersToValue() const { |
if (data_->parameters_callback) |
return data_->parameters_callback->Run(capture_mode_); |
return NULL; |
@@ -337,33 +343,33 @@ const char* NetLog::EventPhaseToString(EventPhase phase) { |
// static |
NetLog::ParametersCallback NetLog::BoolCallback(const char* name, bool value) { |
- return base::Bind(&NetLogBoolCallback, name, value); |
+ return base::Bind(NetLogBoolCallback, name, value); |
} |
// static |
NetLog::ParametersCallback NetLog::IntegerCallback(const char* name, |
int value) { |
- return base::Bind(&NetLogIntegerCallback, name, value); |
+ return base::Bind(NetLogIntegerCallback, name, value); |
} |
// static |
NetLog::ParametersCallback NetLog::Int64Callback(const char* name, |
int64 value) { |
- return base::Bind(&NetLogInt64Callback, name, value); |
+ return base::Bind(NetLogInt64Callback, name, value); |
} |
// static |
NetLog::ParametersCallback NetLog::StringCallback(const char* name, |
const std::string* value) { |
DCHECK(value); |
- return base::Bind(&NetLogStringCallback, name, value); |
+ return base::Bind(NetLogStringCallback, name, value); |
} |
// static |
NetLog::ParametersCallback NetLog::StringCallback(const char* name, |
const base::string16* value) { |
DCHECK(value); |
- return base::Bind(&NetLogString16Callback, name, value); |
+ return base::Bind(NetLogString16Callback, name, value); |
} |
void NetLog::AddEntry(EventType type, |