Commit aa7438aa authored by Ken Rockot's avatar Ken Rockot Committed by Commit Bot

Convert some mojo_base typemaps to GN targets

Uses new GN-based typemap definitions to replace some typemap files in
mojo/public/cpp/base.

Bug: 1059389
Change-Id: If1389c9ceec8ae90df753895af0abd9f72c704a0
Tbr: dtapuska@chromium.org
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2090723Reviewed-by: default avatarKen Rockot <rockot@google.com>
Reviewed-by: default avatarOksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#748056}
parent fbfac4f3
...@@ -23,6 +23,23 @@ component("base") { ...@@ -23,6 +23,23 @@ component("base") {
] ]
} }
component("typemap_traits") {
output_name = "mojo_base_typemap_traits"
sources = [
"big_string_mojom_traits.cc",
"big_string_mojom_traits.h",
]
defines = [ "IS_MOJO_BASE_TRAITS_IMPL" ]
public_deps = [
":shared_typemap_traits",
"//base",
"//mojo/public/cpp/base",
]
}
# Normally typemap traits sources should be build directly into mojom targets # Normally typemap traits sources should be build directly into mojom targets
# via the typemap file. This target is for typemapped mojo_base types whose # via the typemap file. This target is for typemapped mojo_base types whose
# traits are shared between chromium and blink variants. # traits are shared between chromium and blink variants.
......
# 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.
mojom = "//mojo/public/mojom/base/big_buffer.mojom"
public_headers = [ "//mojo/public/cpp/base/big_buffer.h" ]
traits_headers = [ "//mojo/public/cpp/base/big_buffer_mojom_traits.h" ]
public_deps = [
"//mojo/public/cpp/base",
"//mojo/public/cpp/base:shared_typemap_traits",
]
type_mappings =
[ "mojo_base.mojom.BigBuffer=::mojo_base::BigBuffer[move_only]" ]
# Copyright 2018 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.
mojom = "//mojo/public/mojom/base/big_string.mojom"
public_headers = []
traits_headers = [ "//mojo/public/cpp/base/big_string_mojom_traits.h" ]
sources = [
"//mojo/public/cpp/base/big_string_mojom_traits.cc",
"//mojo/public/cpp/base/big_string_mojom_traits.h",
]
public_deps = [
"//mojo/public/cpp/base",
"//mojo/public/cpp/base:shared_typemap_traits",
]
type_mappings = [ "mojo_base.mojom.BigString=::std::string" ]
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
namespace mojo { namespace mojo {
template <> template <>
struct COMPONENT_EXPORT(MOJO_BASE_MOJOM) struct COMPONENT_EXPORT(MOJO_BASE_TRAITS)
StructTraits<mojo_base::mojom::BigStringDataView, std::string> { StructTraits<mojo_base::mojom::BigStringDataView, std::string> {
static mojo_base::BigBuffer data(const std::string& str); static mojo_base::BigBuffer data(const std::string& str);
......
# Copyright 2019 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.
mojom = "//mojo/public/mojom/base/generic_pending_receiver.mojom"
public_headers = [ "//mojo/public/cpp/bindings/generic_pending_receiver.h" ]
traits_headers =
[ "//mojo/public/cpp/base/generic_pending_receiver_mojom_traits.h" ]
public_deps = [
"//mojo/public/cpp/bindings",
]
deps = [
"//mojo/public/cpp/base:shared_typemap_traits",
]
type_mappings = [ "mojo_base.mojom.GenericPendingReceiver=::mojo::GenericPendingReceiver[move_only,nullable_is_same_type]" ]
# 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.
mojom = "//mojo/public/mojom/base/time.mojom"
public_headers = [ "//base/time/time.h" ]
traits_headers = [ "//mojo/public/cpp/base/time_mojom_traits.h" ]
public_deps = [
"//base",
"//mojo/public/cpp/base:shared_typemap_traits",
]
type_mappings = [
"mojo_base.mojom.Time=::base::Time[copyable_pass_by_value]",
"mojo_base.mojom.TimeDelta=::base::TimeDelta[copyable_pass_by_value]",
"mojo_base.mojom.TimeTicks=::base::TimeTicks[copyable_pass_by_value]",
]
...@@ -4,13 +4,10 @@ ...@@ -4,13 +4,10 @@
typemaps = [ typemaps = [
"//mojo/public/cpp/base/application_state.typemap", "//mojo/public/cpp/base/application_state.typemap",
"//mojo/public/cpp/base/big_buffer.typemap",
"//mojo/public/cpp/base/big_string.typemap",
"//mojo/public/cpp/base/file_error.typemap", "//mojo/public/cpp/base/file_error.typemap",
"//mojo/public/cpp/base/file_info.typemap", "//mojo/public/cpp/base/file_info.typemap",
"//mojo/public/cpp/base/file_path.typemap", "//mojo/public/cpp/base/file_path.typemap",
"//mojo/public/cpp/base/file.typemap", "//mojo/public/cpp/base/file.typemap",
"//mojo/public/cpp/base/generic_pending_receiver.typemap",
"//mojo/public/cpp/base/read_only_buffer.typemap", "//mojo/public/cpp/base/read_only_buffer.typemap",
"//mojo/public/cpp/base/memory_allocator_dump_cross_process_uid.typemap", "//mojo/public/cpp/base/memory_allocator_dump_cross_process_uid.typemap",
"//mojo/public/cpp/base/memory_pressure_level.typemap", "//mojo/public/cpp/base/memory_pressure_level.typemap",
...@@ -22,8 +19,5 @@ typemaps = [ ...@@ -22,8 +19,5 @@ typemaps = [
"//mojo/public/cpp/base/logfont_win.typemap", "//mojo/public/cpp/base/logfont_win.typemap",
"//mojo/public/cpp/base/text_direction.typemap", "//mojo/public/cpp/base/text_direction.typemap",
"//mojo/public/cpp/base/thread_priority.typemap", "//mojo/public/cpp/base/thread_priority.typemap",
"//mojo/public/cpp/base/time.typemap",
"//mojo/public/cpp/base/token.typemap", "//mojo/public/cpp/base/token.typemap",
"//mojo/public/cpp/base/unguessable_token.typemap",
"//mojo/public/cpp/base/values.typemap",
] ]
# 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.
mojom = "//mojo/public/mojom/base/unguessable_token.mojom"
public_headers = [ "//base/unguessable_token.h" ]
traits_headers = [ "//mojo/public/cpp/base/unguessable_token_mojom_traits.h" ]
public_deps = [
"//mojo/public/cpp/base:shared_typemap_traits",
]
type_mappings = [ "mojo_base.mojom.UnguessableToken=::base::UnguessableToken" ]
# Copyright 2018 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.
mojom = "//mojo/public/mojom/base/values.mojom"
public_headers = [ "//base/values.h" ]
traits_headers = [ "//mojo/public/cpp/base/values_mojom_traits.h" ]
public_deps = [
"//base",
"//mojo/public/cpp/base:shared_typemap_traits",
]
type_mappings = [
"mojo_base.mojom.Value=::base::Value[move_only]",
"mojo_base.mojom.DictionaryValue=::base::Value[move_only]",
"mojo_base.mojom.ListValue=::base::Value[move_only]",
]
...@@ -43,4 +43,138 @@ mojom_component("base") { ...@@ -43,4 +43,138 @@ mojom_component("base") {
output_prefix = "mojo_base_mojom" output_prefix = "mojo_base_mojom"
macro_prefix = "MOJO_BASE_MOJOM" macro_prefix = "MOJO_BASE_MOJOM"
common_typemaps = [
":big_buffer_typemap",
":generic_pending_receiver_typemap",
":time_typemap",
":unguessable_token_typemap",
":value_typemap",
]
cpp_typemaps = common_typemaps + [ ":big_string_typemap" ]
blink_cpp_typemaps =
common_typemaps +
[ "//third_party/blink/renderer/platform/mojo:big_string_typemap" ]
}
mojom_cpp_typemap("big_buffer_typemap") {
types = [
{
mojom = "mojo_base.mojom.BigBuffer"
cpp = "::mojo_base::BigBuffer"
move_only = true
},
]
public_headers = [
"//mojo/public/cpp/base/big_buffer.h",
"//mojo/public/cpp/base/big_buffer_mojom_traits.h",
]
public_deps = [
"//mojo/public/cpp/base",
"//mojo/public/cpp/base:shared_typemap_traits",
]
}
mojom_cpp_typemap("big_string_typemap") {
types = [
{
mojom = "mojo_base.mojom.BigString"
cpp = "::std::string"
},
]
public_headers = [ "//mojo/public/cpp/base/big_string_mojom_traits.h" ]
public_deps = [
"//mojo/public/cpp/base",
"//mojo/public/cpp/base:typemap_traits",
]
}
mojom_cpp_typemap("generic_pending_receiver_typemap") {
types = [
{
mojom = "mojo_base.mojom.GenericPendingReceiver"
cpp = "::mojo::GenericPendingReceiver"
move_only = true
nullable_is_same_type = true
},
]
public_headers = [
"//mojo/public/cpp/base/generic_pending_receiver_mojom_traits.h",
"//mojo/public/cpp/bindings/generic_pending_receiver.h",
]
public_deps = [
"//mojo/public/cpp/base:shared_typemap_traits",
"//mojo/public/cpp/bindings",
]
}
mojom_cpp_typemap("time_typemap") {
types = [
{
mojom = "mojo_base.mojom.Time"
cpp = "::base::Time"
copyable_pass_by_value = true
},
{
mojom = "mojo_base.mojom.TimeDelta"
cpp = "::base::TimeDelta"
copyable_pass_by_value = true
},
{
mojom = "mojo_base.mojom.TimeTicks"
cpp = "::base::TimeTicks"
copyable_pass_by_value = true
},
]
public_headers = [
"//base/time/time.h",
"//mojo/public/cpp/base/time_mojom_traits.h",
]
public_deps = [
"//base",
"//mojo/public/cpp/base:shared_typemap_traits",
]
}
mojom_cpp_typemap("unguessable_token_typemap") {
types = [
{
mojom = "mojo_base.mojom.UnguessableToken"
cpp = "::base::UnguessableToken"
},
]
public_headers = [ "//mojo/public/cpp/base/unguessable_token_mojom_traits.h" ]
public_deps = [
"//base",
"//mojo/public/cpp/base:shared_typemap_traits",
]
}
mojom_cpp_typemap("value_typemap") {
types = [
{
mojom = "mojo_base.mojom.Value"
cpp = "::base::Value"
move_only = true
},
{
mojom = "mojo_base.mojom.ListValue"
cpp = "::base::Value"
move_only = true
},
{
mojom = "mojo_base.mojom.DictionaryValue"
cpp = "::base::Value"
move_only = true
},
]
public_headers = [ "//mojo/public/cpp/base/values_mojom_traits.h" ]
public_deps = [
"//base",
"//mojo/public/cpp/base:shared_typemap_traits",
]
} }
...@@ -5,16 +5,12 @@ ...@@ -5,16 +5,12 @@
typemaps = [ typemaps = [
"//gpu/ipc/common/mailbox_holder_for_blink.typemap", "//gpu/ipc/common/mailbox_holder_for_blink.typemap",
"//gpu/ipc/common/sync_token.typemap", "//gpu/ipc/common/sync_token.typemap",
"//mojo/public/cpp/base/big_buffer.typemap",
"//mojo/public/cpp/base/file.typemap", "//mojo/public/cpp/base/file.typemap",
"//mojo/public/cpp/base/file_info.typemap", "//mojo/public/cpp/base/file_info.typemap",
"//mojo/public/cpp/base/file_path.typemap", "//mojo/public/cpp/base/file_path.typemap",
"//mojo/public/cpp/base/file_error.typemap", "//mojo/public/cpp/base/file_error.typemap",
"//mojo/public/cpp/base/generic_pending_receiver.typemap",
"//mojo/public/cpp/base/shared_memory.typemap", "//mojo/public/cpp/base/shared_memory.typemap",
"//mojo/public/cpp/base/time.typemap",
"//mojo/public/cpp/base/read_only_buffer.typemap", "//mojo/public/cpp/base/read_only_buffer.typemap",
"//mojo/public/cpp/base/unguessable_token.typemap",
"//services/network/public/cpp/cross_origin_embedder_policy.typemap", "//services/network/public/cpp/cross_origin_embedder_policy.typemap",
"//services/network/public/cpp/url_request.typemap", "//services/network/public/cpp/url_request.typemap",
"//services/viz/public/cpp/compositing/begin_frame_args_for_blink.typemap", "//services/viz/public/cpp/compositing/begin_frame_args_for_blink.typemap",
......
# Copyright 2020 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.
import("//mojo/public/tools/bindings/mojom.gni")
mojom_cpp_typemap("big_string_typemap") {
types = [
{
mojom = "mojo_base.mojom.BigString"
cpp = "::WTF::String"
nullable_is_same_type = true
},
]
public_headers = [
"//third_party/blink/renderer/platform/mojo/big_string_mojom_traits.h",
"//third_party/blink/renderer/platform/wtf/text/wtf_string.h",
]
public_deps = [ "//mojo/public/cpp/base" ]
}
# Copyright 2018 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.
mojom = "//mojo/public/mojom/base/big_string.mojom"
public_headers =
[ "//third_party/blink/renderer/platform/wtf/text/wtf_string.h" ]
traits_headers =
[ "//third_party/blink/renderer/platform/mojo/big_string_mojom_traits.h" ]
type_mappings =
[ "mojo_base.mojom.BigString=::WTF::String[nullable_is_same_type]" ]
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_MOJO_BIG_STRING_MOJOM_TRAITS_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_MOJO_BIG_STRING_MOJOM_TRAITS_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_MOJO_BIG_STRING_MOJOM_TRAITS_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_MOJO_BIG_STRING_MOJOM_TRAITS_H_
#include "mojo/public/cpp/base/big_buffer.h"
#include "mojo/public/cpp/bindings/struct_traits.h" #include "mojo/public/cpp/bindings/struct_traits.h"
#include "mojo/public/mojom/base/big_string.mojom-blink-forward.h" #include "mojo/public/mojom/base/big_string.mojom-blink-forward.h"
#include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/platform_export.h"
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
typemaps = [ typemaps = [
"//media/capture/mojom/video_capture_types_for_blink.typemap", "//media/capture/mojom/video_capture_types_for_blink.typemap",
"//media/mojo/mojom/audio_parameters.typemap", "//media/mojo/mojom/audio_parameters.typemap",
"//mojo/public/cpp/base/values.typemap",
"//services/network/public/cpp/http_request_headers.typemap", "//services/network/public/cpp/http_request_headers.typemap",
"//services/network/public/cpp/ip_address.typemap", "//services/network/public/cpp/ip_address.typemap",
"//services/network/public/cpp/ip_endpoint.typemap", "//services/network/public/cpp/ip_endpoint.typemap",
...@@ -21,7 +20,6 @@ typemaps = [ ...@@ -21,7 +20,6 @@ typemaps = [
"//third_party/blink/renderer/modules/indexeddb/indexed_db_blink.typemap", "//third_party/blink/renderer/modules/indexeddb/indexed_db_blink.typemap",
"//third_party/blink/renderer/platform/blob/serialized_blob.typemap", "//third_party/blink/renderer/platform/blob/serialized_blob.typemap",
"//third_party/blink/renderer/platform/cookie/canonical_cookie.typemap", "//third_party/blink/renderer/platform/cookie/canonical_cookie.typemap",
"//third_party/blink/renderer/platform/mojo/big_string.typemap",
"//third_party/blink/renderer/platform/mojo/fetch_api_request_headers.typemap", "//third_party/blink/renderer/platform/mojo/fetch_api_request_headers.typemap",
"//third_party/blink/renderer/platform/mojo/kurl.typemap", "//third_party/blink/renderer/platform/mojo/kurl.typemap",
"//third_party/blink/renderer/platform/mojo/security_origin.typemap", "//third_party/blink/renderer/platform/mojo/security_origin.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