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

Side by Side Diff: net/dns/mojo_host_struct_traits.h

Issue 2675033002: [Media Router] Add MediaSink subtypes (Closed)
Patch Set: resolve code review comments from dcheng Created 3 years, 9 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 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 #ifndef NET_DNS_MOJO_HOST_STRUCT_TRAITS_H_ 5 #ifndef NET_DNS_MOJO_HOST_STRUCT_TRAITS_H_
6 #define NET_DNS_MOJO_HOST_STRUCT_TRAITS_H_ 6 #define NET_DNS_MOJO_HOST_STRUCT_TRAITS_H_
7 7
8 #include "base/strings/string_piece.h" 8 #include "base/strings/string_piece.h"
9 #include "mojo/public/cpp/bindings/enum_traits.h" 9 #include "mojo/public/cpp/bindings/enum_traits.h"
10 #include "mojo/public/cpp/bindings/struct_traits.h" 10 #include "mojo/public/cpp/bindings/struct_traits.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 static bool is_my_ip_address( 42 static bool is_my_ip_address(
43 const std::unique_ptr<net::HostResolver::RequestInfo>& obj) { 43 const std::unique_ptr<net::HostResolver::RequestInfo>& obj) {
44 return obj->is_my_ip_address(); 44 return obj->is_my_ip_address();
45 } 45 }
46 46
47 static bool Read(net::interfaces::HostResolverRequestInfoDataView obj, 47 static bool Read(net::interfaces::HostResolverRequestInfoDataView obj,
48 std::unique_ptr<net::HostResolver::RequestInfo>* output); 48 std::unique_ptr<net::HostResolver::RequestInfo>* output);
49 }; 49 };
50 50
51 template <> 51 template <>
52 struct StructTraits<net::interfaces::IPAddressDataView, net::IPAddress> {
dcheng 2017/03/07 19:54:32 Basically, just take this and move it to a new moj
zhaobin 2017/03/10 01:42:27 Done.
53 static const std::vector<uint8_t>& address(const net::IPAddress& obj) {
54 return obj.bytes();
55 }
56
57 static bool Read(net::interfaces::IPAddressDataView obj, net::IPAddress* out);
58 };
59
60 template <>
52 struct StructTraits<net::interfaces::IPEndPointDataView, net::IPEndPoint> { 61 struct StructTraits<net::interfaces::IPEndPointDataView, net::IPEndPoint> {
53 static const std::vector<uint8_t>& address(const net::IPEndPoint& obj) { 62 static const std::vector<uint8_t>& address(const net::IPEndPoint& obj) {
54 return obj.address().bytes(); 63 return obj.address().bytes();
55 } 64 }
56 static uint16_t port(const net::IPEndPoint& obj) { return obj.port(); } 65 static uint16_t port(const net::IPEndPoint& obj) { return obj.port(); }
57 66
58 static bool Read(net::interfaces::IPEndPointDataView obj, 67 static bool Read(net::interfaces::IPEndPointDataView obj,
59 net::IPEndPoint* out); 68 net::IPEndPoint* out);
60 }; 69 };
61 70
62 template <> 71 template <>
63 struct StructTraits<net::interfaces::AddressListDataView, net::AddressList> { 72 struct StructTraits<net::interfaces::AddressListDataView, net::AddressList> {
64 static std::vector<net::IPEndPoint> addresses(const net::AddressList& obj) { 73 static std::vector<net::IPEndPoint> addresses(const net::AddressList& obj) {
65 return obj.endpoints(); 74 return obj.endpoints();
66 } 75 }
67 76
68 static bool Read(net::interfaces::AddressListDataView data, 77 static bool Read(net::interfaces::AddressListDataView data,
69 net::AddressList* out); 78 net::AddressList* out);
70 }; 79 };
71 80
72 } // namespace mojo 81 } // namespace mojo
73 82
74 #endif // NET_DNS_MOJO_HOST_STRUCT_TRAITS_H_ 83 #endif // NET_DNS_MOJO_HOST_STRUCT_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698