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

Unified Diff: net/base/address_list.cc

Issue 10539094: NetLogEventParameter to Callback refactoring 1, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Remove unneeded line Created 8 years, 6 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/base/address_list.cc
===================================================================
--- net/base/address_list.cc (revision 141407)
+++ net/base/address_list.cc (working copy)
@@ -4,12 +4,32 @@
#include "net/base/address_list.h"
+#include "base/bind.h"
#include "base/logging.h"
+#include "base/values.h"
#include "net/base/net_util.h"
#include "net/base/sys_addrinfo.h"
namespace net {
+namespace {
+
+base::Value* NetLogAddressListCallback(const AddressList* address_list,
+ NetLog::LogLevel log_level) {
+ DictionaryValue* dict = new DictionaryValue();
+ ListValue* list = new ListValue();
+
+ for (AddressList::const_iterator it = address_list->begin();
+ it != address_list->end(); ++it) {
+ list->Append(Value::CreateStringValue(it->ToString()));
+ }
+
+ dict->Set("address_list", list);
+ return dict;
+}
+
+} // namespace
+
AddressList::AddressList() {}
AddressList::~AddressList() {}
@@ -59,11 +79,14 @@
set_canonical_name(front().ToStringWithoutPort());
}
+NetLog::ParametersCallback AddressList::CreateNetLogCallback() const {
+ return base::Bind(&NetLogAddressListCallback, this);
+}
+
void SetPortOnAddressList(uint16 port, AddressList* list) {
DCHECK(list);
- for (AddressList::iterator it = list->begin(); it != list->end(); ++it) {
+ for (AddressList::iterator it = list->begin(); it != list->end(); ++it)
*it = IPEndPoint(it->address(), port);
- }
}
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698