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

Unified Diff: net/udp/udp_data_transfer_param.cc

Issue 8200011: Add NetLog support to UDP sockets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Don't do address conversions on windows when we don't have to. Created 9 years, 2 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
Index: net/udp/udp_data_transfer_param.cc
===================================================================
--- net/udp/udp_data_transfer_param.cc (revision 0)
+++ net/udp/udp_data_transfer_param.cc (revision 0)
@@ -0,0 +1,36 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/string_number_conversions.h"
+#include "base/values.h"
+#include "net/base/ip_endpoint.h"
+#include "net/udp/udp_data_transfer_param.h"
+
+namespace net {
+
+UDPDataTransferNetLogParam::UDPDataTransferNetLogParam(
+ int byte_count,
+ const char* bytes,
+ bool log_bytes,
+ const IPEndPoint* address)
+ : byte_count_(byte_count),
+ hex_encoded_bytes_(log_bytes ? base::HexEncode(bytes, byte_count) : "") {
+ if (address)
+ address_.reset(new IPEndPoint(*address));
+}
+
+UDPDataTransferNetLogParam::~UDPDataTransferNetLogParam() {
+}
+
+Value* UDPDataTransferNetLogParam::ToValue() const {
+ DictionaryValue* dict = new DictionaryValue();
+ dict->SetInteger("byte_count", byte_count_);
+ if (!hex_encoded_bytes_.empty())
+ dict->SetString("hex_encoded_bytes", hex_encoded_bytes_);
+ if (address_.get())
+ dict->SetString("address", address_->ToString());
+ return dict;
+}
+
+} // namespace net
Property changes on: net\udp\udp_data_transfer_param.cc
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698