| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/disk_cache/simple/simple_net_log_parameters.h" | 5 #include "net/disk_cache/simple/simple_net_log_parameters.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
| 14 #include "net/disk_cache/simple/simple_entry_impl.h" | 14 #include "net/disk_cache/simple/simple_entry_impl.h" |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 base::Value* NetLogSimpleEntryConstructionCallback( | 18 scoped_ptr<base::Value> NetLogSimpleEntryConstructionCallback( |
| 19 const disk_cache::SimpleEntryImpl* entry, | 19 const disk_cache::SimpleEntryImpl* entry, |
| 20 net::NetLogCaptureMode capture_mode) { | 20 net::NetLogCaptureMode capture_mode) { |
| 21 base::DictionaryValue* dict = new base::DictionaryValue(); | 21 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 22 dict->SetString("entry_hash", | 22 dict->SetString("entry_hash", |
| 23 base::StringPrintf("%#016" PRIx64, entry->entry_hash())); | 23 base::StringPrintf("%#016" PRIx64, entry->entry_hash())); |
| 24 return dict; | 24 return dict.Pass(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 base::Value* NetLogSimpleEntryCreationCallback( | 27 scoped_ptr<base::Value> NetLogSimpleEntryCreationCallback( |
| 28 const disk_cache::SimpleEntryImpl* entry, | 28 const disk_cache::SimpleEntryImpl* entry, |
| 29 int net_error, | 29 int net_error, |
| 30 net::NetLogCaptureMode /* capture_mode */) { | 30 net::NetLogCaptureMode /* capture_mode */) { |
| 31 base::DictionaryValue* dict = new base::DictionaryValue(); | 31 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 32 dict->SetInteger("net_error", net_error); | 32 dict->SetInteger("net_error", net_error); |
| 33 if (net_error == net::OK) | 33 if (net_error == net::OK) |
| 34 dict->SetString("key", entry->key()); | 34 dict->SetString("key", entry->key()); |
| 35 return dict; | 35 return dict.Pass(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 } // namespace | 38 } // namespace |
| 39 | 39 |
| 40 namespace disk_cache { | 40 namespace disk_cache { |
| 41 | 41 |
| 42 net::NetLog::ParametersCallback CreateNetLogSimpleEntryConstructionCallback( | 42 net::NetLog::ParametersCallback CreateNetLogSimpleEntryConstructionCallback( |
| 43 const SimpleEntryImpl* entry) { | 43 const SimpleEntryImpl* entry) { |
| 44 DCHECK(entry); | 44 DCHECK(entry); |
| 45 return base::Bind(&NetLogSimpleEntryConstructionCallback, entry); | 45 return base::Bind(NetLogSimpleEntryConstructionCallback, entry); |
| 46 } | 46 } |
| 47 | 47 |
| 48 net::NetLog::ParametersCallback CreateNetLogSimpleEntryCreationCallback( | 48 net::NetLog::ParametersCallback CreateNetLogSimpleEntryCreationCallback( |
| 49 const SimpleEntryImpl* entry, | 49 const SimpleEntryImpl* entry, |
| 50 int net_error) { | 50 int net_error) { |
| 51 DCHECK(entry); | 51 DCHECK(entry); |
| 52 return base::Bind(&NetLogSimpleEntryCreationCallback, entry, net_error); | 52 return base::Bind(NetLogSimpleEntryCreationCallback, entry, net_error); |
| 53 } | 53 } |
| 54 | 54 |
| 55 } // namespace disk_cache | 55 } // namespace disk_cache |
| OLD | NEW |