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

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

Issue 1565303002: Change IPEndpoint::address() to return a net::IPAddress (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase for ChromeOS Created 4 years, 10 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 | « net/base/ip_address.h ('k') | net/base/ip_endpoint.h » ('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) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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/ip_address.h" 5 #include "net/base/ip_address.h"
6 6
7 #include "net/base/ip_address_number.h" 7 #include "net/base/ip_address_number.h"
8 #include "url/gurl.h" 8 #include "url/gurl.h"
9 #include "url/url_canon_ip.h" 9 #include "url/url_canon_ip.h"
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 return false; 54 return false;
55 55
56 std::swap(number, ip_address->ip_address_); 56 std::swap(number, ip_address->ip_address_);
57 return true; 57 return true;
58 } 58 }
59 59
60 bool IPAddress::operator==(const IPAddress& that) const { 60 bool IPAddress::operator==(const IPAddress& that) const {
61 return ip_address_ == that.ip_address_; 61 return ip_address_ == that.ip_address_;
62 } 62 }
63 63
64 bool IPAddress::operator!=(const IPAddress& that) const {
65 return ip_address_ != that.ip_address_;
66 }
67
64 bool IPAddress::operator<(const IPAddress& that) const { 68 bool IPAddress::operator<(const IPAddress& that) const {
65 // Sort IPv4 before IPv6. 69 // Sort IPv4 before IPv6.
66 if (ip_address_.size() != that.ip_address_.size()) { 70 if (ip_address_.size() != that.ip_address_.size()) {
67 return ip_address_.size() < that.ip_address_.size(); 71 return ip_address_.size() < that.ip_address_.size();
68 } 72 }
69 73
70 return ip_address_ < that.ip_address_; 74 return ip_address_ < that.ip_address_;
71 } 75 }
72 76
73 } // namespace net 77 } // namespace net
OLDNEW
« no previous file with comments | « net/base/ip_address.h ('k') | net/base/ip_endpoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698