blob: d19a1ee7520f0b48ce92da5fc9e141cd93e5e2c9 [file] [log] [blame]
// content/common/gin_java_bridge.mojom.cc is auto generated by mojom_bindings_generator.py, do not edit
// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
#endif
#include "content/common/gin_java_bridge.mojom.h"
#include <math.h>
#include <stdint.h>
#include <utility>
#include "base/debug/alias.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/typed_macros.h"
#include "base/types/cxx23_to_underlying.h"
#include "mojo/public/cpp/bindings/lib/default_construct_tag_internal.h"
#include "mojo/public/cpp/bindings/lib/generated_code_util.h"
#include "mojo/public/cpp/bindings/lib/message_internal.h"
#include "mojo/public/cpp/bindings/lib/proxy_to_responder.h"
#include "mojo/public/cpp/bindings/lib/send_message_helper.h"
#include "mojo/public/cpp/bindings/lib/serialization.h"
#include "mojo/public/cpp/bindings/lib/serialization_util.h"
#include "mojo/public/cpp/bindings/lib/unserialized_message_context.h"
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/cpp/bindings/mojo_buildflags.h"
#include "mojo/public/cpp/bindings/urgent_message_scope.h"
#include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value.h"
#include "content/common/gin_java_bridge.mojom-params-data.h"
#include "content/common/gin_java_bridge.mojom-shared-message-ids.h"
#include "content/common/gin_java_bridge.mojom-import-headers.h"
#include "content/common/gin_java_bridge.mojom-test-utils.h"
namespace content::mojom {
// The declaration includes the definition on other builds.
GinJavaBridge::IPCStableHashFunction GinJavaBridge::MessageToMethodInfo_(mojo::Message& message) {
#if !BUILDFLAG(IS_FUCHSIA)
switch (static_cast<messages::GinJavaBridge>(message.name())) {
case messages::GinJavaBridge::kAddNamedObject: {
return &GinJavaBridge::AddNamedObject_Sym::IPCStableHash;
}
case messages::GinJavaBridge::kRemoveNamedObject: {
return &GinJavaBridge::RemoveNamedObject_Sym::IPCStableHash;
}
case messages::GinJavaBridge::kSetHost: {
return &GinJavaBridge::SetHost_Sym::IPCStableHash;
}
}
#endif // !BUILDFLAG(IS_FUCHSIA)
return nullptr;
}
const char* GinJavaBridge::MessageToMethodName_(mojo::Message& message) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
bool is_response = message.has_flag(mojo::Message::kFlagIsResponse);
if (!is_response) {
switch (static_cast<messages::GinJavaBridge>(message.name())) {
case messages::GinJavaBridge::kAddNamedObject:
return "Receive content::mojom::GinJavaBridge::AddNamedObject";
case messages::GinJavaBridge::kRemoveNamedObject:
return "Receive content::mojom::GinJavaBridge::RemoveNamedObject";
case messages::GinJavaBridge::kSetHost:
return "Receive content::mojom::GinJavaBridge::SetHost";
}
} else {
switch (static_cast<messages::GinJavaBridge>(message.name())) {
case messages::GinJavaBridge::kAddNamedObject:
return "Receive reply content::mojom::GinJavaBridge::AddNamedObject";
case messages::GinJavaBridge::kRemoveNamedObject:
return "Receive reply content::mojom::GinJavaBridge::RemoveNamedObject";
case messages::GinJavaBridge::kSetHost:
return "Receive reply content::mojom::GinJavaBridge::SetHost";
}
}
return "Receive unknown mojo message";
#else
bool is_response = message.has_flag(mojo::Message::kFlagIsResponse);
if (is_response) {
return "Receive mojo reply";
} else {
return "Receive mojo message";
}
#endif // BUILDFLAG(MOJO_TRACE_ENABLED)
}
#if !BUILDFLAG(IS_FUCHSIA)
uint32_t GinJavaBridge::AddNamedObject_Sym::IPCStableHash() {
// This method's address is used for identifying the mojo method name after
// symbolization. So each IPCStableHash should have a unique address.
// We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of
// __LINE__ value, which is not unique across different mojo modules.
// The code below is very similar to NO_CODE_FOLDING, but it uses a unique
// hash instead of __LINE__.
static constexpr uint32_t kHash = 0xc1451f8f; // IPCStableHash for content::mojom::GinJavaBridge::AddNamedObject
const uint32_t hash = kHash;
base::debug::Alias(&hash);
return hash;
}
uint32_t GinJavaBridge::RemoveNamedObject_Sym::IPCStableHash() {
// This method's address is used for identifying the mojo method name after
// symbolization. So each IPCStableHash should have a unique address.
// We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of
// __LINE__ value, which is not unique across different mojo modules.
// The code below is very similar to NO_CODE_FOLDING, but it uses a unique
// hash instead of __LINE__.
static constexpr uint32_t kHash = 0xd13c678c; // IPCStableHash for content::mojom::GinJavaBridge::RemoveNamedObject
const uint32_t hash = kHash;
base::debug::Alias(&hash);
return hash;
}
uint32_t GinJavaBridge::SetHost_Sym::IPCStableHash() {
// This method's address is used for identifying the mojo method name after
// symbolization. So each IPCStableHash should have a unique address.
// We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of
// __LINE__ value, which is not unique across different mojo modules.
// The code below is very similar to NO_CODE_FOLDING, but it uses a unique
// hash instead of __LINE__.
static constexpr uint32_t kHash = 0x1a671884; // IPCStableHash for content::mojom::GinJavaBridge::SetHost
const uint32_t hash = kHash;
base::debug::Alias(&hash);
return hash;
}
# endif // !BUILDFLAG(IS_FUCHSIA)
GinJavaBridgeProxy::GinJavaBridgeProxy(mojo::MessageReceiverWithResponder* receiver)
: receiver_(receiver) {
}
void GinJavaBridgeProxy::AddNamedObject(
const std::string& in_name, int32_t in_object_id, const ::origin_matcher::OriginMatcher& in_origin_matcher) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send content::mojom::GinJavaBridge::AddNamedObject", "input_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("name"), in_name,
"<value of type const std::string&>");
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("object_id"), in_object_id,
"<value of type int32_t>");
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("origin_matcher"), in_origin_matcher,
"<value of type const ::origin_matcher::OriginMatcher&>");
});
#endif
const bool kExpectsResponse = false;
const bool kIsSync = false;
const bool kAllowInterrupt = true;
const bool is_urgent = false;
const uint32_t kFlags =
((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) |
((kIsSync) ? mojo::Message::kFlagIsSync : 0) |
((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) |
((is_urgent) ? mojo::Message::kFlagIsUrgent : 0);
const size_t estimated_payload_size =
0;
mojo::Message message(
base::to_underlying(messages::GinJavaBridge::kAddNamedObject), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::content::mojom::internal::GinJavaBridge_AddNamedObject_Params_Data> params(
message);
params.Allocate();
mojo::internal::MessageFragment<
typename decltype(params->name)::BaseType> name_fragment(
params.message());
mojo::internal::Serialize<mojo::StringDataView>(
in_name,
name_fragment);
params->name.Set(
name_fragment.is_null() ? nullptr : name_fragment.data());
MOJO_INTERNAL_CHECK_SERIALIZATION(
mojo::internal::SendValidation::kDefault,
!(params->name.is_null()),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null name in GinJavaBridge.AddNamedObject request");
params->object_id = in_object_id;
mojo::internal::MessageFragment<
typename decltype(params->origin_matcher)::BaseType> origin_matcher_fragment(
params.message());
mojo::internal::Serialize<::origin_matcher::mojom::OriginMatcherDataView>(
in_origin_matcher,
origin_matcher_fragment);
params->origin_matcher.Set(
origin_matcher_fragment.is_null() ? nullptr : origin_matcher_fragment.data());
MOJO_INTERNAL_CHECK_SERIALIZATION(
mojo::internal::SendValidation::kDefault,
!(params->origin_matcher.is_null()),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null origin_matcher in GinJavaBridge.AddNamedObject request");
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(GinJavaBridge::Name_);
message.set_method_name("AddNamedObject");
#endif
// This return value may be ignored as false implies the Connector has
// encountered an error, which will be visible through other means.
::mojo::internal::SendMojoMessage(*receiver_, message);
}
void GinJavaBridgeProxy::RemoveNamedObject(
const std::string& in_name) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send content::mojom::GinJavaBridge::RemoveNamedObject", "input_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("name"), in_name,
"<value of type const std::string&>");
});
#endif
const bool kExpectsResponse = false;
const bool kIsSync = false;
const bool kAllowInterrupt = true;
const bool is_urgent = false;
const uint32_t kFlags =
((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) |
((kIsSync) ? mojo::Message::kFlagIsSync : 0) |
((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) |
((is_urgent) ? mojo::Message::kFlagIsUrgent : 0);
const size_t estimated_payload_size =
0;
mojo::Message message(
base::to_underlying(messages::GinJavaBridge::kRemoveNamedObject), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::content::mojom::internal::GinJavaBridge_RemoveNamedObject_Params_Data> params(
message);
params.Allocate();
mojo::internal::MessageFragment<
typename decltype(params->name)::BaseType> name_fragment(
params.message());
mojo::internal::Serialize<mojo::StringDataView>(
in_name,
name_fragment);
params->name.Set(
name_fragment.is_null() ? nullptr : name_fragment.data());
MOJO_INTERNAL_CHECK_SERIALIZATION(
mojo::internal::SendValidation::kDefault,
!(params->name.is_null()),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null name in GinJavaBridge.RemoveNamedObject request");
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(GinJavaBridge::Name_);
message.set_method_name("RemoveNamedObject");
#endif
// This return value may be ignored as false implies the Connector has
// encountered an error, which will be visible through other means.
::mojo::internal::SendMojoMessage(*receiver_, message);
}
void GinJavaBridgeProxy::SetHost(
::mojo::PendingRemote<GinJavaBridgeHost> in_host) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send content::mojom::GinJavaBridge::SetHost", "input_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("host"), in_host,
"<value of type ::mojo::PendingRemote<GinJavaBridgeHost>>");
});
#endif
const bool kExpectsResponse = false;
const bool kIsSync = false;
const bool kAllowInterrupt = true;
const bool is_urgent = false;
const uint32_t kFlags =
((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) |
((kIsSync) ? mojo::Message::kFlagIsSync : 0) |
((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) |
((is_urgent) ? mojo::Message::kFlagIsUrgent : 0);
const size_t estimated_payload_size =
0;
mojo::Message message(
base::to_underlying(messages::GinJavaBridge::kSetHost), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::content::mojom::internal::GinJavaBridge_SetHost_Params_Data> params(
message);
params.Allocate();
mojo::internal::Serialize<mojo::InterfacePtrDataView<::content::mojom::GinJavaBridgeHostInterfaceBase>>(
in_host,
&params->host,
&params.message());
MOJO_INTERNAL_CHECK_SERIALIZATION(
mojo::internal::SendValidation::kDefault,
!(!mojo::internal::IsHandleOrInterfaceValid(params->host)),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE,
"invalid host in GinJavaBridge.SetHost request");
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(GinJavaBridge::Name_);
message.set_method_name("SetHost");
#endif
// This return value may be ignored as false implies the Connector has
// encountered an error, which will be visible through other means.
::mojo::internal::SendMojoMessage(*receiver_, message);
}
// static
bool GinJavaBridgeStubDispatch::Accept(
GinJavaBridge* impl,
mojo::Message* message) {
switch (static_cast<messages::GinJavaBridge>(message->header()->name)) {
case messages::GinJavaBridge::kAddNamedObject: {
DCHECK(message->is_serialized());
internal::GinJavaBridge_AddNamedObject_Params_Data* params =
reinterpret_cast<internal::GinJavaBridge_AddNamedObject_Params_Data*>(
message->mutable_payload());
// Validation for GinJavaBridge.0
bool success = true;
std::string p_name{};
int32_t p_object_id{};
::origin_matcher::OriginMatcher p_origin_matcher{};
GinJavaBridge_AddNamedObject_ParamsDataView input_data_view(params, message);
if (success && !input_data_view.ReadName(&p_name))
success = false;
if (success)
p_object_id = input_data_view.object_id();
if (success && !input_data_view.ReadOriginMatcher(&p_origin_matcher))
success = false;
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
GinJavaBridge::Name_, 0, false);
return false;
}
// A null |impl| means no implementation was bound.
DCHECK(impl);
impl->AddNamedObject(
std::move(p_name),
std::move(p_object_id),
std::move(p_origin_matcher));
return true;
}
case messages::GinJavaBridge::kRemoveNamedObject: {
DCHECK(message->is_serialized());
internal::GinJavaBridge_RemoveNamedObject_Params_Data* params =
reinterpret_cast<internal::GinJavaBridge_RemoveNamedObject_Params_Data*>(
message->mutable_payload());
// Validation for GinJavaBridge.1
bool success = true;
std::string p_name{};
GinJavaBridge_RemoveNamedObject_ParamsDataView input_data_view(params, message);
if (success && !input_data_view.ReadName(&p_name))
success = false;
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
GinJavaBridge::Name_, 1, false);
return false;
}
// A null |impl| means no implementation was bound.
DCHECK(impl);
impl->RemoveNamedObject(
std::move(p_name));
return true;
}
case messages::GinJavaBridge::kSetHost: {
DCHECK(message->is_serialized());
internal::GinJavaBridge_SetHost_Params_Data* params =
reinterpret_cast<internal::GinJavaBridge_SetHost_Params_Data*>(
message->mutable_payload());
// Validation for GinJavaBridge.2
bool success = true;
::mojo::PendingRemote<GinJavaBridgeHost> p_host{};
GinJavaBridge_SetHost_ParamsDataView input_data_view(params, message);
if (success) {
p_host =
input_data_view.TakeHost<decltype(p_host)>();
}
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
GinJavaBridge::Name_, 2, false);
return false;
}
// A null |impl| means no implementation was bound.
DCHECK(impl);
impl->SetHost(
std::move(p_host));
return true;
}
}
return false;
}
// static
bool GinJavaBridgeStubDispatch::AcceptWithResponder(
GinJavaBridge* impl,
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) {
[[maybe_unused]] const bool message_is_sync =
message->has_flag(mojo::Message::kFlagIsSync);
[[maybe_unused]] const uint64_t request_id = message->request_id();
switch (static_cast<messages::GinJavaBridge>(message->header()->name)) {
case messages::GinJavaBridge::kAddNamedObject: {
break;
}
case messages::GinJavaBridge::kRemoveNamedObject: {
break;
}
case messages::GinJavaBridge::kSetHost: {
break;
}
}
return false;
}
namespace {
} // namespace
static const mojo::internal::GenericValidationInfo kGinJavaBridgeValidationInfo[] = {
{ &internal::GinJavaBridge_AddNamedObject_Params_Data::Validate,
nullptr /* no response */},
{ &internal::GinJavaBridge_RemoveNamedObject_Params_Data::Validate,
nullptr /* no response */},
{ &internal::GinJavaBridge_SetHost_Params_Data::Validate,
nullptr /* no response */},
};
bool GinJavaBridgeRequestValidator::Accept(mojo::Message* message) {
return mojo::internal::ValidateRequestGenericPacked(
message,
::content::mojom::GinJavaBridge::Name_,
kGinJavaBridgeValidationInfo);
}
// The declaration includes the definition on other builds.
GinJavaBridgeRemoteObject::IPCStableHashFunction GinJavaBridgeRemoteObject::MessageToMethodInfo_(mojo::Message& message) {
#if !BUILDFLAG(IS_FUCHSIA)
switch (static_cast<messages::GinJavaBridgeRemoteObject>(message.name())) {
case messages::GinJavaBridgeRemoteObject::kGetMethods: {
return &GinJavaBridgeRemoteObject::GetMethods_Sym::IPCStableHash;
}
case messages::GinJavaBridgeRemoteObject::kHasMethod: {
return &GinJavaBridgeRemoteObject::HasMethod_Sym::IPCStableHash;
}
case messages::GinJavaBridgeRemoteObject::kInvokeMethod: {
return &GinJavaBridgeRemoteObject::InvokeMethod_Sym::IPCStableHash;
}
}
#endif // !BUILDFLAG(IS_FUCHSIA)
return nullptr;
}
const char* GinJavaBridgeRemoteObject::MessageToMethodName_(mojo::Message& message) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
bool is_response = message.has_flag(mojo::Message::kFlagIsResponse);
if (!is_response) {
switch (static_cast<messages::GinJavaBridgeRemoteObject>(message.name())) {
case messages::GinJavaBridgeRemoteObject::kGetMethods:
return "Receive content::mojom::GinJavaBridgeRemoteObject::GetMethods";
case messages::GinJavaBridgeRemoteObject::kHasMethod:
return "Receive content::mojom::GinJavaBridgeRemoteObject::HasMethod";
case messages::GinJavaBridgeRemoteObject::kInvokeMethod:
return "Receive content::mojom::GinJavaBridgeRemoteObject::InvokeMethod";
}
} else {
switch (static_cast<messages::GinJavaBridgeRemoteObject>(message.name())) {
case messages::GinJavaBridgeRemoteObject::kGetMethods:
return "Receive reply content::mojom::GinJavaBridgeRemoteObject::GetMethods";
case messages::GinJavaBridgeRemoteObject::kHasMethod:
return "Receive reply content::mojom::GinJavaBridgeRemoteObject::HasMethod";
case messages::GinJavaBridgeRemoteObject::kInvokeMethod:
return "Receive reply content::mojom::GinJavaBridgeRemoteObject::InvokeMethod";
}
}
return "Receive unknown mojo message";
#else
bool is_response = message.has_flag(mojo::Message::kFlagIsResponse);
if (is_response) {
return "Receive mojo reply";
} else {
return "Receive mojo message";
}
#endif // BUILDFLAG(MOJO_TRACE_ENABLED)
}
#if !BUILDFLAG(IS_FUCHSIA)
uint32_t GinJavaBridgeRemoteObject::GetMethods_Sym::IPCStableHash() {
// This method's address is used for identifying the mojo method name after
// symbolization. So each IPCStableHash should have a unique address.
// We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of
// __LINE__ value, which is not unique across different mojo modules.
// The code below is very similar to NO_CODE_FOLDING, but it uses a unique
// hash instead of __LINE__.
static constexpr uint32_t kHash = 0x705cf5a7; // IPCStableHash for content::mojom::GinJavaBridgeRemoteObject::GetMethods
const uint32_t hash = kHash;
base::debug::Alias(&hash);
return hash;
}
uint32_t GinJavaBridgeRemoteObject::HasMethod_Sym::IPCStableHash() {
// This method's address is used for identifying the mojo method name after
// symbolization. So each IPCStableHash should have a unique address.
// We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of
// __LINE__ value, which is not unique across different mojo modules.
// The code below is very similar to NO_CODE_FOLDING, but it uses a unique
// hash instead of __LINE__.
static constexpr uint32_t kHash = 0xc47d5dac; // IPCStableHash for content::mojom::GinJavaBridgeRemoteObject::HasMethod
const uint32_t hash = kHash;
base::debug::Alias(&hash);
return hash;
}
uint32_t GinJavaBridgeRemoteObject::InvokeMethod_Sym::IPCStableHash() {
// This method's address is used for identifying the mojo method name after
// symbolization. So each IPCStableHash should have a unique address.
// We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of
// __LINE__ value, which is not unique across different mojo modules.
// The code below is very similar to NO_CODE_FOLDING, but it uses a unique
// hash instead of __LINE__.
static constexpr uint32_t kHash = 0xdfa97aa1; // IPCStableHash for content::mojom::GinJavaBridgeRemoteObject::InvokeMethod
const uint32_t hash = kHash;
base::debug::Alias(&hash);
return hash;
}
# endif // !BUILDFLAG(IS_FUCHSIA)
bool GinJavaBridgeRemoteObject::GetMethods(std::vector<std::string>* out_method_names) {
NOTREACHED();
}
bool GinJavaBridgeRemoteObject::HasMethod(const std::string& method_name, bool* out_result) {
NOTREACHED();
}
bool GinJavaBridgeRemoteObject::InvokeMethod(const std::string& method_name, ::base::Value::List arguments, GinJavaBridgeError* out_error_code, ::base::Value::List* out_result) {
NOTREACHED();
}
class GinJavaBridgeRemoteObject_GetMethods_HandleSyncResponse
: public mojo::MessageReceiver {
public:
GinJavaBridgeRemoteObject_GetMethods_HandleSyncResponse(
bool* result, std::vector<std::string>* out_method_names)
: result_(result), out_method_names_(out_method_names) {
DCHECK(!*result_);
}
GinJavaBridgeRemoteObject_GetMethods_HandleSyncResponse(const GinJavaBridgeRemoteObject_GetMethods_HandleSyncResponse&) = delete;
GinJavaBridgeRemoteObject_GetMethods_HandleSyncResponse& operator=(const GinJavaBridgeRemoteObject_GetMethods_HandleSyncResponse&) = delete;
bool Accept(mojo::Message* message) override;
private:
bool* result_;
std::vector<std::string>* out_method_names_;};
class GinJavaBridgeRemoteObject_GetMethods_ForwardToCallback
: public mojo::MessageReceiver {
public:
GinJavaBridgeRemoteObject_GetMethods_ForwardToCallback(
GinJavaBridgeRemoteObject::GetMethodsCallback callback
) : callback_(std::move(callback)) {
}
GinJavaBridgeRemoteObject_GetMethods_ForwardToCallback(const GinJavaBridgeRemoteObject_GetMethods_ForwardToCallback&) = delete;
GinJavaBridgeRemoteObject_GetMethods_ForwardToCallback& operator=(const GinJavaBridgeRemoteObject_GetMethods_ForwardToCallback&) = delete;
bool Accept(mojo::Message* message) override;
private:
GinJavaBridgeRemoteObject::GetMethodsCallback callback_;
};
class GinJavaBridgeRemoteObject_HasMethod_HandleSyncResponse
: public mojo::MessageReceiver {
public:
GinJavaBridgeRemoteObject_HasMethod_HandleSyncResponse(
bool* result, bool* out_result)
: result_(result), out_result_(out_result) {
DCHECK(!*result_);
}
GinJavaBridgeRemoteObject_HasMethod_HandleSyncResponse(const GinJavaBridgeRemoteObject_HasMethod_HandleSyncResponse&) = delete;
GinJavaBridgeRemoteObject_HasMethod_HandleSyncResponse& operator=(const GinJavaBridgeRemoteObject_HasMethod_HandleSyncResponse&) = delete;
bool Accept(mojo::Message* message) override;
private:
bool* result_;
bool* out_result_;};
class GinJavaBridgeRemoteObject_HasMethod_ForwardToCallback
: public mojo::MessageReceiver {
public:
GinJavaBridgeRemoteObject_HasMethod_ForwardToCallback(
GinJavaBridgeRemoteObject::HasMethodCallback callback
) : callback_(std::move(callback)) {
}
GinJavaBridgeRemoteObject_HasMethod_ForwardToCallback(const GinJavaBridgeRemoteObject_HasMethod_ForwardToCallback&) = delete;
GinJavaBridgeRemoteObject_HasMethod_ForwardToCallback& operator=(const GinJavaBridgeRemoteObject_HasMethod_ForwardToCallback&) = delete;
bool Accept(mojo::Message* message) override;
private:
GinJavaBridgeRemoteObject::HasMethodCallback callback_;
};
class GinJavaBridgeRemoteObject_InvokeMethod_HandleSyncResponse
: public mojo::MessageReceiver {
public:
GinJavaBridgeRemoteObject_InvokeMethod_HandleSyncResponse(
bool* result, GinJavaBridgeError* out_error_code, ::base::Value::List* out_result)
: result_(result), out_error_code_(out_error_code), out_result_(out_result) {
DCHECK(!*result_);
}
GinJavaBridgeRemoteObject_InvokeMethod_HandleSyncResponse(const GinJavaBridgeRemoteObject_InvokeMethod_HandleSyncResponse&) = delete;
GinJavaBridgeRemoteObject_InvokeMethod_HandleSyncResponse& operator=(const GinJavaBridgeRemoteObject_InvokeMethod_HandleSyncResponse&) = delete;
bool Accept(mojo::Message* message) override;
private:
bool* result_;
GinJavaBridgeError* out_error_code_;
::base::Value::List* out_result_;};
class GinJavaBridgeRemoteObject_InvokeMethod_ForwardToCallback
: public mojo::MessageReceiver {
public:
GinJavaBridgeRemoteObject_InvokeMethod_ForwardToCallback(
GinJavaBridgeRemoteObject::InvokeMethodCallback callback
) : callback_(std::move(callback)) {
}
GinJavaBridgeRemoteObject_InvokeMethod_ForwardToCallback(const GinJavaBridgeRemoteObject_InvokeMethod_ForwardToCallback&) = delete;
GinJavaBridgeRemoteObject_InvokeMethod_ForwardToCallback& operator=(const GinJavaBridgeRemoteObject_InvokeMethod_ForwardToCallback&) = delete;
bool Accept(mojo::Message* message) override;
private:
GinJavaBridgeRemoteObject::InvokeMethodCallback callback_;
};
GinJavaBridgeRemoteObjectProxy::GinJavaBridgeRemoteObjectProxy(mojo::MessageReceiverWithResponder* receiver)
: receiver_(receiver) {
}
bool GinJavaBridgeRemoteObjectProxy::GetMethods(
std::vector<std::string>* out_param_method_names) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT_BEGIN0("mojom", "Call content::mojom::GinJavaBridgeRemoteObject::GetMethods (sync)");
#else
TRACE_EVENT0("mojom", "GinJavaBridgeRemoteObject::GetMethods");
#endif
const bool kExpectsResponse = true;
const bool kIsSync = true;
const bool kAllowInterrupt =
true;
const bool is_urgent = false;
const uint32_t kFlags =
((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) |
((kIsSync) ? mojo::Message::kFlagIsSync : 0) |
((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) |
((is_urgent) ? mojo::Message::kFlagIsUrgent : 0);
const size_t estimated_payload_size =
0;
mojo::Message message(
base::to_underlying(messages::GinJavaBridgeRemoteObject::kGetMethods), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::content::mojom::internal::GinJavaBridgeRemoteObject_GetMethods_Params_Data> params(
message);
params.Allocate();
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(GinJavaBridgeRemoteObject::Name_);
message.set_method_name("GetMethods");
#endif
bool result = false;
std::unique_ptr<mojo::MessageReceiver> responder(
new GinJavaBridgeRemoteObject_GetMethods_HandleSyncResponse(
&result, out_param_method_names));
::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder));
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT_END1(
"mojom", "GinJavaBridgeRemoteObject::GetMethods", "sync_response_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("method_names"), out_param_method_names,
"<value of type const std::vector<std::string>&>");
});
#endif
return result;
}
void GinJavaBridgeRemoteObjectProxy::GetMethods(
GetMethodsCallback callback) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT0("mojom", "Send content::mojom::GinJavaBridgeRemoteObject::GetMethods");
#endif
const bool kExpectsResponse = true;
const bool kIsSync = false;
const bool kAllowInterrupt = true;
const bool is_urgent = false;
const uint32_t kFlags =
((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) |
((kIsSync) ? mojo::Message::kFlagIsSync : 0) |
((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) |
((is_urgent) ? mojo::Message::kFlagIsUrgent : 0);
const size_t estimated_payload_size =
0;
mojo::Message message(
base::to_underlying(messages::GinJavaBridgeRemoteObject::kGetMethods), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::content::mojom::internal::GinJavaBridgeRemoteObject_GetMethods_Params_Data> params(
message);
params.Allocate();
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(GinJavaBridgeRemoteObject::Name_);
message.set_method_name("GetMethods");
#endif
std::unique_ptr<mojo::MessageReceiver> responder(
new GinJavaBridgeRemoteObject_GetMethods_ForwardToCallback(
std::move(callback)));
::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder));
}
bool GinJavaBridgeRemoteObjectProxy::HasMethod(
const std::string& param_method_name, bool* out_param_result) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT_BEGIN1(
"mojom", "Call content::mojom::GinJavaBridgeRemoteObject::HasMethod (sync)", "input_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("method_name"), param_method_name,
"<value of type const std::string&>");
});
#else
TRACE_EVENT0("mojom", "GinJavaBridgeRemoteObject::HasMethod");
#endif
const bool kExpectsResponse = true;
const bool kIsSync = true;
const bool kAllowInterrupt =
true;
const bool is_urgent = false;
const uint32_t kFlags =
((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) |
((kIsSync) ? mojo::Message::kFlagIsSync : 0) |
((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) |
((is_urgent) ? mojo::Message::kFlagIsUrgent : 0);
const size_t estimated_payload_size =
0;
mojo::Message message(
base::to_underlying(messages::GinJavaBridgeRemoteObject::kHasMethod), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::content::mojom::internal::GinJavaBridgeRemoteObject_HasMethod_Params_Data> params(
message);
params.Allocate();
mojo::internal::MessageFragment<
typename decltype(params->method_name)::BaseType> method_name_fragment(
params.message());
mojo::internal::Serialize<mojo::StringDataView>(
param_method_name,
method_name_fragment);
params->method_name.Set(
method_name_fragment.is_null() ? nullptr : method_name_fragment.data());
MOJO_INTERNAL_CHECK_SERIALIZATION(
mojo::internal::SendValidation::kDefault,
!(params->method_name.is_null()),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null method_name in GinJavaBridgeRemoteObject.HasMethod request");
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(GinJavaBridgeRemoteObject::Name_);
message.set_method_name("HasMethod");
#endif
bool result = false;
std::unique_ptr<mojo::MessageReceiver> responder(
new GinJavaBridgeRemoteObject_HasMethod_HandleSyncResponse(
&result, out_param_result));
::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder));
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT_END1(
"mojom", "GinJavaBridgeRemoteObject::HasMethod", "sync_response_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("result"), out_param_result,
"<value of type bool>");
});
#endif
return result;
}
void GinJavaBridgeRemoteObjectProxy::HasMethod(
const std::string& in_method_name, HasMethodCallback callback) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send content::mojom::GinJavaBridgeRemoteObject::HasMethod", "input_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("method_name"), in_method_name,
"<value of type const std::string&>");
});
#endif
const bool kExpectsResponse = true;
const bool kIsSync = false;
const bool kAllowInterrupt = true;
const bool is_urgent = false;
const uint32_t kFlags =
((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) |
((kIsSync) ? mojo::Message::kFlagIsSync : 0) |
((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) |
((is_urgent) ? mojo::Message::kFlagIsUrgent : 0);
const size_t estimated_payload_size =
0;
mojo::Message message(
base::to_underlying(messages::GinJavaBridgeRemoteObject::kHasMethod), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::content::mojom::internal::GinJavaBridgeRemoteObject_HasMethod_Params_Data> params(
message);
params.Allocate();
mojo::internal::MessageFragment<
typename decltype(params->method_name)::BaseType> method_name_fragment(
params.message());
mojo::internal::Serialize<mojo::StringDataView>(
in_method_name,
method_name_fragment);
params->method_name.Set(
method_name_fragment.is_null() ? nullptr : method_name_fragment.data());
MOJO_INTERNAL_CHECK_SERIALIZATION(
mojo::internal::SendValidation::kDefault,
!(params->method_name.is_null()),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null method_name in GinJavaBridgeRemoteObject.HasMethod request");
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(GinJavaBridgeRemoteObject::Name_);
message.set_method_name("HasMethod");
#endif
std::unique_ptr<mojo::MessageReceiver> responder(
new GinJavaBridgeRemoteObject_HasMethod_ForwardToCallback(
std::move(callback)));
::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder));
}
bool GinJavaBridgeRemoteObjectProxy::InvokeMethod(
const std::string& param_method_name, ::base::Value::List param_arguments, GinJavaBridgeError* out_param_error_code, ::base::Value::List* out_param_result) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT_BEGIN1(
"mojom", "Call content::mojom::GinJavaBridgeRemoteObject::InvokeMethod (sync)", "input_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("method_name"), param_method_name,
"<value of type const std::string&>");
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("arguments"), param_arguments,
"<value of type ::base::Value::List>");
});
#else
TRACE_EVENT0("mojom", "GinJavaBridgeRemoteObject::InvokeMethod");
#endif
const bool kExpectsResponse = true;
const bool kIsSync = true;
const bool kAllowInterrupt =
true;
const bool is_urgent = false;
const uint32_t kFlags =
((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) |
((kIsSync) ? mojo::Message::kFlagIsSync : 0) |
((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) |
((is_urgent) ? mojo::Message::kFlagIsUrgent : 0);
const size_t estimated_payload_size =
0;
mojo::Message message(
base::to_underlying(messages::GinJavaBridgeRemoteObject::kInvokeMethod), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::content::mojom::internal::GinJavaBridgeRemoteObject_InvokeMethod_Params_Data> params(
message);
params.Allocate();
mojo::internal::MessageFragment<
typename decltype(params->method_name)::BaseType> method_name_fragment(
params.message());
mojo::internal::Serialize<mojo::StringDataView>(
param_method_name,
method_name_fragment);
params->method_name.Set(
method_name_fragment.is_null() ? nullptr : method_name_fragment.data());
MOJO_INTERNAL_CHECK_SERIALIZATION(
mojo::internal::SendValidation::kDefault,
!(params->method_name.is_null()),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null method_name in GinJavaBridgeRemoteObject.InvokeMethod request");
mojo::internal::MessageFragment<
typename decltype(params->arguments)::BaseType> arguments_fragment(
params.message());
mojo::internal::Serialize<::mojo_base::mojom::ListValueDataView>(
param_arguments,
arguments_fragment);
params->arguments.Set(
arguments_fragment.is_null() ? nullptr : arguments_fragment.data());
MOJO_INTERNAL_CHECK_SERIALIZATION(
mojo::internal::SendValidation::kDefault,
!(params->arguments.is_null()),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null arguments in GinJavaBridgeRemoteObject.InvokeMethod request");
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(GinJavaBridgeRemoteObject::Name_);
message.set_method_name("InvokeMethod");
#endif
bool result = false;
std::unique_ptr<mojo::MessageReceiver> responder(
new GinJavaBridgeRemoteObject_InvokeMethod_HandleSyncResponse(
&result, out_param_error_code, out_param_result));
::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder));
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT_END1(
"mojom", "GinJavaBridgeRemoteObject::InvokeMethod", "sync_response_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("error_code"), out_param_error_code,
"<value of type GinJavaBridgeError>");
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("result"), out_param_result,
"<value of type ::base::Value::List>");
});
#endif
return result;
}
void GinJavaBridgeRemoteObjectProxy::InvokeMethod(
const std::string& in_method_name, ::base::Value::List in_arguments, InvokeMethodCallback callback) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send content::mojom::GinJavaBridgeRemoteObject::InvokeMethod", "input_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("method_name"), in_method_name,
"<value of type const std::string&>");
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("arguments"), in_arguments,
"<value of type ::base::Value::List>");
});
#endif
const bool kExpectsResponse = true;
const bool kIsSync = false;
const bool kAllowInterrupt = true;
const bool is_urgent = false;
const uint32_t kFlags =
((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) |
((kIsSync) ? mojo::Message::kFlagIsSync : 0) |
((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) |
((is_urgent) ? mojo::Message::kFlagIsUrgent : 0);
const size_t estimated_payload_size =
0;
mojo::Message message(
base::to_underlying(messages::GinJavaBridgeRemoteObject::kInvokeMethod), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::content::mojom::internal::GinJavaBridgeRemoteObject_InvokeMethod_Params_Data> params(
message);
params.Allocate();
mojo::internal::MessageFragment<
typename decltype(params->method_name)::BaseType> method_name_fragment(
params.message());
mojo::internal::Serialize<mojo::StringDataView>(
in_method_name,
method_name_fragment);
params->method_name.Set(
method_name_fragment.is_null() ? nullptr : method_name_fragment.data());
MOJO_INTERNAL_CHECK_SERIALIZATION(
mojo::internal::SendValidation::kDefault,
!(params->method_name.is_null()),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null method_name in GinJavaBridgeRemoteObject.InvokeMethod request");
mojo::internal::MessageFragment<
typename decltype(params->arguments)::BaseType> arguments_fragment(
params.message());
mojo::internal::Serialize<::mojo_base::mojom::ListValueDataView>(
in_arguments,
arguments_fragment);
params->arguments.Set(
arguments_fragment.is_null() ? nullptr : arguments_fragment.data());
MOJO_INTERNAL_CHECK_SERIALIZATION(
mojo::internal::SendValidation::kDefault,
!(params->arguments.is_null()),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null arguments in GinJavaBridgeRemoteObject.InvokeMethod request");
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(GinJavaBridgeRemoteObject::Name_);
message.set_method_name("InvokeMethod");
#endif
std::unique_ptr<mojo::MessageReceiver> responder(
new GinJavaBridgeRemoteObject_InvokeMethod_ForwardToCallback(
std::move(callback)));
::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder));
}
class GinJavaBridgeRemoteObject_GetMethods_ProxyToResponder : public ::mojo::internal::ProxyToResponder {
public:
static GinJavaBridgeRemoteObject::GetMethodsCallback CreateCallback(
::mojo::Message& message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) {
std::unique_ptr<GinJavaBridgeRemoteObject_GetMethods_ProxyToResponder> proxy(
new GinJavaBridgeRemoteObject_GetMethods_ProxyToResponder(
message, std::move(responder)));
return base::BindOnce(&GinJavaBridgeRemoteObject_GetMethods_ProxyToResponder::Run,
std::move(proxy));
}
~GinJavaBridgeRemoteObject_GetMethods_ProxyToResponder() {
#if DCHECK_IS_ON()
if (responder_) {
// If we're being destroyed without being run, we want to ensure the
// binding endpoint has been closed. This checks for that asynchronously.
// We pass a bound generated callback to handle the response so that any
// resulting DCHECK stack will have useful interface type information.
// Instantiate a ScopedFizzleBlockShutdownTasks to allow this request to
// fizzle if this happens after shutdown and the endpoint is bound to a
// BLOCK_SHUTDOWN sequence.
base::ThreadPoolInstance::ScopedFizzleBlockShutdownTasks fizzler;
responder_->IsConnectedAsync(base::BindOnce(&OnIsConnectedComplete));
}
#endif
}
private:
GinJavaBridgeRemoteObject_GetMethods_ProxyToResponder(
::mojo::Message& message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder)
: ::mojo::internal::ProxyToResponder(message, std::move(responder)) {
}
#if DCHECK_IS_ON()
static void OnIsConnectedComplete(bool connected) {
DCHECK(!connected)
<< "GinJavaBridgeRemoteObject::GetMethodsCallback was destroyed without "
<< "first either being run or its corresponding binding being closed. "
<< "It is an error to drop response callbacks which still correspond "
<< "to an open interface pipe.";
}
#endif
void Run(
const std::vector<std::string>& in_method_names);
};
bool GinJavaBridgeRemoteObject_GetMethods_ForwardToCallback::Accept(
mojo::Message* message) {
DCHECK(message->is_serialized());
internal::GinJavaBridgeRemoteObject_GetMethods_ResponseParams_Data* params =
reinterpret_cast<
internal::GinJavaBridgeRemoteObject_GetMethods_ResponseParams_Data*>(
message->mutable_payload());
// Validation for GinJavaBridgeRemoteObject.0
bool success = true;
std::vector<std::string> p_method_names{};
GinJavaBridgeRemoteObject_GetMethods_ResponseParamsDataView input_data_view(params, message);
if (success && !input_data_view.ReadMethodNames(&p_method_names))
success = false;
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
GinJavaBridgeRemoteObject::Name_, 0, true);
return false;
}
if (!callback_.is_null()) {
std::move(callback_).Run(
std::move(p_method_names));
}
return true;
}
void GinJavaBridgeRemoteObject_GetMethods_ProxyToResponder::Run(
const std::vector<std::string>& in_method_names) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send reply content::mojom::GinJavaBridgeRemoteObject::GetMethods", "async_response_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("method_names"), in_method_names,
"<value of type const std::vector<std::string>&>");
});
#endif
const uint32_t kFlags = mojo::Message::kFlagIsResponse |
((is_sync_) ? mojo::Message::kFlagIsSync : 0) |
((true) ? 0 : mojo::Message::kFlagNoInterrupt) |
((false) ? mojo::Message::kFlagIsUrgent : 0);
const size_t estimated_payload_size =
0;
mojo::Message message(
base::to_underlying(messages::GinJavaBridgeRemoteObject::kGetMethods), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::content::mojom::internal::GinJavaBridgeRemoteObject_GetMethods_ResponseParams_Data> params(
message);
params.Allocate();
mojo::internal::MessageFragment<
typename decltype(params->method_names)::BaseType>
method_names_fragment(params.message());
constexpr const mojo::internal::ContainerValidateParams& method_names_validate_params =
mojo::internal::GetArrayValidator<0, false, &mojo::internal::GetArrayValidator<0, false, nullptr>()>();
mojo::internal::Serialize<mojo::ArrayDataView<mojo::StringDataView>>(
in_method_names,
method_names_fragment,
&method_names_validate_params);
params->method_names.Set(
method_names_fragment.is_null() ? nullptr : method_names_fragment.data());
MOJO_INTERNAL_CHECK_SERIALIZATION(
mojo::internal::SendValidation::kDefault,
!(params->method_names.is_null()),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null method_names in ");
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(GinJavaBridgeRemoteObject::Name_);
message.set_method_name("GetMethods");
#endif
message.set_request_id(request_id_);
message.set_trace_nonce(trace_nonce_);
::mojo::internal::SendMojoMessage(*responder_, message);
// SendMojoMessage() fails silently if the responder connection is closed,
// or if the message is malformed.
//
// TODO(darin): If Accept() returns false due to a malformed message, that
// may be good reason to close the connection. However, we don't have a
// way to do that from here. We should add a way.
responder_ = nullptr;
}
bool GinJavaBridgeRemoteObject_GetMethods_HandleSyncResponse::Accept(
mojo::Message* message) {
DCHECK(message->is_serialized());
internal::GinJavaBridgeRemoteObject_GetMethods_ResponseParams_Data* params =
reinterpret_cast<internal::GinJavaBridgeRemoteObject_GetMethods_ResponseParams_Data*>(
message->mutable_payload());
// Validation for GinJavaBridgeRemoteObject.0
bool success = true;
std::vector<std::string> p_method_names{};
GinJavaBridgeRemoteObject_GetMethods_ResponseParamsDataView input_data_view(params, message);
if (success && !input_data_view.ReadMethodNames(&p_method_names))
success = false;
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
GinJavaBridgeRemoteObject::Name_, 0, true);
return false;
}
*out_method_names_ = std::move(p_method_names);
*result_ = true;
return true;
}
class GinJavaBridgeRemoteObject_HasMethod_ProxyToResponder : public ::mojo::internal::ProxyToResponder {
public:
static GinJavaBridgeRemoteObject::HasMethodCallback CreateCallback(
::mojo::Message& message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) {
std::unique_ptr<GinJavaBridgeRemoteObject_HasMethod_ProxyToResponder> proxy(
new GinJavaBridgeRemoteObject_HasMethod_ProxyToResponder(
message, std::move(responder)));
return base::BindOnce(&GinJavaBridgeRemoteObject_HasMethod_ProxyToResponder::Run,
std::move(proxy));
}
~GinJavaBridgeRemoteObject_HasMethod_ProxyToResponder() {
#if DCHECK_IS_ON()
if (responder_) {
// If we're being destroyed without being run, we want to ensure the
// binding endpoint has been closed. This checks for that asynchronously.
// We pass a bound generated callback to handle the response so that any
// resulting DCHECK stack will have useful interface type information.
// Instantiate a ScopedFizzleBlockShutdownTasks to allow this request to
// fizzle if this happens after shutdown and the endpoint is bound to a
// BLOCK_SHUTDOWN sequence.
base::ThreadPoolInstance::ScopedFizzleBlockShutdownTasks fizzler;
responder_->IsConnectedAsync(base::BindOnce(&OnIsConnectedComplete));
}
#endif
}
private:
GinJavaBridgeRemoteObject_HasMethod_ProxyToResponder(
::mojo::Message& message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder)
: ::mojo::internal::ProxyToResponder(message, std::move(responder)) {
}
#if DCHECK_IS_ON()
static void OnIsConnectedComplete(bool connected) {
DCHECK(!connected)
<< "GinJavaBridgeRemoteObject::HasMethodCallback was destroyed without "
<< "first either being run or its corresponding binding being closed. "
<< "It is an error to drop response callbacks which still correspond "
<< "to an open interface pipe.";
}
#endif
void Run(
bool in_result);
};
bool GinJavaBridgeRemoteObject_HasMethod_ForwardToCallback::Accept(
mojo::Message* message) {
DCHECK(message->is_serialized());
internal::GinJavaBridgeRemoteObject_HasMethod_ResponseParams_Data* params =
reinterpret_cast<
internal::GinJavaBridgeRemoteObject_HasMethod_ResponseParams_Data*>(
message->mutable_payload());
// Validation for GinJavaBridgeRemoteObject.1
bool success = true;
bool p_result{};
GinJavaBridgeRemoteObject_HasMethod_ResponseParamsDataView input_data_view(params, message);
if (success)
p_result = input_data_view.result();
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
GinJavaBridgeRemoteObject::Name_, 1, true);
return false;
}
if (!callback_.is_null()) {
std::move(callback_).Run(
std::move(p_result));
}
return true;
}
void GinJavaBridgeRemoteObject_HasMethod_ProxyToResponder::Run(
bool in_result) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send reply content::mojom::GinJavaBridgeRemoteObject::HasMethod", "async_response_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("result"), in_result,
"<value of type bool>");
});
#endif
const uint32_t kFlags = mojo::Message::kFlagIsResponse |
((is_sync_) ? mojo::Message::kFlagIsSync : 0) |
((true) ? 0 : mojo::Message::kFlagNoInterrupt) |
((false) ? mojo::Message::kFlagIsUrgent : 0);
const size_t estimated_payload_size =
0;
mojo::Message message(
base::to_underlying(messages::GinJavaBridgeRemoteObject::kHasMethod), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::content::mojom::internal::GinJavaBridgeRemoteObject_HasMethod_ResponseParams_Data> params(
message);
params.Allocate();
params->result = in_result;
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(GinJavaBridgeRemoteObject::Name_);
message.set_method_name("HasMethod");
#endif
message.set_request_id(request_id_);
message.set_trace_nonce(trace_nonce_);
::mojo::internal::SendMojoMessage(*responder_, message);
// SendMojoMessage() fails silently if the responder connection is closed,
// or if the message is malformed.
//
// TODO(darin): If Accept() returns false due to a malformed message, that
// may be good reason to close the connection. However, we don't have a
// way to do that from here. We should add a way.
responder_ = nullptr;
}
bool GinJavaBridgeRemoteObject_HasMethod_HandleSyncResponse::Accept(
mojo::Message* message) {
DCHECK(message->is_serialized());
internal::GinJavaBridgeRemoteObject_HasMethod_ResponseParams_Data* params =
reinterpret_cast<internal::GinJavaBridgeRemoteObject_HasMethod_ResponseParams_Data*>(
message->mutable_payload());
// Validation for GinJavaBridgeRemoteObject.1
bool success = true;
bool p_result{};
GinJavaBridgeRemoteObject_HasMethod_ResponseParamsDataView input_data_view(params, message);
if (success)
p_result = input_data_view.result();
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
GinJavaBridgeRemoteObject::Name_, 1, true);
return false;
}
*out_result_ = std::move(p_result);
*result_ = true;
return true;
}
class GinJavaBridgeRemoteObject_InvokeMethod_ProxyToResponder : public ::mojo::internal::ProxyToResponder {
public:
static GinJavaBridgeRemoteObject::InvokeMethodCallback CreateCallback(
::mojo::Message& message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) {
std::unique_ptr<GinJavaBridgeRemoteObject_InvokeMethod_ProxyToResponder> proxy(
new GinJavaBridgeRemoteObject_InvokeMethod_ProxyToResponder(
message, std::move(responder)));
return base::BindOnce(&GinJavaBridgeRemoteObject_InvokeMethod_ProxyToResponder::Run,
std::move(proxy));
}
~GinJavaBridgeRemoteObject_InvokeMethod_ProxyToResponder() {
#if DCHECK_IS_ON()
if (responder_) {
// If we're being destroyed without being run, we want to ensure the
// binding endpoint has been closed. This checks for that asynchronously.
// We pass a bound generated callback to handle the response so that any
// resulting DCHECK stack will have useful interface type information.
// Instantiate a ScopedFizzleBlockShutdownTasks to allow this request to
// fizzle if this happens after shutdown and the endpoint is bound to a
// BLOCK_SHUTDOWN sequence.
base::ThreadPoolInstance::ScopedFizzleBlockShutdownTasks fizzler;
responder_->IsConnectedAsync(base::BindOnce(&OnIsConnectedComplete));
}
#endif
}
private:
GinJavaBridgeRemoteObject_InvokeMethod_ProxyToResponder(
::mojo::Message& message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder)
: ::mojo::internal::ProxyToResponder(message, std::move(responder)) {
}
#if DCHECK_IS_ON()
static void OnIsConnectedComplete(bool connected) {
DCHECK(!connected)
<< "GinJavaBridgeRemoteObject::InvokeMethodCallback was destroyed without "
<< "first either being run or its corresponding binding being closed. "
<< "It is an error to drop response callbacks which still correspond "
<< "to an open interface pipe.";
}
#endif
void Run(
GinJavaBridgeError in_error_code, ::base::Value::List in_result);
};
bool GinJavaBridgeRemoteObject_InvokeMethod_ForwardToCallback::Accept(
mojo::Message* message) {
DCHECK(message->is_serialized());
internal::GinJavaBridgeRemoteObject_InvokeMethod_ResponseParams_Data* params =
reinterpret_cast<
internal::GinJavaBridgeRemoteObject_InvokeMethod_ResponseParams_Data*>(
message->mutable_payload());
// Validation for GinJavaBridgeRemoteObject.2
bool success = true;
GinJavaBridgeError p_error_code{};
::base::Value::List p_result{};
GinJavaBridgeRemoteObject_InvokeMethod_ResponseParamsDataView input_data_view(params, message);
if (success && !input_data_view.ReadErrorCode(&p_error_code))
success = false;
if (success && !input_data_view.ReadResult(&p_result))
success = false;
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
GinJavaBridgeRemoteObject::Name_, 2, true);
return false;
}
if (!callback_.is_null()) {
std::move(callback_).Run(
std::move(p_error_code),
std::move(p_result));
}
return true;
}
void GinJavaBridgeRemoteObject_InvokeMethod_ProxyToResponder::Run(
GinJavaBridgeError in_error_code, ::base::Value::List in_result) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send reply content::mojom::GinJavaBridgeRemoteObject::InvokeMethod", "async_response_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("error_code"), in_error_code,
"<value of type GinJavaBridgeError>");
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("result"), in_result,
"<value of type ::base::Value::List>");
});
#endif
const uint32_t kFlags = mojo::Message::kFlagIsResponse |
((is_sync_) ? mojo::Message::kFlagIsSync : 0) |
((true) ? 0 : mojo::Message::kFlagNoInterrupt) |
((false) ? mojo::Message::kFlagIsUrgent : 0);
const size_t estimated_payload_size =
0;
mojo::Message message(
base::to_underlying(messages::GinJavaBridgeRemoteObject::kInvokeMethod), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::content::mojom::internal::GinJavaBridgeRemoteObject_InvokeMethod_ResponseParams_Data> params(
message);
params.Allocate();
mojo::internal::Serialize<::content::mojom::GinJavaBridgeError>(
in_error_code,
&params->error_code);
mojo::internal::MessageFragment<
typename decltype(params->result)::BaseType> result_fragment(
params.message());
mojo::internal::Serialize<::mojo_base::mojom::ListValueDataView>(
in_result,
result_fragment);
params->result.Set(
result_fragment.is_null() ? nullptr : result_fragment.data());
MOJO_INTERNAL_CHECK_SERIALIZATION(
mojo::internal::SendValidation::kDefault,
!(params->result.is_null()),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null result in ");
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(GinJavaBridgeRemoteObject::Name_);
message.set_method_name("InvokeMethod");
#endif
message.set_request_id(request_id_);
message.set_trace_nonce(trace_nonce_);
::mojo::internal::SendMojoMessage(*responder_, message);
// SendMojoMessage() fails silently if the responder connection is closed,
// or if the message is malformed.
//
// TODO(darin): If Accept() returns false due to a malformed message, that
// may be good reason to close the connection. However, we don't have a
// way to do that from here. We should add a way.
responder_ = nullptr;
}
bool GinJavaBridgeRemoteObject_InvokeMethod_HandleSyncResponse::Accept(
mojo::Message* message) {
DCHECK(message->is_serialized());
internal::GinJavaBridgeRemoteObject_InvokeMethod_ResponseParams_Data* params =
reinterpret_cast<internal::GinJavaBridgeRemoteObject_InvokeMethod_ResponseParams_Data*>(
message->mutable_payload());
// Validation for GinJavaBridgeRemoteObject.2
bool success = true;
GinJavaBridgeError p_error_code{};
::base::Value::List p_result{};
GinJavaBridgeRemoteObject_InvokeMethod_ResponseParamsDataView input_data_view(params, message);
if (success && !input_data_view.ReadErrorCode(&p_error_code))
success = false;
if (success && !input_data_view.ReadResult(&p_result))
success = false;
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
GinJavaBridgeRemoteObject::Name_, 2, true);
return false;
}
*out_error_code_ = std::move(p_error_code);
*out_result_ = std::move(p_result);
*result_ = true;
return true;
}
// static
bool GinJavaBridgeRemoteObjectStubDispatch::Accept(
GinJavaBridgeRemoteObject* impl,
mojo::Message* message) {
switch (static_cast<messages::GinJavaBridgeRemoteObject>(message->header()->name)) {
case messages::GinJavaBridgeRemoteObject::kGetMethods: {
break;
}
case messages::GinJavaBridgeRemoteObject::kHasMethod: {
break;
}
case messages::GinJavaBridgeRemoteObject::kInvokeMethod: {
break;
}
}
return false;
}
// static
bool GinJavaBridgeRemoteObjectStubDispatch::AcceptWithResponder(
GinJavaBridgeRemoteObject* impl,
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) {
[[maybe_unused]] const bool message_is_sync =
message->has_flag(mojo::Message::kFlagIsSync);
[[maybe_unused]] const uint64_t request_id = message->request_id();
switch (static_cast<messages::GinJavaBridgeRemoteObject>(message->header()->name)) {
case messages::GinJavaBridgeRemoteObject::kGetMethods: {
internal::GinJavaBridgeRemoteObject_GetMethods_Params_Data* params =
reinterpret_cast<
internal::GinJavaBridgeRemoteObject_GetMethods_Params_Data*>(
message->mutable_payload());
// Validation for GinJavaBridgeRemoteObject.0
bool success = true;
GinJavaBridgeRemoteObject_GetMethods_ParamsDataView input_data_view(params, message);
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
GinJavaBridgeRemoteObject::Name_, 0, false);
return false;
}
auto callback =
GinJavaBridgeRemoteObject_GetMethods_ProxyToResponder::CreateCallback(
*message, std::move(responder));
// A null |impl| means no implementation was bound.
DCHECK(impl);
impl->GetMethods(std::move(callback));
return true;
}
case messages::GinJavaBridgeRemoteObject::kHasMethod: {
internal::GinJavaBridgeRemoteObject_HasMethod_Params_Data* params =
reinterpret_cast<
internal::GinJavaBridgeRemoteObject_HasMethod_Params_Data*>(
message->mutable_payload());
// Validation for GinJavaBridgeRemoteObject.1
bool success = true;
std::string p_method_name{};
GinJavaBridgeRemoteObject_HasMethod_ParamsDataView input_data_view(params, message);
if (success && !input_data_view.ReadMethodName(&p_method_name))
success = false;
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
GinJavaBridgeRemoteObject::Name_, 1, false);
return false;
}
auto callback =
GinJavaBridgeRemoteObject_HasMethod_ProxyToResponder::CreateCallback(
*message, std::move(responder));
// A null |impl| means no implementation was bound.
DCHECK(impl);
impl->HasMethod(
std::move(p_method_name), std::move(callback));
return true;
}
case messages::GinJavaBridgeRemoteObject::kInvokeMethod: {
internal::GinJavaBridgeRemoteObject_InvokeMethod_Params_Data* params =
reinterpret_cast<
internal::GinJavaBridgeRemoteObject_InvokeMethod_Params_Data*>(
message->mutable_payload());
// Validation for GinJavaBridgeRemoteObject.2
bool success = true;
std::string p_method_name{};
::base::Value::List p_arguments{};
GinJavaBridgeRemoteObject_InvokeMethod_ParamsDataView input_data_view(params, message);
if (success && !input_data_view.ReadMethodName(&p_method_name))
success = false;
if (success && !input_data_view.ReadArguments(&p_arguments))
success = false;
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
GinJavaBridgeRemoteObject::Name_, 2, false);
return false;
}
auto callback =
GinJavaBridgeRemoteObject_InvokeMethod_ProxyToResponder::CreateCallback(
*message, std::move(responder));
// A null |impl| means no implementation was bound.
DCHECK(impl);
impl->InvokeMethod(
std::move(p_method_name),
std::move(p_arguments), std::move(callback));
return true;
}
}
return false;
}
namespace {
} // namespace
static const mojo::internal::GenericValidationInfo kGinJavaBridgeRemoteObjectValidationInfo[] = {
{ &internal::GinJavaBridgeRemoteObject_GetMethods_Params_Data::Validate,
&internal::GinJavaBridgeRemoteObject_GetMethods_ResponseParams_Data::Validate},
{ &internal::GinJavaBridgeRemoteObject_HasMethod_Params_Data::Validate,
&internal::GinJavaBridgeRemoteObject_HasMethod_ResponseParams_Data::Validate},
{ &internal::GinJavaBridgeRemoteObject_InvokeMethod_Params_Data::Validate,
&internal::GinJavaBridgeRemoteObject_InvokeMethod_ResponseParams_Data::Validate},
};
bool GinJavaBridgeRemoteObjectRequestValidator::Accept(mojo::Message* message) {
return mojo::internal::ValidateRequestGenericPacked(
message,
::content::mojom::GinJavaBridgeRemoteObject::Name_,
kGinJavaBridgeRemoteObjectValidationInfo);
}
bool GinJavaBridgeRemoteObjectResponseValidator::Accept(mojo::Message* message) {
return mojo::internal::ValidateResponseGenericPacked(
message,
::content::mojom::GinJavaBridgeRemoteObject::Name_,
kGinJavaBridgeRemoteObjectValidationInfo);
}
// The declaration includes the definition on other builds.
GinJavaBridgeHost::IPCStableHashFunction GinJavaBridgeHost::MessageToMethodInfo_(mojo::Message& message) {
#if !BUILDFLAG(IS_FUCHSIA)
switch (static_cast<messages::GinJavaBridgeHost>(message.name())) {
case messages::GinJavaBridgeHost::kGetObject: {
return &GinJavaBridgeHost::GetObject_Sym::IPCStableHash;
}
case messages::GinJavaBridgeHost::kObjectWrapperDeleted: {
return &GinJavaBridgeHost::ObjectWrapperDeleted_Sym::IPCStableHash;
}
}
#endif // !BUILDFLAG(IS_FUCHSIA)
return nullptr;
}
const char* GinJavaBridgeHost::MessageToMethodName_(mojo::Message& message) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
bool is_response = message.has_flag(mojo::Message::kFlagIsResponse);
if (!is_response) {
switch (static_cast<messages::GinJavaBridgeHost>(message.name())) {
case messages::GinJavaBridgeHost::kGetObject:
return "Receive content::mojom::GinJavaBridgeHost::GetObject";
case messages::GinJavaBridgeHost::kObjectWrapperDeleted:
return "Receive content::mojom::GinJavaBridgeHost::ObjectWrapperDeleted";
}
} else {
switch (static_cast<messages::GinJavaBridgeHost>(message.name())) {
case messages::GinJavaBridgeHost::kGetObject:
return "Receive reply content::mojom::GinJavaBridgeHost::GetObject";
case messages::GinJavaBridgeHost::kObjectWrapperDeleted:
return "Receive reply content::mojom::GinJavaBridgeHost::ObjectWrapperDeleted";
}
}
return "Receive unknown mojo message";
#else
bool is_response = message.has_flag(mojo::Message::kFlagIsResponse);
if (is_response) {
return "Receive mojo reply";
} else {
return "Receive mojo message";
}
#endif // BUILDFLAG(MOJO_TRACE_ENABLED)
}
#if !BUILDFLAG(IS_FUCHSIA)
uint32_t GinJavaBridgeHost::GetObject_Sym::IPCStableHash() {
// This method's address is used for identifying the mojo method name after
// symbolization. So each IPCStableHash should have a unique address.
// We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of
// __LINE__ value, which is not unique across different mojo modules.
// The code below is very similar to NO_CODE_FOLDING, but it uses a unique
// hash instead of __LINE__.
static constexpr uint32_t kHash = 0xfce176b9; // IPCStableHash for content::mojom::GinJavaBridgeHost::GetObject
const uint32_t hash = kHash;
base::debug::Alias(&hash);
return hash;
}
uint32_t GinJavaBridgeHost::ObjectWrapperDeleted_Sym::IPCStableHash() {
// This method's address is used for identifying the mojo method name after
// symbolization. So each IPCStableHash should have a unique address.
// We cannot use NO_CODE_FOLDING() here - it relies on the uniqueness of
// __LINE__ value, which is not unique across different mojo modules.
// The code below is very similar to NO_CODE_FOLDING, but it uses a unique
// hash instead of __LINE__.
static constexpr uint32_t kHash = 0x436c3187; // IPCStableHash for content::mojom::GinJavaBridgeHost::ObjectWrapperDeleted
const uint32_t hash = kHash;
base::debug::Alias(&hash);
return hash;
}
# endif // !BUILDFLAG(IS_FUCHSIA)
GinJavaBridgeHostProxy::GinJavaBridgeHostProxy(mojo::MessageReceiverWithResponder* receiver)
: receiver_(receiver) {
}
void GinJavaBridgeHostProxy::GetObject(
int32_t in_object_id, ::mojo::PendingReceiver<GinJavaBridgeRemoteObject> in_receiver) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send content::mojom::GinJavaBridgeHost::GetObject", "input_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("object_id"), in_object_id,
"<value of type int32_t>");
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("receiver"), in_receiver,
"<value of type ::mojo::PendingReceiver<GinJavaBridgeRemoteObject>>");
});
#endif
const bool kExpectsResponse = false;
const bool kIsSync = false;
const bool kAllowInterrupt = true;
const bool is_urgent = false;
const uint32_t kFlags =
((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) |
((kIsSync) ? mojo::Message::kFlagIsSync : 0) |
((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) |
((is_urgent) ? mojo::Message::kFlagIsUrgent : 0);
const size_t estimated_payload_size =
0;
mojo::Message message(
base::to_underlying(messages::GinJavaBridgeHost::kGetObject), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::content::mojom::internal::GinJavaBridgeHost_GetObject_Params_Data> params(
message);
params.Allocate();
params->object_id = in_object_id;
mojo::internal::Serialize<mojo::InterfaceRequestDataView<::content::mojom::GinJavaBridgeRemoteObjectInterfaceBase>>(
in_receiver,
&params->receiver,
&params.message());
MOJO_INTERNAL_CHECK_SERIALIZATION(
mojo::internal::SendValidation::kDefault,
!(!mojo::internal::IsHandleOrInterfaceValid(params->receiver)),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE,
"invalid receiver in GinJavaBridgeHost.GetObject request");
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(GinJavaBridgeHost::Name_);
message.set_method_name("GetObject");
#endif
// This return value may be ignored as false implies the Connector has
// encountered an error, which will be visible through other means.
::mojo::internal::SendMojoMessage(*receiver_, message);
}
void GinJavaBridgeHostProxy::ObjectWrapperDeleted(
int32_t in_object_id) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
TRACE_EVENT1(
"mojom", "Send content::mojom::GinJavaBridgeHost::ObjectWrapperDeleted", "input_parameters",
[&](perfetto::TracedValue context){
auto dict = std::move(context).WriteDictionary();
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem("object_id"), in_object_id,
"<value of type int32_t>");
});
#endif
const bool kExpectsResponse = false;
const bool kIsSync = false;
const bool kAllowInterrupt = true;
const bool is_urgent = false;
const uint32_t kFlags =
((kExpectsResponse) ? mojo::Message::kFlagExpectsResponse : 0) |
((kIsSync) ? mojo::Message::kFlagIsSync : 0) |
((kAllowInterrupt) ? 0 : mojo::Message::kFlagNoInterrupt) |
((is_urgent) ? mojo::Message::kFlagIsUrgent : 0);
const size_t estimated_payload_size =
0;
mojo::Message message(
base::to_underlying(messages::GinJavaBridgeHost::kObjectWrapperDeleted), kFlags, estimated_payload_size);
mojo::internal::MessageFragment<
::content::mojom::internal::GinJavaBridgeHost_ObjectWrapperDeleted_Params_Data> params(
message);
params.Allocate();
params->object_id = in_object_id;
#if defined(ENABLE_IPC_FUZZER)
message.set_interface_name(GinJavaBridgeHost::Name_);
message.set_method_name("ObjectWrapperDeleted");
#endif
// This return value may be ignored as false implies the Connector has
// encountered an error, which will be visible through other means.
::mojo::internal::SendMojoMessage(*receiver_, message);
}
// static
bool GinJavaBridgeHostStubDispatch::Accept(
GinJavaBridgeHost* impl,
mojo::Message* message) {
switch (static_cast<messages::GinJavaBridgeHost>(message->header()->name)) {
case messages::GinJavaBridgeHost::kGetObject: {
DCHECK(message->is_serialized());
internal::GinJavaBridgeHost_GetObject_Params_Data* params =
reinterpret_cast<internal::GinJavaBridgeHost_GetObject_Params_Data*>(
message->mutable_payload());
// Validation for GinJavaBridgeHost.0
bool success = true;
int32_t p_object_id{};
::mojo::PendingReceiver<GinJavaBridgeRemoteObject> p_receiver{};
GinJavaBridgeHost_GetObject_ParamsDataView input_data_view(params, message);
if (success)
p_object_id = input_data_view.object_id();
if (success) {
p_receiver =
input_data_view.TakeReceiver<decltype(p_receiver)>();
}
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
GinJavaBridgeHost::Name_, 0, false);
return false;
}
// A null |impl| means no implementation was bound.
DCHECK(impl);
impl->GetObject(
std::move(p_object_id),
std::move(p_receiver));
return true;
}
case messages::GinJavaBridgeHost::kObjectWrapperDeleted: {
DCHECK(message->is_serialized());
internal::GinJavaBridgeHost_ObjectWrapperDeleted_Params_Data* params =
reinterpret_cast<internal::GinJavaBridgeHost_ObjectWrapperDeleted_Params_Data*>(
message->mutable_payload());
// Validation for GinJavaBridgeHost.1
bool success = true;
int32_t p_object_id{};
GinJavaBridgeHost_ObjectWrapperDeleted_ParamsDataView input_data_view(params, message);
if (success)
p_object_id = input_data_view.object_id();
if (!success) {
ReportValidationErrorForMessage(
message,
mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
GinJavaBridgeHost::Name_, 1, false);
return false;
}
// A null |impl| means no implementation was bound.
DCHECK(impl);
impl->ObjectWrapperDeleted(
std::move(p_object_id));
return true;
}
}
return false;
}
// static
bool GinJavaBridgeHostStubDispatch::AcceptWithResponder(
GinJavaBridgeHost* impl,
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) {
[[maybe_unused]] const bool message_is_sync =
message->has_flag(mojo::Message::kFlagIsSync);
[[maybe_unused]] const uint64_t request_id = message->request_id();
switch (static_cast<messages::GinJavaBridgeHost>(message->header()->name)) {
case messages::GinJavaBridgeHost::kGetObject: {
break;
}
case messages::GinJavaBridgeHost::kObjectWrapperDeleted: {
break;
}
}
return false;
}
namespace {
} // namespace
static const mojo::internal::GenericValidationInfo kGinJavaBridgeHostValidationInfo[] = {
{ &internal::GinJavaBridgeHost_GetObject_Params_Data::Validate,
nullptr /* no response */},
{ &internal::GinJavaBridgeHost_ObjectWrapperDeleted_Params_Data::Validate,
nullptr /* no response */},
};
bool GinJavaBridgeHostRequestValidator::Accept(mojo::Message* message) {
return mojo::internal::ValidateRequestGenericPacked(
message,
::content::mojom::GinJavaBridgeHost::Name_,
kGinJavaBridgeHostValidationInfo);
}
} // content::mojom
namespace mojo {
} // namespace mojo
// Symbols declared in the -test-utils.h header are defined here instead of a
// separate .cc file to save compile time.
namespace content::mojom {
void GinJavaBridgeInterceptorForTesting::AddNamedObject(const std::string& name, int32_t object_id, const ::origin_matcher::OriginMatcher& origin_matcher) {
GetForwardingInterface()->AddNamedObject(
std::move(name)
,
std::move(object_id)
,
std::move(origin_matcher)
);
}
void GinJavaBridgeInterceptorForTesting::RemoveNamedObject(const std::string& name) {
GetForwardingInterface()->RemoveNamedObject(
std::move(name)
);
}
void GinJavaBridgeInterceptorForTesting::SetHost(::mojo::PendingRemote<GinJavaBridgeHost> host) {
GetForwardingInterface()->SetHost(
std::move(host)
);
}
GinJavaBridgeAsyncWaiter::GinJavaBridgeAsyncWaiter(
GinJavaBridge* proxy) : proxy_(proxy) {}
GinJavaBridgeAsyncWaiter::~GinJavaBridgeAsyncWaiter() = default;
void GinJavaBridgeRemoteObjectInterceptorForTesting::GetMethods(GetMethodsCallback callback) {
GetForwardingInterface()->GetMethods(std::move(callback));
}
void GinJavaBridgeRemoteObjectInterceptorForTesting::HasMethod(const std::string& method_name, HasMethodCallback callback) {
GetForwardingInterface()->HasMethod(
std::move(method_name)
, std::move(callback));
}
void GinJavaBridgeRemoteObjectInterceptorForTesting::InvokeMethod(const std::string& method_name, ::base::Value::List arguments, InvokeMethodCallback callback) {
GetForwardingInterface()->InvokeMethod(
std::move(method_name)
,
std::move(arguments)
, std::move(callback));
}
GinJavaBridgeRemoteObjectAsyncWaiter::GinJavaBridgeRemoteObjectAsyncWaiter(
GinJavaBridgeRemoteObject* proxy) : proxy_(proxy) {}
GinJavaBridgeRemoteObjectAsyncWaiter::~GinJavaBridgeRemoteObjectAsyncWaiter() = default;
void GinJavaBridgeRemoteObjectAsyncWaiter::GetMethods(
std::vector<std::string>* out_method_names) {
base::RunLoop loop;
proxy_->GetMethods(
base::BindOnce(
[](base::RunLoop* loop,
std::vector<std::string>* out_method_names
,
const std::vector<std::string>& method_names) {*out_method_names = std::move(method_names);
loop->Quit();
},
&loop,
out_method_names));
loop.Run();
}
std::vector<std::string> GinJavaBridgeRemoteObjectAsyncWaiter::GetMethods(
) {
std::vector<std::string> async_wait_result;
GetMethods(&async_wait_result);
return async_wait_result;
}
void GinJavaBridgeRemoteObjectAsyncWaiter::HasMethod(
const std::string& method_name, bool* out_result) {
base::RunLoop loop;
proxy_->HasMethod(
std::move(method_name),
base::BindOnce(
[](base::RunLoop* loop,
bool* out_result
,
bool result) {*out_result = std::move(result);
loop->Quit();
},
&loop,
out_result));
loop.Run();
}
bool GinJavaBridgeRemoteObjectAsyncWaiter::HasMethod(
const std::string& method_name) {
bool async_wait_result;
HasMethod(std::move(method_name),&async_wait_result);
return async_wait_result;
}
void GinJavaBridgeRemoteObjectAsyncWaiter::InvokeMethod(
const std::string& method_name, ::base::Value::List arguments, GinJavaBridgeError* out_error_code, ::base::Value::List* out_result) {
base::RunLoop loop;
proxy_->InvokeMethod(
std::move(method_name),
std::move(arguments),
base::BindOnce(
[](base::RunLoop* loop,
GinJavaBridgeError* out_error_code
,
::base::Value::List* out_result
,
GinJavaBridgeError error_code,
::base::Value::List result) {*out_error_code = std::move(error_code);*out_result = std::move(result);
loop->Quit();
},
&loop,
out_error_code,
out_result));
loop.Run();
}
void GinJavaBridgeHostInterceptorForTesting::GetObject(int32_t object_id, ::mojo::PendingReceiver<GinJavaBridgeRemoteObject> receiver) {
GetForwardingInterface()->GetObject(
std::move(object_id)
,
std::move(receiver)
);
}
void GinJavaBridgeHostInterceptorForTesting::ObjectWrapperDeleted(int32_t object_id) {
GetForwardingInterface()->ObjectWrapperDeleted(
std::move(object_id)
);
}
GinJavaBridgeHostAsyncWaiter::GinJavaBridgeHostAsyncWaiter(
GinJavaBridgeHost* proxy) : proxy_(proxy) {}
GinJavaBridgeHostAsyncWaiter::~GinJavaBridgeHostAsyncWaiter() = default;
} // content::mojom
#if defined(__clang__)
#pragma clang diagnostic pop
#endif