summaryrefslogtreecommitdiffstats
path: root/net/base
diff options
context:
space:
mode:
Diffstat (limited to 'net/base')
-rw-r--r--net/base/address_list_net_log_param.cc30
-rw-r--r--net/base/address_list_net_log_param.h28
-rw-r--r--net/base/net_log_event_type_list.h2
3 files changed, 59 insertions, 1 deletions
diff --git a/net/base/address_list_net_log_param.cc b/net/base/address_list_net_log_param.cc
new file mode 100644
index 0000000..9143ae9
--- /dev/null
+++ b/net/base/address_list_net_log_param.cc
@@ -0,0 +1,30 @@
+// Copyright (c) 2010 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 "net/base/address_list_net_log_param.h"
+
+#include "base/values.h"
+#include "net/base/net_util.h"
+#include "net/base/sys_addrinfo.h"
+
+namespace net {
+
+AddressListNetLogParam::AddressListNetLogParam(const AddressList& address_list)
+ : address_list_(address_list) {
+}
+
+Value* AddressListNetLogParam::ToValue() const {
+ DictionaryValue* dict = new DictionaryValue();
+ ListValue* list = new ListValue();
+
+ for (const addrinfo* head = address_list_.head();
+ head != NULL ; head = head->ai_next) {
+ list->Append(Value::CreateStringValue(NetAddressToString(head)));
+ }
+
+ dict->Set(L"address_list", list);
+ return dict;
+}
+
+} // namespace
diff --git a/net/base/address_list_net_log_param.h b/net/base/address_list_net_log_param.h
new file mode 100644
index 0000000..2a56961
--- /dev/null
+++ b/net/base/address_list_net_log_param.h
@@ -0,0 +1,28 @@
+// Copyright (c) 2010 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.
+
+#ifndef NET_BASE_ADDRESS_LIST_NET_LOG_PARAM_H_
+#define NET_BASE_ADDRESS_LIST_NET_LOG_PARAM_H_
+
+#include "net/base/address_list.h"
+#include "net/base/net_log.h"
+
+namespace net {
+
+// NetLog parameter to describe an address list.
+// Note that AddressList uses ref-counted data, so this doesn't introduce
+// much of a memory overhead.
+class AddressListNetLogParam : public NetLog::EventParameters {
+ public:
+ explicit AddressListNetLogParam(const AddressList& address_list);
+
+ virtual Value* ToValue() const;
+
+ private:
+ AddressList address_list_;
+};
+
+} // namespace net
+
+#endif // NET_BASE_ADDRESS_LIST_NET_LOG_PARAM_H_
diff --git a/net/base/net_log_event_type_list.h b/net/base/net_log_event_type_list.h
index 1c0aedf..30faee9 100644
--- a/net/base/net_log_event_type_list.h
+++ b/net/base/net_log_event_type_list.h
@@ -129,7 +129,7 @@ EVENT_TYPE(WAITING_FOR_SINGLE_PROXY_RESOLVER_THREAD)
// The START event contains these parameters:
//
// {
-// "addresses": <List of network address strings>
+// "address_list": <List of network address strings>
// }
//
// And the END event will contain the following parameters on failure: