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

Unified Diff: net/disk_cache/net_log_parameters.cc

Issue 1135373002: Updated NetLog::ParametersCallback & all related calbacks returning value as scoped_ptr<base::Value… Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « net/disk_cache/memory/mem_entry_impl.cc ('k') | net/disk_cache/simple/simple_net_log_parameters.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/net_log_parameters.cc
diff --git a/net/disk_cache/net_log_parameters.cc b/net/disk_cache/net_log_parameters.cc
index b13f916682e00191376591cc4aeb7c209da91401..2725536f6f24c6649d4f396c21387c4e93dd7ef3 100644
--- a/net/disk_cache/net_log_parameters.cc
+++ b/net/disk_cache/net_log_parameters.cc
@@ -13,78 +13,78 @@
namespace {
-base::Value* NetLogEntryCreationCallback(
+scoped_ptr<base::Value> NetLogEntryCreationCallback(
const disk_cache::Entry* entry,
bool created,
net::NetLogCaptureMode /* capture_mode */) {
- base::DictionaryValue* dict = new base::DictionaryValue();
+ scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetString("key", entry->GetKey());
dict->SetBoolean("created", created);
- return dict;
+ return dict.Pass();
}
-base::Value* NetLogReadWriteDataCallback(
+scoped_ptr<base::Value> NetLogReadWriteDataCallback(
int index,
int offset,
int buf_len,
bool truncate,
net::NetLogCaptureMode /* capture_mode */) {
- base::DictionaryValue* dict = new base::DictionaryValue();
+ scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetInteger("index", index);
dict->SetInteger("offset", offset);
dict->SetInteger("buf_len", buf_len);
if (truncate)
dict->SetBoolean("truncate", truncate);
- return dict;
+ return dict.Pass();
}
-base::Value* NetLogReadWriteCompleteCallback(
+scoped_ptr<base::Value> NetLogReadWriteCompleteCallback(
int bytes_copied,
net::NetLogCaptureMode /* capture_mode */) {
DCHECK_NE(bytes_copied, net::ERR_IO_PENDING);
- base::DictionaryValue* dict = new base::DictionaryValue();
+ scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
if (bytes_copied < 0) {
dict->SetInteger("net_error", bytes_copied);
} else {
dict->SetInteger("bytes_copied", bytes_copied);
}
- return dict;
+ return dict.Pass();
}
-base::Value* NetLogSparseOperationCallback(
+scoped_ptr<base::Value> NetLogSparseOperationCallback(
int64 offset,
int buff_len,
net::NetLogCaptureMode /* capture_mode */) {
- base::DictionaryValue* dict = new base::DictionaryValue();
+ scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
// Values can only be created with at most 32-bit integers. Using a string
// instead circumvents that restriction.
dict->SetString("offset", base::Int64ToString(offset));
dict->SetInteger("buff_len", buff_len);
- return dict;
+ return dict.Pass();
}
-base::Value* NetLogSparseReadWriteCallback(
+scoped_ptr<base::Value> NetLogSparseReadWriteCallback(
const net::NetLog::Source& source,
int child_len,
net::NetLogCaptureMode /* capture_mode */) {
- base::DictionaryValue* dict = new base::DictionaryValue();
- source.AddToEventParameters(dict);
+ scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
+ source.AddToEventParameters(dict.release());
dict->SetInteger("child_len", child_len);
- return dict;
+ return dict.Pass();
}
-base::Value* NetLogGetAvailableRangeResultCallback(
+scoped_ptr<base::Value> NetLogGetAvailableRangeResultCallback(
int64 start,
int result,
net::NetLogCaptureMode /* capture_mode */) {
- base::DictionaryValue* dict = new base::DictionaryValue();
+ scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
if (result > 0) {
dict->SetInteger("length", result);
dict->SetString("start", base::Int64ToString(start));
} else {
dict->SetInteger("net_error", result);
}
- return dict;
+ return dict.Pass();
}
} // namespace
@@ -95,7 +95,7 @@ net::NetLog::ParametersCallback CreateNetLogEntryCreationCallback(
const Entry* entry,
bool created) {
DCHECK(entry);
- return base::Bind(&NetLogEntryCreationCallback, entry, created);
+ return base::Bind(NetLogEntryCreationCallback, entry, created);
}
net::NetLog::ParametersCallback CreateNetLogReadWriteDataCallback(
@@ -103,31 +103,31 @@ net::NetLog::ParametersCallback CreateNetLogReadWriteDataCallback(
int offset,
int buf_len,
bool truncate) {
- return base::Bind(&NetLogReadWriteDataCallback,
- index, offset, buf_len, truncate);
+ return base::Bind(NetLogReadWriteDataCallback, index, offset, buf_len,
+ truncate);
}
net::NetLog::ParametersCallback CreateNetLogReadWriteCompleteCallback(
int bytes_copied) {
- return base::Bind(&NetLogReadWriteCompleteCallback, bytes_copied);
+ return base::Bind(NetLogReadWriteCompleteCallback, bytes_copied);
}
net::NetLog::ParametersCallback CreateNetLogSparseOperationCallback(
int64 offset,
int buff_len) {
- return base::Bind(&NetLogSparseOperationCallback, offset, buff_len);
+ return base::Bind(NetLogSparseOperationCallback, offset, buff_len);
}
net::NetLog::ParametersCallback CreateNetLogSparseReadWriteCallback(
const net::NetLog::Source& source,
int child_len) {
- return base::Bind(&NetLogSparseReadWriteCallback, source, child_len);
+ return base::Bind(NetLogSparseReadWriteCallback, source, child_len);
}
net::NetLog::ParametersCallback CreateNetLogGetAvailableRangeResultCallback(
int64 start,
int result) {
- return base::Bind(&NetLogGetAvailableRangeResultCallback, start, result);
+ return base::Bind(NetLogGetAvailableRangeResultCallback, start, result);
}
} // namespace disk_cache
« no previous file with comments | « net/disk_cache/memory/mem_entry_impl.cc ('k') | net/disk_cache/simple/simple_net_log_parameters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698