// third_party/blink/public/mojom/unbounded_element/unbounded_element.mojom-blink.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 "third_party/blink/public/mojom/unbounded_element/unbounded_element.mojom-blink.h"
#include <math.h>
#include <stdint.h>
#include <utility>
#include "base/debug/alias.h"
#include "base/notreached.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 "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/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 "third_party/blink/public/mojom/unbounded_element/unbounded_element.mojom-params-data.h"
#include "third_party/blink/public/mojom/unbounded_element/unbounded_element.mojom-shared-message-ids.h"

#include "third_party/blink/public/mojom/unbounded_element/unbounded_element.mojom-blink-import-headers.h"
#include "third_party/blink/public/mojom/unbounded_element/unbounded_element.mojom-blink-test-utils.h"
#include "mojo/public/cpp/bindings/lib/wtf_serialization.h"


namespace blink::mojom::blink {
// The declaration includes the definition on other builds.

UnboundedSurfaceHost::IPCStableHashFunction UnboundedSurfaceHost::MessageToMethodInfo_(mojo::Message& message) {
#if !BUILDFLAG(IS_FUCHSIA)
  switch (static_cast<messages::UnboundedSurfaceHost>(message.name())) {
    case messages::UnboundedSurfaceHost::kGetCompositorFrameSink: {
      return &UnboundedSurfaceHost::GetCompositorFrameSink_Sym::IPCStableHash;
    }
    case messages::UnboundedSurfaceHost::kUpdateBounds: {
      return &UnboundedSurfaceHost::UpdateBounds_Sym::IPCStableHash;
    }
    case messages::UnboundedSurfaceHost::kDidPresentFrameAfterDismissal: {
      return &UnboundedSurfaceHost::DidPresentFrameAfterDismissal_Sym::IPCStableHash;
    }
    case messages::UnboundedSurfaceHost::kDidCancelDismissal: {
      return &UnboundedSurfaceHost::DidCancelDismissal_Sym::IPCStableHash;
    }
  }
#endif  // !BUILDFLAG(IS_FUCHSIA)
  return nullptr;
}


const char* UnboundedSurfaceHost::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::UnboundedSurfaceHost>(message.name())) {
      case messages::UnboundedSurfaceHost::kGetCompositorFrameSink:
            return "Receive blink::mojom::UnboundedSurfaceHost::GetCompositorFrameSink";
      case messages::UnboundedSurfaceHost::kUpdateBounds:
            return "Receive blink::mojom::UnboundedSurfaceHost::UpdateBounds";
      case messages::UnboundedSurfaceHost::kDidPresentFrameAfterDismissal:
            return "Receive blink::mojom::UnboundedSurfaceHost::DidPresentFrameAfterDismissal";
      case messages::UnboundedSurfaceHost::kDidCancelDismissal:
            return "Receive blink::mojom::UnboundedSurfaceHost::DidCancelDismissal";
    }
  } else {
    switch (static_cast<messages::UnboundedSurfaceHost>(message.name())) {
      case messages::UnboundedSurfaceHost::kGetCompositorFrameSink:
            return "Receive reply blink::mojom::UnboundedSurfaceHost::GetCompositorFrameSink";
      case messages::UnboundedSurfaceHost::kUpdateBounds:
            return "Receive reply blink::mojom::UnboundedSurfaceHost::UpdateBounds";
      case messages::UnboundedSurfaceHost::kDidPresentFrameAfterDismissal:
            return "Receive reply blink::mojom::UnboundedSurfaceHost::DidPresentFrameAfterDismissal";
      case messages::UnboundedSurfaceHost::kDidCancelDismissal:
            return "Receive reply blink::mojom::UnboundedSurfaceHost::DidCancelDismissal";
    }
  }
  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 UnboundedSurfaceHost::GetCompositorFrameSink_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 = 0xb50eed2e;  // IPCStableHash for blink::mojom::UnboundedSurfaceHost::GetCompositorFrameSink
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t UnboundedSurfaceHost::UpdateBounds_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 = 0x0dcaef4a;  // IPCStableHash for blink::mojom::UnboundedSurfaceHost::UpdateBounds
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t UnboundedSurfaceHost::DidPresentFrameAfterDismissal_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 = 0x77fe3710;  // IPCStableHash for blink::mojom::UnboundedSurfaceHost::DidPresentFrameAfterDismissal
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t UnboundedSurfaceHost::DidCancelDismissal_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 = 0xdbb425bd;  // IPCStableHash for blink::mojom::UnboundedSurfaceHost::DidCancelDismissal
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
# endif // !BUILDFLAG(IS_FUCHSIA)

UnboundedSurfaceHostProxy::UnboundedSurfaceHostProxy(mojo::MessageReceiverWithResponder* receiver)
    : receiver_(receiver) {
}

void UnboundedSurfaceHostProxy::GetCompositorFrameSink(
    ::mojo::PendingReceiver<::viz::mojom::blink::CompositorFrameSink> in_sink, ::mojo::PendingRemote<::viz::mojom::blink::CompositorFrameSinkClient> in_client) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send blink::mojom::UnboundedSurfaceHost::GetCompositorFrameSink", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("sink"), in_sink,
                        "<value of type ::mojo::PendingReceiver<::viz::mojom::blink::CompositorFrameSink>>");
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("client"), in_client,
                        "<value of type ::mojo::PendingRemote<::viz::mojom::blink::CompositorFrameSinkClient>>");
   });
#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(
      std::to_underlying(messages::UnboundedSurfaceHost::kGetCompositorFrameSink), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::blink::mojom::internal::UnboundedSurfaceHost_GetCompositorFrameSink_Params_Data> params(
          message);
  params.Allocate();

  
  mojo::internal::Serialize<mojo::InterfaceRequestDataView<::viz::mojom::CompositorFrameSinkInterfaceBase>>(
    in_sink,
    &params->sink,
    &params.message());

  
  MOJO_INTERNAL_CHECK_SERIALIZATION(
    mojo::internal::SendValidation::kDefault,
    !(!mojo::internal::IsHandleOrInterfaceValid(params->sink)),
    mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE,
    "invalid sink in UnboundedSurfaceHost.GetCompositorFrameSink request");

  
  mojo::internal::Serialize<mojo::InterfacePtrDataView<::viz::mojom::CompositorFrameSinkClientInterfaceBase>>(
    in_client,
    &params->client,
    &params.message());

  
  MOJO_INTERNAL_CHECK_SERIALIZATION(
    mojo::internal::SendValidation::kDefault,
    !(!mojo::internal::IsHandleOrInterfaceValid(params->client)),
    mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE,
    "invalid client in UnboundedSurfaceHost.GetCompositorFrameSink request");

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(UnboundedSurfaceHost::Name_);
  message.set_method_name("GetCompositorFrameSink");
#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 UnboundedSurfaceHostProxy::UpdateBounds(
    const ::gfx::Rect& in_bounds) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send blink::mojom::UnboundedSurfaceHost::UpdateBounds", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("bounds"), in_bounds,
                        "<value of type const ::gfx::Rect&>");
   });
#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(
      std::to_underlying(messages::UnboundedSurfaceHost::kUpdateBounds), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::blink::mojom::internal::UnboundedSurfaceHost_UpdateBounds_Params_Data> params(
          message);
  params.Allocate();
  mojo::internal::MessageFragment<
      typename decltype(params->bounds)::BaseType> bounds_fragment(
          params.message());
  
  mojo::internal::Serialize<::gfx::mojom::RectDataView>(
    in_bounds,
    bounds_fragment);

  params->bounds.Set(
      bounds_fragment.is_null() ? nullptr : bounds_fragment.data());

  
  MOJO_INTERNAL_CHECK_SERIALIZATION(
    mojo::internal::SendValidation::kDefault,
    !(params->bounds.is_null()),
    mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
    "null bounds in UnboundedSurfaceHost.UpdateBounds request");

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(UnboundedSurfaceHost::Name_);
  message.set_method_name("UpdateBounds");
#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 UnboundedSurfaceHostProxy::DidPresentFrameAfterDismissal(
    ) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT0("mojom", "Send blink::mojom::UnboundedSurfaceHost::DidPresentFrameAfterDismissal");
#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(
      std::to_underlying(messages::UnboundedSurfaceHost::kDidPresentFrameAfterDismissal), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::blink::mojom::internal::UnboundedSurfaceHost_DidPresentFrameAfterDismissal_Params_Data> params(
          message);
  params.Allocate();

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(UnboundedSurfaceHost::Name_);
  message.set_method_name("DidPresentFrameAfterDismissal");
#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 UnboundedSurfaceHostProxy::DidCancelDismissal(
    ) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT0("mojom", "Send blink::mojom::UnboundedSurfaceHost::DidCancelDismissal");
#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(
      std::to_underlying(messages::UnboundedSurfaceHost::kDidCancelDismissal), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::blink::mojom::internal::UnboundedSurfaceHost_DidCancelDismissal_Params_Data> params(
          message);
  params.Allocate();

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(UnboundedSurfaceHost::Name_);
  message.set_method_name("DidCancelDismissal");
#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 UnboundedSurfaceHostStubDispatch::Accept(
    UnboundedSurfaceHost* impl,
    mojo::Message* message) {
  switch (static_cast<messages::UnboundedSurfaceHost>(message->header()->name)) {
    case messages::UnboundedSurfaceHost::kGetCompositorFrameSink: {
      DCHECK(message->is_serialized());
      internal::UnboundedSurfaceHost_GetCompositorFrameSink_Params_Data* params =
          reinterpret_cast<internal::UnboundedSurfaceHost_GetCompositorFrameSink_Params_Data*>(
              message->mutable_payload());
      

      // Validation for UnboundedSurfaceHost.0
      bool success = true;
      ::mojo::PendingReceiver<::viz::mojom::blink::CompositorFrameSink> p_sink{};
      ::mojo::PendingRemote<::viz::mojom::blink::CompositorFrameSinkClient> p_client{};
      UnboundedSurfaceHost_GetCompositorFrameSink_ParamsDataView input_data_view(params, message);
      
      if (success) {
        p_sink =
            input_data_view.TakeSink<decltype(p_sink)>();
      }
      if (success) {
        p_client =
            input_data_view.TakeClient<decltype(p_client)>();
      }
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            UnboundedSurfaceHost::Name_, 0, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->GetCompositorFrameSink(        
        std::move(p_sink), 
        std::move(p_client));
      return true;
    }
    case messages::UnboundedSurfaceHost::kUpdateBounds: {
      DCHECK(message->is_serialized());
      internal::UnboundedSurfaceHost_UpdateBounds_Params_Data* params =
          reinterpret_cast<internal::UnboundedSurfaceHost_UpdateBounds_Params_Data*>(
              message->mutable_payload());
      

      // Validation for UnboundedSurfaceHost.1
      bool success = true;
      ::gfx::Rect p_bounds{};
      UnboundedSurfaceHost_UpdateBounds_ParamsDataView input_data_view(params, message);
      
      if (success && !input_data_view.ReadBounds(&p_bounds))
        success = false;
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            UnboundedSurfaceHost::Name_, 1, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->UpdateBounds(        
        std::move(p_bounds));
      return true;
    }
    case messages::UnboundedSurfaceHost::kDidPresentFrameAfterDismissal: {
      DCHECK(message->is_serialized());
      internal::UnboundedSurfaceHost_DidPresentFrameAfterDismissal_Params_Data* params =
          reinterpret_cast<internal::UnboundedSurfaceHost_DidPresentFrameAfterDismissal_Params_Data*>(
              message->mutable_payload());
      

      // Validation for UnboundedSurfaceHost.2
      bool success = true;
      UnboundedSurfaceHost_DidPresentFrameAfterDismissal_ParamsDataView input_data_view(params, message);
      
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            UnboundedSurfaceHost::Name_, 2, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->DidPresentFrameAfterDismissal(        );
      return true;
    }
    case messages::UnboundedSurfaceHost::kDidCancelDismissal: {
      DCHECK(message->is_serialized());
      internal::UnboundedSurfaceHost_DidCancelDismissal_Params_Data* params =
          reinterpret_cast<internal::UnboundedSurfaceHost_DidCancelDismissal_Params_Data*>(
              message->mutable_payload());
      

      // Validation for UnboundedSurfaceHost.3
      bool success = true;
      UnboundedSurfaceHost_DidCancelDismissal_ParamsDataView input_data_view(params, message);
      
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            UnboundedSurfaceHost::Name_, 3, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->DidCancelDismissal(        );
      return true;
    }
  }
  return false;
}

// static
bool UnboundedSurfaceHostStubDispatch::AcceptWithResponder(
    UnboundedSurfaceHost* 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::UnboundedSurfaceHost>(message->header()->name)) {
    case messages::UnboundedSurfaceHost::kGetCompositorFrameSink: {
      break;
    }
    case messages::UnboundedSurfaceHost::kUpdateBounds: {
      break;
    }
    case messages::UnboundedSurfaceHost::kDidPresentFrameAfterDismissal: {
      break;
    }
    case messages::UnboundedSurfaceHost::kDidCancelDismissal: {
      break;
    }
  }
  return false;
}
namespace {
}  // namespace
static const mojo::internal::GenericValidationInfo kUnboundedSurfaceHostValidationInfo[] = {
    { &internal::UnboundedSurfaceHost_GetCompositorFrameSink_Params_Data::Validate,
     nullptr /* no response */},
    { &internal::UnboundedSurfaceHost_UpdateBounds_Params_Data::Validate,
     nullptr /* no response */},
    { &internal::UnboundedSurfaceHost_DidPresentFrameAfterDismissal_Params_Data::Validate,
     nullptr /* no response */},
    { &internal::UnboundedSurfaceHost_DidCancelDismissal_Params_Data::Validate,
     nullptr /* no response */},
};

bool UnboundedSurfaceHostRequestValidator::Accept(mojo::Message* message) {
  return mojo::internal::ValidateRequestGenericPacked(
    message,
    ::blink::mojom::blink::UnboundedSurfaceHost::Name_,
    kUnboundedSurfaceHostValidationInfo);
}

// The declaration includes the definition on other builds.

UnboundedSurfaceClient::IPCStableHashFunction UnboundedSurfaceClient::MessageToMethodInfo_(mojo::Message& message) {
#if !BUILDFLAG(IS_FUCHSIA)
  switch (static_cast<messages::UnboundedSurfaceClient>(message.name())) {
    case messages::UnboundedSurfaceClient::kOnSurfaceAllocated: {
      return &UnboundedSurfaceClient::OnSurfaceAllocated_Sym::IPCStableHash;
    }
    case messages::UnboundedSurfaceClient::kOnDismissed: {
      return &UnboundedSurfaceClient::OnDismissed_Sym::IPCStableHash;
    }
  }
#endif  // !BUILDFLAG(IS_FUCHSIA)
  return nullptr;
}


const char* UnboundedSurfaceClient::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::UnboundedSurfaceClient>(message.name())) {
      case messages::UnboundedSurfaceClient::kOnSurfaceAllocated:
            return "Receive blink::mojom::UnboundedSurfaceClient::OnSurfaceAllocated";
      case messages::UnboundedSurfaceClient::kOnDismissed:
            return "Receive blink::mojom::UnboundedSurfaceClient::OnDismissed";
    }
  } else {
    switch (static_cast<messages::UnboundedSurfaceClient>(message.name())) {
      case messages::UnboundedSurfaceClient::kOnSurfaceAllocated:
            return "Receive reply blink::mojom::UnboundedSurfaceClient::OnSurfaceAllocated";
      case messages::UnboundedSurfaceClient::kOnDismissed:
            return "Receive reply blink::mojom::UnboundedSurfaceClient::OnDismissed";
    }
  }
  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 UnboundedSurfaceClient::OnSurfaceAllocated_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 = 0x4578678f;  // IPCStableHash for blink::mojom::UnboundedSurfaceClient::OnSurfaceAllocated
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t UnboundedSurfaceClient::OnDismissed_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 = 0x817b7829;  // IPCStableHash for blink::mojom::UnboundedSurfaceClient::OnDismissed
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
# endif // !BUILDFLAG(IS_FUCHSIA)

UnboundedSurfaceClientProxy::UnboundedSurfaceClientProxy(mojo::MessageReceiverWithResponder* receiver)
    : receiver_(receiver) {
}

void UnboundedSurfaceClientProxy::OnSurfaceAllocated(
    const ::viz::FrameSinkId& in_frame_sink_id, const ::viz::LocalSurfaceId& in_local_surface_id) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send blink::mojom::UnboundedSurfaceClient::OnSurfaceAllocated", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("frame_sink_id"), in_frame_sink_id,
                        "<value of type const ::viz::FrameSinkId&>");
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("local_surface_id"), in_local_surface_id,
                        "<value of type const ::viz::LocalSurfaceId&>");
   });
#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(
      std::to_underlying(messages::UnboundedSurfaceClient::kOnSurfaceAllocated), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::blink::mojom::internal::UnboundedSurfaceClient_OnSurfaceAllocated_Params_Data> params(
          message);
  params.Allocate();
  mojo::internal::MessageFragment<
      typename decltype(params->frame_sink_id)::BaseType> frame_sink_id_fragment(
          params.message());
  
  mojo::internal::Serialize<::viz::mojom::FrameSinkIdDataView>(
    in_frame_sink_id,
    frame_sink_id_fragment);

  params->frame_sink_id.Set(
      frame_sink_id_fragment.is_null() ? nullptr : frame_sink_id_fragment.data());

  
  MOJO_INTERNAL_CHECK_SERIALIZATION(
    mojo::internal::SendValidation::kDefault,
    !(params->frame_sink_id.is_null()),
    mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
    "null frame_sink_id in UnboundedSurfaceClient.OnSurfaceAllocated request");
  mojo::internal::MessageFragment<
      typename decltype(params->local_surface_id)::BaseType> local_surface_id_fragment(
          params.message());
  
  mojo::internal::Serialize<::viz::mojom::LocalSurfaceIdDataView>(
    in_local_surface_id,
    local_surface_id_fragment);

  params->local_surface_id.Set(
      local_surface_id_fragment.is_null() ? nullptr : local_surface_id_fragment.data());

  
  MOJO_INTERNAL_CHECK_SERIALIZATION(
    mojo::internal::SendValidation::kDefault,
    !(params->local_surface_id.is_null()),
    mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
    "null local_surface_id in UnboundedSurfaceClient.OnSurfaceAllocated request");

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(UnboundedSurfaceClient::Name_);
  message.set_method_name("OnSurfaceAllocated");
#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 UnboundedSurfaceClientProxy::OnDismissed(
    ) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT0("mojom", "Send blink::mojom::UnboundedSurfaceClient::OnDismissed");
#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(
      std::to_underlying(messages::UnboundedSurfaceClient::kOnDismissed), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::blink::mojom::internal::UnboundedSurfaceClient_OnDismissed_Params_Data> params(
          message);
  params.Allocate();

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(UnboundedSurfaceClient::Name_);
  message.set_method_name("OnDismissed");
#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 UnboundedSurfaceClientStubDispatch::Accept(
    UnboundedSurfaceClient* impl,
    mojo::Message* message) {
  switch (static_cast<messages::UnboundedSurfaceClient>(message->header()->name)) {
    case messages::UnboundedSurfaceClient::kOnSurfaceAllocated: {
      DCHECK(message->is_serialized());
      internal::UnboundedSurfaceClient_OnSurfaceAllocated_Params_Data* params =
          reinterpret_cast<internal::UnboundedSurfaceClient_OnSurfaceAllocated_Params_Data*>(
              message->mutable_payload());
      

      // Validation for UnboundedSurfaceClient.0
      bool success = true;
      ::viz::FrameSinkId p_frame_sink_id{};
      ::viz::LocalSurfaceId p_local_surface_id{};
      UnboundedSurfaceClient_OnSurfaceAllocated_ParamsDataView input_data_view(params, message);
      
      if (success && !input_data_view.ReadFrameSinkId(&p_frame_sink_id))
        success = false;
      if (success && !input_data_view.ReadLocalSurfaceId(&p_local_surface_id))
        success = false;
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            UnboundedSurfaceClient::Name_, 0, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->OnSurfaceAllocated(        
        std::move(p_frame_sink_id), 
        std::move(p_local_surface_id));
      return true;
    }
    case messages::UnboundedSurfaceClient::kOnDismissed: {
      DCHECK(message->is_serialized());
      internal::UnboundedSurfaceClient_OnDismissed_Params_Data* params =
          reinterpret_cast<internal::UnboundedSurfaceClient_OnDismissed_Params_Data*>(
              message->mutable_payload());
      

      // Validation for UnboundedSurfaceClient.1
      bool success = true;
      UnboundedSurfaceClient_OnDismissed_ParamsDataView input_data_view(params, message);
      
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            UnboundedSurfaceClient::Name_, 1, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->OnDismissed(        );
      return true;
    }
  }
  return false;
}

// static
bool UnboundedSurfaceClientStubDispatch::AcceptWithResponder(
    UnboundedSurfaceClient* 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::UnboundedSurfaceClient>(message->header()->name)) {
    case messages::UnboundedSurfaceClient::kOnSurfaceAllocated: {
      break;
    }
    case messages::UnboundedSurfaceClient::kOnDismissed: {
      break;
    }
  }
  return false;
}
namespace {
}  // namespace
static const mojo::internal::GenericValidationInfo kUnboundedSurfaceClientValidationInfo[] = {
    { &internal::UnboundedSurfaceClient_OnSurfaceAllocated_Params_Data::Validate,
     nullptr /* no response */},
    { &internal::UnboundedSurfaceClient_OnDismissed_Params_Data::Validate,
     nullptr /* no response */},
};

bool UnboundedSurfaceClientRequestValidator::Accept(mojo::Message* message) {
  return mojo::internal::ValidateRequestGenericPacked(
    message,
    ::blink::mojom::blink::UnboundedSurfaceClient::Name_,
    kUnboundedSurfaceClientValidationInfo);
}



}  // blink::mojom::blink


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 blink::mojom::blink {


void UnboundedSurfaceHostInterceptorForTesting::GetCompositorFrameSink(::mojo::PendingReceiver<::viz::mojom::blink::CompositorFrameSink> sink, ::mojo::PendingRemote<::viz::mojom::blink::CompositorFrameSinkClient> client) {
  GetForwardingInterface()->GetCompositorFrameSink(
    std::move(sink)
    , 
    std::move(client)
    );
}
void UnboundedSurfaceHostInterceptorForTesting::UpdateBounds(const ::gfx::Rect& bounds) {
  GetForwardingInterface()->UpdateBounds(
    std::move(bounds)
    );
}
void UnboundedSurfaceHostInterceptorForTesting::DidPresentFrameAfterDismissal() {
  GetForwardingInterface()->DidPresentFrameAfterDismissal();
}
void UnboundedSurfaceHostInterceptorForTesting::DidCancelDismissal() {
  GetForwardingInterface()->DidCancelDismissal();
}
UnboundedSurfaceHostAsyncWaiter::UnboundedSurfaceHostAsyncWaiter(
    UnboundedSurfaceHost* proxy) : proxy_(proxy) {}

UnboundedSurfaceHostAsyncWaiter::~UnboundedSurfaceHostAsyncWaiter() = default;





void UnboundedSurfaceClientInterceptorForTesting::OnSurfaceAllocated(const ::viz::FrameSinkId& frame_sink_id, const ::viz::LocalSurfaceId& local_surface_id) {
  GetForwardingInterface()->OnSurfaceAllocated(
    std::move(frame_sink_id)
    , 
    std::move(local_surface_id)
    );
}
void UnboundedSurfaceClientInterceptorForTesting::OnDismissed() {
  GetForwardingInterface()->OnDismissed();
}
UnboundedSurfaceClientAsyncWaiter::UnboundedSurfaceClientAsyncWaiter(
    UnboundedSurfaceClient* proxy) : proxy_(proxy) {}

UnboundedSurfaceClientAsyncWaiter::~UnboundedSurfaceClientAsyncWaiter() = default;







}  // blink::mojom::blink


#if defined(__clang__)
#pragma clang diagnostic pop
#endif