| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/log/net_log.h" | 5 #include "net/log/net_log.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/alias.h" | 8 #include "base/debug/alias.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 // Returns parameters for logging data transferred events. At a minum includes | 20 // Returns parameters for logging data transferred events. At a minimum includes |
| 21 // the number of bytes transferred. If the capture mode allows logging byte | 21 // the number of bytes transferred. If the capture mode allows logging byte |
| 22 // contents and |byte_count| > 0, then will include the actual bytes. The | 22 // contents and |byte_count| > 0, then will include the actual bytes. The |
| 23 // bytes are hex-encoded, since base::StringValue only supports UTF-8. | 23 // bytes are hex-encoded, since base::StringValue only supports UTF-8. |
| 24 base::Value* BytesTransferredCallback(int byte_count, | 24 base::Value* BytesTransferredCallback(int byte_count, |
| 25 const char* bytes, | 25 const char* bytes, |
| 26 NetLogCaptureMode capture_mode) { | 26 NetLogCaptureMode capture_mode) { |
| 27 base::DictionaryValue* dict = new base::DictionaryValue(); | 27 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 28 dict->SetInteger("byte_count", byte_count); | 28 dict->SetInteger("byte_count", byte_count); |
| 29 if (capture_mode.include_socket_bytes() && byte_count > 0) | 29 if (capture_mode.include_socket_bytes() && byte_count > 0) |
| 30 dict->SetString("hex_encoded_bytes", base::HexEncode(bytes, byte_count)); | 30 dict->SetString("hex_encoded_bytes", base::HexEncode(bytes, byte_count)); |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 Liveness liveness = liveness_; | 478 Liveness liveness = liveness_; |
| 479 | 479 |
| 480 if (liveness == ALIVE) | 480 if (liveness == ALIVE) |
| 481 return; | 481 return; |
| 482 | 482 |
| 483 base::debug::Alias(&liveness); | 483 base::debug::Alias(&liveness); |
| 484 CHECK_EQ(ALIVE, liveness); | 484 CHECK_EQ(ALIVE, liveness); |
| 485 } | 485 } |
| 486 | 486 |
| 487 } // namespace net | 487 } // namespace net |
| OLD | NEW |