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

Side by Side Diff: net/base/address_list_net_log_param.cc

Issue 10309002: Reimplements net::AddressList without struct addrinfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: get_canonical_name -> canonical_name. iterator to indexing Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « net/base/address_list.cc ('k') | net/base/address_list_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 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/base/address_list_net_log_param.h" 5 #include "net/base/address_list_net_log_param.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "net/base/net_util.h" 8 #include "net/base/net_util.h"
9 #include "net/base/sys_addrinfo.h"
10 9
11 namespace net { 10 namespace net {
12 11
13 AddressListNetLogParam::AddressListNetLogParam(const AddressList& address_list) 12 AddressListNetLogParam::AddressListNetLogParam(const AddressList& address_list)
14 : address_list_(address_list) { 13 : address_list_(address_list) {
15 } 14 }
16 15
17 Value* AddressListNetLogParam::ToValue() const { 16 Value* AddressListNetLogParam::ToValue() const {
18 DictionaryValue* dict = new DictionaryValue(); 17 DictionaryValue* dict = new DictionaryValue();
19 ListValue* list = new ListValue(); 18 ListValue* list = new ListValue();
20 19
21 for (const addrinfo* head = address_list_.head(); 20 for (size_t i = 0; i < address_list_.size() ; ++i) {
22 head != NULL ; head = head->ai_next) { 21 list->Append(Value::CreateStringValue(address_list_[i].ToString()));
23 list->Append(Value::CreateStringValue(NetAddressToStringWithPort(head)));
24 } 22 }
25 23
26 dict->Set("address_list", list); 24 dict->Set("address_list", list);
27 return dict; 25 return dict;
28 } 26 }
29 27
30 } // namespace 28 } // namespace
OLDNEW
« no previous file with comments | « net/base/address_list.cc ('k') | net/base/address_list_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698