Commit 623921bf authored by Peiyong Lin's avatar Peiyong Lin Committed by Commit Bot

[mojo] Fixed mojo.common.mojom.Value builds inside Blink platform.

This patch moves values_struct_traits into a separate target to be shared by the
chromium and blink variant, and adds values.typemap to blink's typemap config.

BUG=740288

Change-Id: Iae1bf24dd90ca16af6f7b3e0d3e83d255ae41b16
Reviewed-on: https://chromium-review.googlesource.com/565337
Commit-Queue: lpy <lpy@chromium.org>
Reviewed-by: default avatarMike West <mkwst@chromium.org>
Reviewed-by: default avatarYuzhu Shen <yzshen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#485852}
parent 4053f7ad
......@@ -96,3 +96,15 @@ source_set("struct_traits") {
"//base:i18n",
]
}
source_set("values_struct_traits") {
sources = [
"values_struct_traits.cc",
"values_struct_traits.h",
]
public_deps = [
":common_custom_types_shared_cpp_sources",
"//base",
"//mojo/public/cpp/bindings:bindings",
]
}
......@@ -8,13 +8,14 @@ traits_headers = [
"//ipc/ipc_message_utils.h",
"//mojo/common/values_struct_traits.h",
]
public_deps = [
"//base",
"//ipc",
]
sources = [
"values_struct_traits.cc",
"values_struct_traits.h",
deps = [
"//mojo/common:values_struct_traits",
]
type_mappings = [
......
......@@ -6,7 +6,7 @@
#define MOJO_COMMON_VALUES_STRUCT_TRAITS_H_
#include "base/values.h"
#include "mojo/common/values.mojom.h"
#include "mojo/common/values.mojom-shared.h"
#include "mojo/public/cpp/bindings/array_traits.h"
#include "mojo/public/cpp/bindings/clone_traits.h"
#include "mojo/public/cpp/bindings/map_traits.h"
......@@ -115,6 +115,15 @@ struct CloneTraits<std::unique_ptr<base::DictionaryValue>, false> {
const std::unique_ptr<base::DictionaryValue>& input);
};
template <>
struct StructTraits<common::mojom::NullValueDataView, void*> {
static bool IsNull(const void* value) { return true; }
static void SetToNull(void** value) {}
static bool Read(common::mojom::NullValueDataView data, void** value) {
return true;
}
};
template <>
struct UnionTraits<common::mojom::ValueDataView, base::Value> {
static common::mojom::ValueDataView::Tag GetTag(const base::Value& data) {
......@@ -140,9 +149,7 @@ struct UnionTraits<common::mojom::ValueDataView, base::Value> {
return common::mojom::ValueDataView::Tag::NULL_VALUE;
}
static common::mojom::NullValuePtr null_value(const base::Value& value) {
return common::mojom::NullValuePtr();
}
static void* null_value(const base::Value& value) { return nullptr; }
static bool bool_value(const base::Value& value) {
bool bool_value{};
......@@ -209,8 +216,7 @@ struct UnionTraits<common::mojom::ValueDataView, std::unique_ptr<base::Value>> {
*value);
}
static common::mojom::NullValuePtr null_value(
const std::unique_ptr<base::Value>& value) {
static void* null_value(const std::unique_ptr<base::Value>& value) {
return UnionTraits<common::mojom::ValueDataView, base::Value>::null_value(
*value);
}
......
......@@ -4,6 +4,7 @@
typemaps = [
"//mojo/common/file_path.typemap",
"//mojo/common/values.typemap",
"//third_party/WebKit/Source/platform/mojo/File.typemap",
"//third_party/WebKit/Source/platform/mojo/Geometry.typemap",
"//third_party/WebKit/Source/platform/mojo/KURL.typemap",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment