| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/format_macros.h" | 11 #include "base/format_macros.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
| 16 #include "net/disk_cache/simple/simple_entry_impl.h" | 16 #include "net/disk_cache/simple/simple_entry_impl.h" |
| 17 #include "net/log/net_log_capture_mode.h" |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 std::unique_ptr<base::Value> NetLogSimpleEntryConstructionCallback( | 21 std::unique_ptr<base::Value> NetLogSimpleEntryConstructionCallback( |
| 21 const disk_cache::SimpleEntryImpl* entry, | 22 const disk_cache::SimpleEntryImpl* entry, |
| 22 net::NetLogCaptureMode capture_mode) { | 23 net::NetLogCaptureMode capture_mode) { |
| 23 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 24 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 24 dict->SetString("entry_hash", | 25 dict->SetString("entry_hash", |
| 25 base::StringPrintf("%#016" PRIx64, entry->entry_hash())); | 26 base::StringPrintf("%#016" PRIx64, entry->entry_hash())); |
| 26 return std::move(dict); | 27 return std::move(dict); |
| 27 } | 28 } |
| 28 | 29 |
| 29 std::unique_ptr<base::Value> NetLogSimpleEntryCreationCallback( | 30 std::unique_ptr<base::Value> NetLogSimpleEntryCreationCallback( |
| 30 const disk_cache::SimpleEntryImpl* entry, | 31 const disk_cache::SimpleEntryImpl* entry, |
| 31 int net_error, | 32 int net_error, |
| 32 net::NetLogCaptureMode /* capture_mode */) { | 33 net::NetLogCaptureMode /* capture_mode */) { |
| 33 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 34 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 34 dict->SetInteger("net_error", net_error); | 35 dict->SetInteger("net_error", net_error); |
| 35 if (net_error == net::OK) | 36 if (net_error == net::OK) |
| 36 dict->SetString("key", entry->key()); | 37 dict->SetString("key", entry->key()); |
| 37 return std::move(dict); | 38 return std::move(dict); |
| 38 } | 39 } |
| 39 | 40 |
| 40 } // namespace | 41 } // namespace |
| 41 | 42 |
| 42 namespace disk_cache { | 43 namespace disk_cache { |
| 43 | 44 |
| 44 net::NetLog::ParametersCallback CreateNetLogSimpleEntryConstructionCallback( | 45 net::NetLogParametersCallback CreateNetLogSimpleEntryConstructionCallback( |
| 45 const SimpleEntryImpl* entry) { | 46 const SimpleEntryImpl* entry) { |
| 46 DCHECK(entry); | 47 DCHECK(entry); |
| 47 return base::Bind(&NetLogSimpleEntryConstructionCallback, entry); | 48 return base::Bind(&NetLogSimpleEntryConstructionCallback, entry); |
| 48 } | 49 } |
| 49 | 50 |
| 50 net::NetLog::ParametersCallback CreateNetLogSimpleEntryCreationCallback( | 51 net::NetLogParametersCallback CreateNetLogSimpleEntryCreationCallback( |
| 51 const SimpleEntryImpl* entry, | 52 const SimpleEntryImpl* entry, |
| 52 int net_error) { | 53 int net_error) { |
| 53 DCHECK(entry); | 54 DCHECK(entry); |
| 54 return base::Bind(&NetLogSimpleEntryCreationCallback, entry, net_error); | 55 return base::Bind(&NetLogSimpleEntryCreationCallback, entry, net_error); |
| 55 } | 56 } |
| 56 | 57 |
| 57 } // namespace disk_cache | 58 } // namespace disk_cache |
| OLD | NEW |