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

Side by Side Diff: net/dns/address_sorter_posix.cc

Issue 1147903003: Subsituting pattern ScopedVector push_back.(ptr.release()) with push_back(ptr.Pass()) in net/dns (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « AUTHORS ('k') | net/dns/dns_transaction_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) 2012 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/dns/address_sorter_posix.h" 5 #include "net/dns/address_sorter_posix.h"
6 6
7 #include <netinet/in.h> 7 #include <netinet/in.h>
8 8
9 #if defined(OS_MACOSX) || defined(OS_BSD) 9 #if defined(OS_MACOSX) || defined(OS_BSD)
10 #include <sys/socket.h> // Must be included before ifaddrs.h. 10 #include <sys/socket.h> // Must be included before ifaddrs.h.
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 // want to sort, even though the HostCache will be cleared soon. 296 // want to sort, even though the HostCache will be cleared soon.
297 FillPolicy(src.address(), &src_info); 297 FillPolicy(src.address(), &src_info);
298 } 298 }
299 info->src = &src_info; 299 info->src = &src_info;
300 300
301 if (info->address.size() == src.address().size()) { 301 if (info->address.size() == src.address().size()) {
302 info->common_prefix_length = std::min( 302 info->common_prefix_length = std::min(
303 CommonPrefixLength(info->address, src.address()), 303 CommonPrefixLength(info->address, src.address()),
304 info->src->prefix_length); 304 info->src->prefix_length);
305 } 305 }
306 sort_list.push_back(info.release()); 306 sort_list.push_back(info.Pass());
307 } 307 }
308 308
309 std::stable_sort(sort_list.begin(), sort_list.end(), CompareDestinations); 309 std::stable_sort(sort_list.begin(), sort_list.end(), CompareDestinations);
310 310
311 AddressList result; 311 AddressList result;
312 for (size_t i = 0; i < sort_list.size(); ++i) 312 for (size_t i = 0; i < sort_list.size(); ++i)
313 result.push_back(IPEndPoint(sort_list[i]->address, 0 /* port */)); 313 result.push_back(IPEndPoint(sort_list[i]->address, 0 /* port */));
314 314
315 callback.Run(true, result); 315 callback.Run(true, result);
316 } 316 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 } 392 }
393 393
394 // static 394 // static
395 scoped_ptr<AddressSorter> AddressSorter::CreateAddressSorter() { 395 scoped_ptr<AddressSorter> AddressSorter::CreateAddressSorter() {
396 return scoped_ptr<AddressSorter>( 396 return scoped_ptr<AddressSorter>(
397 new AddressSorterPosix(ClientSocketFactory::GetDefaultFactory())); 397 new AddressSorterPosix(ClientSocketFactory::GetDefaultFactory()));
398 } 398 }
399 399
400 } // namespace net 400 } // namespace net
401 401
OLDNEW
« no previous file with comments | « AUTHORS ('k') | net/dns/dns_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698