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

Unified Diff: net/interfaces/ip_address_struct_traits.cc

Issue 2745643002: [net] Add a typemap for net::IPAddress (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 side-by-side diff with in-line comments
Download patch
Index: net/interfaces/ip_address_struct_traits.cc
diff --git a/net/interfaces/ip_address_struct_traits.cc b/net/interfaces/ip_address_struct_traits.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b23ac880cb0043e05569ce9b5b826ecd77953607
--- /dev/null
+++ b/net/interfaces/ip_address_struct_traits.cc
@@ -0,0 +1,20 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/interfaces/ip_address_struct_traits.h"
+
+namespace mojo {
+// static
+bool StructTraits<net::interfaces::IPAddressDataView, net::IPAddress>::Read(
+ net::interfaces::IPAddressDataView data,
+ net::IPAddress* out) {
+ std::vector<uint8_t> bytes;
+ if (!data.ReadAddress(&bytes))
+ return false;
+
+ *out = net::IPAddress(bytes);
+ return out->IsValid();
+}
+
+} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698