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

Side by Side Diff: net/log/net_log_with_source.cc

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_with_source.h" 5 #include "net/log/net_log_with_source.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/debug/alias.h" 11 #include "base/debug/alias.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.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/log/net_log.h" 16 #include "net/log/net_log.h"
17 #include "net/log/net_log_capture_mode.h" 17 #include "net/log/net_log_capture_mode.h"
18 18
19 namespace net { 19 namespace net {
20 20
21 namespace { 21 namespace {
22 22
23 // Returns parameters for logging data transferred events. At a minimum includes 23 // Returns parameters for logging data transferred events. At a minimum includes
24 // the number of bytes transferred. If the capture mode allows logging byte 24 // the number of bytes transferred. If the capture mode allows logging byte
25 // contents and |byte_count| > 0, then will include the actual bytes. The 25 // contents and |byte_count| > 0, then will include the actual bytes. The
26 // bytes are hex-encoded, since base::StringValue only supports UTF-8. 26 // bytes are hex-encoded, since base::Value only supports UTF-8.
27 std::unique_ptr<base::Value> BytesTransferredCallback( 27 std::unique_ptr<base::Value> BytesTransferredCallback(
28 int byte_count, 28 int byte_count,
29 const char* bytes, 29 const char* bytes,
30 NetLogCaptureMode capture_mode) { 30 NetLogCaptureMode capture_mode) {
31 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 31 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
32 dict->SetInteger("byte_count", byte_count); 32 dict->SetInteger("byte_count", byte_count);
33 if (capture_mode.include_socket_bytes() && byte_count > 0) 33 if (capture_mode.include_socket_bytes() && byte_count > 0)
34 dict->SetString("hex_encoded_bytes", base::HexEncode(bytes, byte_count)); 34 dict->SetString("hex_encoded_bytes", base::HexEncode(bytes, byte_count));
35 return std::move(dict); 35 return std::move(dict);
36 } 36 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 Liveness liveness = liveness_; 136 Liveness liveness = liveness_;
137 137
138 if (liveness == ALIVE) 138 if (liveness == ALIVE)
139 return; 139 return;
140 140
141 base::debug::Alias(&liveness); 141 base::debug::Alias(&liveness);
142 CHECK_EQ(ALIVE, liveness); 142 CHECK_EQ(ALIVE, liveness);
143 } 143 }
144 144
145 } // namespace net 145 } // namespace net
OLDNEW
« no previous file with comments | « net/log/file_net_log_observer_unittest.cc ('k') | net/log/write_to_file_net_log_observer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698