aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuyuan Li <muyuanli@google.com>2017-03-15 22:35:30 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-03-15 22:35:30 +0000
commit5925dcbfbb85e3a424af0c45a1252cc5667c1111 (patch)
treef7f012aec44f5cdd3d805af5a9a0004bc4060a30
parent6a1279d348f37400b177652d27e9ce62ac1530c9 (diff)
parentf3f2670d71ea15595318cc0a7d27500698a34694 (diff)
downloadlibmojo-oreo-r5-release.tar.gz
Add string16 to Android mojom am: 2a90c28e40 am: 386a50484aandroid-wear-o-preview-4android-wear-o-preview-3android-vts-8.0_r9android-vts-8.0_r8android-vts-8.0_r7android-vts-8.0_r6android-vts-8.0_r2android-vts-8.0_r13android-vts-8.0_r12android-vts-8.0_r11android-vts-8.0_r10android-vts-8.0_r1android-security-8.0.0_r54android-security-8.0.0_r53android-security-8.0.0_r52android-o-preview-4android-o-preview-3android-o-preview-2android-cts-8.0_r9android-cts-8.0_r8android-cts-8.0_r7android-cts-8.0_r6android-cts-8.0_r5android-cts-8.0_r4android-cts-8.0_r3android-cts-8.0_r26android-cts-8.0_r25android-cts-8.0_r24android-cts-8.0_r23android-cts-8.0_r22android-cts-8.0_r21android-cts-8.0_r20android-cts-8.0_r2android-cts-8.0_r19android-cts-8.0_r18android-cts-8.0_r17android-cts-8.0_r16android-cts-8.0_r15android-cts-8.0_r14android-cts-8.0_r13android-cts-8.0_r12android-cts-8.0_r11android-cts-8.0_r10android-cts-8.0_r1android-8.0.0_r9android-8.0.0_r7android-8.0.0_r51android-8.0.0_r50android-8.0.0_r49android-8.0.0_r48android-8.0.0_r47android-8.0.0_r46android-8.0.0_r45android-8.0.0_r44android-8.0.0_r43android-8.0.0_r42android-8.0.0_r41android-8.0.0_r40android-8.0.0_r4android-8.0.0_r39android-8.0.0_r38android-8.0.0_r37android-8.0.0_r36android-8.0.0_r35android-8.0.0_r32android-8.0.0_r31android-8.0.0_r30android-8.0.0_r3android-8.0.0_r29android-8.0.0_r28android-8.0.0_r2android-8.0.0_r17android-8.0.0_r16android-8.0.0_r15android-8.0.0_r13android-8.0.0_r12android-8.0.0_r11android-8.0.0_r10android-8.0.0_r1security-oc-releaseoreo-vts-releaseoreo-security-releaseoreo-releaseoreo-r6-releaseoreo-r5-releaseoreo-r4-releaseoreo-r3-releaseoreo-r2-releaseoreo-devoreo-cts-releaseo-preview-4o-preview-3o-preview-2
am: f3f2670d71 Change-Id: I32aeab0cfb0d8146504854a860adc6c8c9d0b9ff
-rw-r--r--Android.mk2
-rw-r--r--gen/mojo/common/common_custom_types__type_mappings122
-rw-r--r--mojo/common/BUILD.gn1
-rw-r--r--mojo/common/common_custom_types.typemap1
-rw-r--r--mojo/common/common_custom_types_struct_traits.cc18
-rw-r--r--mojo/common/common_custom_types_struct_traits.h27
-rw-r--r--mojo/common/string16.mojom13
7 files changed, 131 insertions, 53 deletions
diff --git a/Android.mk b/Android.mk
index a3e2083..c54e37e 100644
--- a/Android.mk
+++ b/Android.mk
@@ -15,6 +15,7 @@ LOCAL_CPP_EXTENSION := .cc
LOCAL_MOJOM_FILES := \
mojo/common/common_custom_types.mojom \
+ mojo/common/string16.mojom \
mojo/public/interfaces/bindings/interface_control_messages.mojom \
mojo/public/interfaces/bindings/pipe_control_messages.mojom \
@@ -78,6 +79,7 @@ LOCAL_SRC_FILES := \
mojo/android/system/base_run_loop.cc \
mojo/android/system/core_impl.cc \
mojo/edk/embedder/embedder.cc \
+ mojo/common/common_custom_types_struct_traits.cc \
mojo/edk/embedder/entrypoints.cc \
mojo/edk/embedder/platform_channel_pair.cc \
mojo/edk/embedder/platform_channel_pair_posix.cc \
diff --git a/gen/mojo/common/common_custom_types__type_mappings b/gen/mojo/common/common_custom_types__type_mappings
index 45c178d..2adbcc7 100644
--- a/gen/mojo/common/common_custom_types__type_mappings
+++ b/gen/mojo/common/common_custom_types__type_mappings
@@ -1,92 +1,108 @@
{
"c++": {
"mojo.common.mojom.ListValue": {
- "typename": "base::ListValue",
+ "typename": "base::ListValue",
"traits_headers": [
"ipc/ipc_message_utils.h"
- ],
- "copyable_pass_by_value": false,
- "move_only": false,
- "nullable_is_same_type": false,
+ ],
+ "copyable_pass_by_value": false,
+ "move_only": false,
+ "nullable_is_same_type": false,
"public_headers": [
- "base/files/file_path.h",
- "base/strings/string16.h",
- "base/time/time.h",
+ "base/files/file_path.h",
+ "base/strings/string16.h",
+ "base/time/time.h",
"base/values.h"
]
- },
+ },
+ "mojo.common.mojom.String16": {
+ "typename": "base::string16",
+ "traits_headers": [
+ "ipc/ipc_message_utils.h",
+ "mojo/common/common_custom_types_struct_traits.h"
+ ],
+ "copyable_pass_by_value": false,
+ "move_only": false,
+ "nullable_is_same_type": false,
+ "public_headers": [
+ "base/files/file_path.h",
+ "base/strings/string16.h",
+ "base/time/time.h",
+ "base/values.h"
+ ]
+ },
"mojo.common.mojom.Time": {
- "typename": "base::Time",
+ "typename": "base::Time",
"traits_headers": [
"ipc/ipc_message_utils.h"
- ],
- "copyable_pass_by_value": true,
- "move_only": false,
- "nullable_is_same_type": false,
+ ],
+ "copyable_pass_by_value": true,
+ "move_only": false,
+ "nullable_is_same_type": false,
"public_headers": [
- "base/files/file_path.h",
- "base/strings/string16.h",
- "base/time/time.h",
+ "base/files/file_path.h",
+ "base/strings/string16.h",
+ "base/time/time.h",
"base/values.h"
]
- },
+ },
"mojo.common.mojom.TimeDelta": {
- "typename": "base::TimeDelta",
+ "typename": "base::TimeDelta",
"traits_headers": [
"ipc/ipc_message_utils.h"
- ],
- "copyable_pass_by_value": true,
- "move_only": false,
- "nullable_is_same_type": false,
+ ],
+ "copyable_pass_by_value": true,
+ "move_only": false,
+ "nullable_is_same_type": false,
"public_headers": [
- "base/files/file_path.h",
- "base/strings/string16.h",
- "base/time/time.h",
+ "base/files/file_path.h",
+ "base/strings/string16.h",
+ "base/time/time.h",
"base/values.h"
]
- },
+ },
"mojo.common.mojom.TimeTicks": {
- "typename": "base::TimeTicks",
+ "typename": "base::TimeTicks",
"traits_headers": [
"ipc/ipc_message_utils.h"
- ],
- "copyable_pass_by_value": true,
- "move_only": false,
- "nullable_is_same_type": false,
+ ],
+ "copyable_pass_by_value": true,
+ "move_only": false,
+ "nullable_is_same_type": false,
"public_headers": [
- "base/files/file_path.h",
- "base/strings/string16.h",
- "base/time/time.h",
+ "base/files/file_path.h",
+ "base/strings/string16.h",
+ "base/time/time.h",
"base/values.h"
]
- },
+ },
"mojo.common.mojom.FilePath": {
- "typename": "base::FilePath",
+ "typename": "base::FilePath",
"traits_headers": [
"ipc/ipc_message_utils.h"
- ],
- "copyable_pass_by_value": false,
- "move_only": false,
- "nullable_is_same_type": false,
+ ],
+ "copyable_pass_by_value": false,
+ "move_only": false,
+ "nullable_is_same_type": false,
"public_headers": [
- "base/files/file_path.h",
- "base/strings/string16.h",
- "base/time/time.h",
+ "base/files/file_path.h",
+ "base/strings/string16.h",
+ "base/time/time.h",
"base/values.h"
]
- },
+ },
"mojo.common.mojom.DictionaryValue": {
- "typename": "base::DictionaryValue",
+ "typename": "base::DictionaryValue",
"traits_headers": [
"ipc/ipc_message_utils.h"
- ],
- "copyable_pass_by_value": false,
- "move_only": false,
- "nullable_is_same_type": false,
+ ],
+ "copyable_pass_by_value": false,
+ "move_only": false,
+ "nullable_is_same_type": false,
"public_headers": [
- "base/files/file_path.h",
- "base/strings/string16.h",
- "base/time/time.h",
+ "base/files/file_path.h",
+ "base/strings/string16.h",
+ "base/time/time.h",
"base/values.h"
]
}
diff --git a/mojo/common/BUILD.gn b/mojo/common/BUILD.gn
index 2edfb6d..57c85d5 100644
--- a/mojo/common/BUILD.gn
+++ b/mojo/common/BUILD.gn
@@ -16,6 +16,7 @@ group("common") {
mojom("common_custom_types") {
sources = [
"common_custom_types.mojom",
+ "string16.mojom",
]
}
diff --git a/mojo/common/common_custom_types.typemap b/mojo/common/common_custom_types.typemap
index 8d88109..0b63f38 100644
--- a/mojo/common/common_custom_types.typemap
+++ b/mojo/common/common_custom_types.typemap
@@ -17,6 +17,7 @@ type_mappings = [
"mojo.common.mojom.FilePath=base::FilePath",
"mojo.common.mojom.DictionaryValue=base::DictionaryValue",
"mojo.common.mojom.ListValue=base::ListValue",
+ "mojo.common.mojom.String16=base::string16",
"mojo.common.mojom.Time=base::Time",
"mojo.common.mojom.TimeDelta=base::TimeDelta",
"mojo.common.mojom.TimeTicks=base::TimeTicks",
diff --git a/mojo/common/common_custom_types_struct_traits.cc b/mojo/common/common_custom_types_struct_traits.cc
new file mode 100644
index 0000000..3f9f7d9
--- /dev/null
+++ b/mojo/common/common_custom_types_struct_traits.cc
@@ -0,0 +1,18 @@
+// 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 "mojo/common/common_custom_types_struct_traits.h"
+
+namespace mojo {
+
+// static
+bool StructTraits<common::mojom::String16, base::string16>::Read(
+ common::mojom::String16DataView data, base::string16* out) {
+ std::vector<uint16_t> view;
+ data.ReadData(&view);
+ out->assign(reinterpret_cast<const base::char16*>(view.data()), view.size());
+ return true;
+}
+
+} // mojo
diff --git a/mojo/common/common_custom_types_struct_traits.h b/mojo/common/common_custom_types_struct_traits.h
new file mode 100644
index 0000000..22afdb6
--- /dev/null
+++ b/mojo/common/common_custom_types_struct_traits.h
@@ -0,0 +1,27 @@
+// 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.
+
+#ifndef MOJO_COMMON_COMMON_CUSTOM_TYPES_STRUCT_TRAITS_H_
+#define MOJO_COMMON_COMMON_CUSTOM_TYPES_STRUCT_TRAITS_H_
+
+#include <stdint.h>
+#include <vector>
+
+#include "mojo/common/string16.mojom.h"
+#include "mojo/public/cpp/bindings/struct_traits.h"
+
+namespace mojo {
+
+template <>
+struct StructTraits<common::mojom::String16, base::string16> {
+ static std::vector<uint16_t> data(const base::string16& str) {
+ const uint16_t* base = str.data();
+ return std::vector<uint16_t>(base, base + str.size());
+ }
+ static bool Read(common::mojom::String16DataView data, base::string16* output);
+};
+
+} // mojo
+
+#endif // MOJO_COMMON_COMMON_CUSTOM_TYPES_STRUCT_TRAITS_H_
diff --git a/mojo/common/string16.mojom b/mojo/common/string16.mojom
new file mode 100644
index 0000000..eb1ace2
--- /dev/null
+++ b/mojo/common/string16.mojom
@@ -0,0 +1,13 @@
+// Copyright 2016 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.
+
+module mojo.common.mojom;
+
+// Corresponds to |base::string16| in base/strings/string16.h
+// Corresponds to |WTF::String| in
+// third_party/WebKit/Source/wtf/text/WTFString.h.
+struct String16 {
+ array<uint16> data;
+};
+