// services/webnn/public/mojom/webnn_service_introspection.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 "services/webnn/public/mojom/webnn_service_introspection.mojom.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 "services/webnn/public/mojom/webnn_service_introspection.mojom-params-data.h"
#include "services/webnn/public/mojom/webnn_service_introspection.mojom-shared-message-ids.h"

#include "services/webnn/public/mojom/webnn_service_introspection.mojom-import-headers.h"
#include "services/webnn/public/mojom/webnn_service_introspection.mojom-test-utils.h"


namespace webnn::mojom {
WebNNExecutionProviderDetails::WebNNExecutionProviderDetails()
    : name(),
      vendor(),
      hardware_type(),
      vendor_id(),
      device_id(),
      version(),
      first_selected() {}

WebNNExecutionProviderDetails::WebNNExecutionProviderDetails(
    const std::string& name_in,
    const std::string& vendor_in,
    const std::string& hardware_type_in,
    const std::string& vendor_id_in,
    const std::string& device_id_in,
    const std::string& version_in,
    bool first_selected_in)
    : name(std::move(name_in)),
      vendor(std::move(vendor_in)),
      hardware_type(std::move(hardware_type_in)),
      vendor_id(std::move(vendor_id_in)),
      device_id(std::move(device_id_in)),
      version(std::move(version_in)),
      first_selected(std::move(first_selected_in)) {}

WebNNExecutionProviderDetails::~WebNNExecutionProviderDetails() = default;
size_t WebNNExecutionProviderDetails::Hash(size_t seed) const {
  seed = mojo::internal::Hash(seed, this->name);
  seed = mojo::internal::Hash(seed, this->vendor);
  seed = mojo::internal::Hash(seed, this->hardware_type);
  seed = mojo::internal::Hash(seed, this->vendor_id);
  seed = mojo::internal::Hash(seed, this->device_id);
  seed = mojo::internal::Hash(seed, this->version);
  seed = mojo::internal::Hash(seed, this->first_selected);
  return seed;
}

void WebNNExecutionProviderDetails::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "name"), this->name,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const std::string&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "vendor"), this->vendor,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const std::string&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "hardware_type"), this->hardware_type,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const std::string&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "vendor_id"), this->vendor_id,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const std::string&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "device_id"), this->device_id,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const std::string&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "version"), this->version,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const std::string&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "first_selected"), this->first_selected,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

bool WebNNExecutionProviderDetails::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  return Data_::Validate(data, validation_context);
}
WebNNContextIntrospectionDetails::WebNNContextIntrospectionDetails()
    : context_id(),
      context_backend(),
      execution_providers() {}

WebNNContextIntrospectionDetails::WebNNContextIntrospectionDetails(
    int32_t context_id_in,
    const std::string& context_backend_in,
    std::vector<WebNNExecutionProviderDetailsPtr> execution_providers_in)
    : context_id(std::move(context_id_in)),
      context_backend(std::move(context_backend_in)),
      execution_providers(std::move(execution_providers_in)) {}

WebNNContextIntrospectionDetails::~WebNNContextIntrospectionDetails() = default;

void WebNNContextIntrospectionDetails::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "context_id"), this->context_id,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type int32_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "context_backend"), this->context_backend,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const std::string&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "execution_providers"), this->execution_providers,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type std::vector<WebNNExecutionProviderDetailsPtr>>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

bool WebNNContextIntrospectionDetails::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  return Data_::Validate(data, validation_context);
}
// The declaration includes the definition on other builds.

WebNNServiceIntrospectionClient::IPCStableHashFunction WebNNServiceIntrospectionClient::MessageToMethodInfo_(mojo::Message& message) {
#if !BUILDFLAG(IS_FUCHSIA)
  switch (static_cast<messages::WebNNServiceIntrospectionClient>(message.name())) {
    case messages::WebNNServiceIntrospectionClient::kOnUpdateExistingContextDetails: {
      return &WebNNServiceIntrospectionClient::OnUpdateExistingContextDetails_Sym::IPCStableHash;
    }
    case messages::WebNNServiceIntrospectionClient::kOnUpdateAvailableExecutionProvidersDetails: {
      return &WebNNServiceIntrospectionClient::OnUpdateAvailableExecutionProvidersDetails_Sym::IPCStableHash;
    }
  }
#endif  // !BUILDFLAG(IS_FUCHSIA)
  return nullptr;
}


const char* WebNNServiceIntrospectionClient::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::WebNNServiceIntrospectionClient>(message.name())) {
      case messages::WebNNServiceIntrospectionClient::kOnUpdateExistingContextDetails:
            return "Receive webnn::mojom::WebNNServiceIntrospectionClient::OnUpdateExistingContextDetails";
      case messages::WebNNServiceIntrospectionClient::kOnUpdateAvailableExecutionProvidersDetails:
            return "Receive webnn::mojom::WebNNServiceIntrospectionClient::OnUpdateAvailableExecutionProvidersDetails";
    }
  } else {
    switch (static_cast<messages::WebNNServiceIntrospectionClient>(message.name())) {
      case messages::WebNNServiceIntrospectionClient::kOnUpdateExistingContextDetails:
            return "Receive reply webnn::mojom::WebNNServiceIntrospectionClient::OnUpdateExistingContextDetails";
      case messages::WebNNServiceIntrospectionClient::kOnUpdateAvailableExecutionProvidersDetails:
            return "Receive reply webnn::mojom::WebNNServiceIntrospectionClient::OnUpdateAvailableExecutionProvidersDetails";
    }
  }
  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 WebNNServiceIntrospectionClient::OnUpdateExistingContextDetails_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 = 0xa9fdde97;  // IPCStableHash for webnn::mojom::WebNNServiceIntrospectionClient::OnUpdateExistingContextDetails
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t WebNNServiceIntrospectionClient::OnUpdateAvailableExecutionProvidersDetails_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 = 0xaa674812;  // IPCStableHash for webnn::mojom::WebNNServiceIntrospectionClient::OnUpdateAvailableExecutionProvidersDetails
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
# endif // !BUILDFLAG(IS_FUCHSIA)

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

void WebNNServiceIntrospectionClientProxy::OnUpdateExistingContextDetails(
    std::vector<WebNNContextIntrospectionDetailsPtr> in_contexts_details) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send webnn::mojom::WebNNServiceIntrospectionClient::OnUpdateExistingContextDetails", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("contexts_details"), in_contexts_details,
                        "<value of type std::vector<WebNNContextIntrospectionDetailsPtr>>");
   });
#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::WebNNServiceIntrospectionClient::kOnUpdateExistingContextDetails), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::webnn::mojom::internal::WebNNServiceIntrospectionClient_OnUpdateExistingContextDetails_Params_Data> params(
          message);
  params.Allocate();
  mojo::internal::MessageFragment<
      typename decltype(params->contexts_details)::BaseType>
      contexts_details_fragment(params.message());
  constexpr const mojo::internal::ContainerValidateParams& contexts_details_validate_params =
      mojo::internal::GetArrayValidator<0, false, nullptr>();
  
  mojo::internal::Serialize<mojo::ArrayDataView<::webnn::mojom::WebNNContextIntrospectionDetailsDataView>>(
    in_contexts_details,
    contexts_details_fragment,
    &contexts_details_validate_params);

  params->contexts_details.Set(
      contexts_details_fragment.is_null() ? nullptr : contexts_details_fragment.data());

  
  MOJO_INTERNAL_CHECK_SERIALIZATION(
    mojo::internal::SendValidation::kDefault,
    !(params->contexts_details.is_null()),
    mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
    "null contexts_details in WebNNServiceIntrospectionClient.OnUpdateExistingContextDetails request");

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(WebNNServiceIntrospectionClient::Name_);
  message.set_method_name("OnUpdateExistingContextDetails");
#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 WebNNServiceIntrospectionClientProxy::OnUpdateAvailableExecutionProvidersDetails(
    std::vector<WebNNExecutionProviderDetailsPtr> in_available_execution_providers) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send webnn::mojom::WebNNServiceIntrospectionClient::OnUpdateAvailableExecutionProvidersDetails", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("available_execution_providers"), in_available_execution_providers,
                        "<value of type std::vector<WebNNExecutionProviderDetailsPtr>>");
   });
#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::WebNNServiceIntrospectionClient::kOnUpdateAvailableExecutionProvidersDetails), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::webnn::mojom::internal::WebNNServiceIntrospectionClient_OnUpdateAvailableExecutionProvidersDetails_Params_Data> params(
          message);
  params.Allocate();
  mojo::internal::MessageFragment<
      typename decltype(params->available_execution_providers)::BaseType>
      available_execution_providers_fragment(params.message());
  constexpr const mojo::internal::ContainerValidateParams& available_execution_providers_validate_params =
      mojo::internal::GetArrayValidator<0, false, nullptr>();
  
  mojo::internal::Serialize<mojo::ArrayDataView<::webnn::mojom::WebNNExecutionProviderDetailsDataView>>(
    in_available_execution_providers,
    available_execution_providers_fragment,
    &available_execution_providers_validate_params);

  params->available_execution_providers.Set(
      available_execution_providers_fragment.is_null() ? nullptr : available_execution_providers_fragment.data());

  
  MOJO_INTERNAL_CHECK_SERIALIZATION(
    mojo::internal::SendValidation::kDefault,
    !(params->available_execution_providers.is_null()),
    mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
    "null available_execution_providers in WebNNServiceIntrospectionClient.OnUpdateAvailableExecutionProvidersDetails request");

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

      // Validation for WebNNServiceIntrospectionClient.0
      bool success = true;
      std::vector<WebNNContextIntrospectionDetailsPtr> p_contexts_details{};
      WebNNServiceIntrospectionClient_OnUpdateExistingContextDetails_ParamsDataView input_data_view(params, message);
      
      if (success && !input_data_view.ReadContextsDetails(&p_contexts_details))
        success = false;
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            WebNNServiceIntrospectionClient::Name_, 0, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->OnUpdateExistingContextDetails(        
        std::move(p_contexts_details));
      return true;
    }
    case messages::WebNNServiceIntrospectionClient::kOnUpdateAvailableExecutionProvidersDetails: {
      DCHECK(message->is_serialized());
      internal::WebNNServiceIntrospectionClient_OnUpdateAvailableExecutionProvidersDetails_Params_Data* params =
          reinterpret_cast<internal::WebNNServiceIntrospectionClient_OnUpdateAvailableExecutionProvidersDetails_Params_Data*>(
              message->mutable_payload());
      

      // Validation for WebNNServiceIntrospectionClient.1
      bool success = true;
      std::vector<WebNNExecutionProviderDetailsPtr> p_available_execution_providers{};
      WebNNServiceIntrospectionClient_OnUpdateAvailableExecutionProvidersDetails_ParamsDataView input_data_view(params, message);
      
      if (success && !input_data_view.ReadAvailableExecutionProviders(&p_available_execution_providers))
        success = false;
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            WebNNServiceIntrospectionClient::Name_, 1, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->OnUpdateAvailableExecutionProvidersDetails(        
        std::move(p_available_execution_providers));
      return true;
    }
  }
  return false;
}

// static
bool WebNNServiceIntrospectionClientStubDispatch::AcceptWithResponder(
    WebNNServiceIntrospectionClient* 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::WebNNServiceIntrospectionClient>(message->header()->name)) {
    case messages::WebNNServiceIntrospectionClient::kOnUpdateExistingContextDetails: {
      break;
    }
    case messages::WebNNServiceIntrospectionClient::kOnUpdateAvailableExecutionProvidersDetails: {
      break;
    }
  }
  return false;
}
namespace {
}  // namespace
static const mojo::internal::GenericValidationInfo kWebNNServiceIntrospectionClientValidationInfo[] = {
    { &internal::WebNNServiceIntrospectionClient_OnUpdateExistingContextDetails_Params_Data::Validate,
     nullptr /* no response */},
    { &internal::WebNNServiceIntrospectionClient_OnUpdateAvailableExecutionProvidersDetails_Params_Data::Validate,
     nullptr /* no response */},
};

bool WebNNServiceIntrospectionClientRequestValidator::Accept(mojo::Message* message) {
  return mojo::internal::ValidateRequestGenericPacked(
    message,
    ::webnn::mojom::WebNNServiceIntrospectionClient::Name_,
    kWebNNServiceIntrospectionClientValidationInfo);
}

// The declaration includes the definition on other builds.

WebNNServiceIntrospection::IPCStableHashFunction WebNNServiceIntrospection::MessageToMethodInfo_(mojo::Message& message) {
#if !BUILDFLAG(IS_FUCHSIA)
  switch (static_cast<messages::WebNNServiceIntrospection>(message.name())) {
    case messages::WebNNServiceIntrospection::kSetClient: {
      return &WebNNServiceIntrospection::SetClient_Sym::IPCStableHash;
    }
    case messages::WebNNServiceIntrospection::kGetExistingContextsDetails: {
      return &WebNNServiceIntrospection::GetExistingContextsDetails_Sym::IPCStableHash;
    }
    case messages::WebNNServiceIntrospection::kGetAvailableExecutionProvidersDetails: {
      return &WebNNServiceIntrospection::GetAvailableExecutionProvidersDetails_Sym::IPCStableHash;
    }
  }
#endif  // !BUILDFLAG(IS_FUCHSIA)
  return nullptr;
}


const char* WebNNServiceIntrospection::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::WebNNServiceIntrospection>(message.name())) {
      case messages::WebNNServiceIntrospection::kSetClient:
            return "Receive webnn::mojom::WebNNServiceIntrospection::SetClient";
      case messages::WebNNServiceIntrospection::kGetExistingContextsDetails:
            return "Receive webnn::mojom::WebNNServiceIntrospection::GetExistingContextsDetails";
      case messages::WebNNServiceIntrospection::kGetAvailableExecutionProvidersDetails:
            return "Receive webnn::mojom::WebNNServiceIntrospection::GetAvailableExecutionProvidersDetails";
    }
  } else {
    switch (static_cast<messages::WebNNServiceIntrospection>(message.name())) {
      case messages::WebNNServiceIntrospection::kSetClient:
            return "Receive reply webnn::mojom::WebNNServiceIntrospection::SetClient";
      case messages::WebNNServiceIntrospection::kGetExistingContextsDetails:
            return "Receive reply webnn::mojom::WebNNServiceIntrospection::GetExistingContextsDetails";
      case messages::WebNNServiceIntrospection::kGetAvailableExecutionProvidersDetails:
            return "Receive reply webnn::mojom::WebNNServiceIntrospection::GetAvailableExecutionProvidersDetails";
    }
  }
  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 WebNNServiceIntrospection::SetClient_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 = 0xe99adad6;  // IPCStableHash for webnn::mojom::WebNNServiceIntrospection::SetClient
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t WebNNServiceIntrospection::GetExistingContextsDetails_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 = 0xa8cb78ba;  // IPCStableHash for webnn::mojom::WebNNServiceIntrospection::GetExistingContextsDetails
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
uint32_t WebNNServiceIntrospection::GetAvailableExecutionProvidersDetails_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 = 0x8898f289;  // IPCStableHash for webnn::mojom::WebNNServiceIntrospection::GetAvailableExecutionProvidersDetails
  const uint32_t hash = kHash;
  base::debug::Alias(&hash);
  return hash;
}
# endif // !BUILDFLAG(IS_FUCHSIA)

class WebNNServiceIntrospection_GetExistingContextsDetails_ForwardToCallback
    : public mojo::MessageReceiver {
 public:
  WebNNServiceIntrospection_GetExistingContextsDetails_ForwardToCallback(
      WebNNServiceIntrospection::GetExistingContextsDetailsCallback callback
      ) : callback_(std::move(callback)) {
  }

  WebNNServiceIntrospection_GetExistingContextsDetails_ForwardToCallback(const WebNNServiceIntrospection_GetExistingContextsDetails_ForwardToCallback&) = delete;
  WebNNServiceIntrospection_GetExistingContextsDetails_ForwardToCallback& operator=(const WebNNServiceIntrospection_GetExistingContextsDetails_ForwardToCallback&) = delete;

  bool Accept(mojo::Message* message) override;
 private:
  WebNNServiceIntrospection::GetExistingContextsDetailsCallback callback_;
};

class WebNNServiceIntrospection_GetAvailableExecutionProvidersDetails_ForwardToCallback
    : public mojo::MessageReceiver {
 public:
  WebNNServiceIntrospection_GetAvailableExecutionProvidersDetails_ForwardToCallback(
      WebNNServiceIntrospection::GetAvailableExecutionProvidersDetailsCallback callback
      ) : callback_(std::move(callback)) {
  }

  WebNNServiceIntrospection_GetAvailableExecutionProvidersDetails_ForwardToCallback(const WebNNServiceIntrospection_GetAvailableExecutionProvidersDetails_ForwardToCallback&) = delete;
  WebNNServiceIntrospection_GetAvailableExecutionProvidersDetails_ForwardToCallback& operator=(const WebNNServiceIntrospection_GetAvailableExecutionProvidersDetails_ForwardToCallback&) = delete;

  bool Accept(mojo::Message* message) override;
 private:
  WebNNServiceIntrospection::GetAvailableExecutionProvidersDetailsCallback callback_;
};

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

void WebNNServiceIntrospectionProxy::SetClient(
    ::mojo::PendingRemote<WebNNServiceIntrospectionClient> in_client) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send webnn::mojom::WebNNServiceIntrospection::SetClient", "input_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("client"), in_client,
                        "<value of type ::mojo::PendingRemote<WebNNServiceIntrospectionClient>>");
   });
#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::WebNNServiceIntrospection::kSetClient), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::webnn::mojom::internal::WebNNServiceIntrospection_SetClient_Params_Data> params(
          message);
  params.Allocate();

  
  mojo::internal::Serialize<mojo::InterfacePtrDataView<::webnn::mojom::WebNNServiceIntrospectionClientInterfaceBase>>(
    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 WebNNServiceIntrospection.SetClient request");

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(WebNNServiceIntrospection::Name_);
  message.set_method_name("SetClient");
#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 WebNNServiceIntrospectionProxy::GetExistingContextsDetails(
    GetExistingContextsDetailsCallback callback) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT0("mojom", "Send webnn::mojom::WebNNServiceIntrospection::GetExistingContextsDetails");
#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(
      std::to_underlying(messages::WebNNServiceIntrospection::kGetExistingContextsDetails), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::webnn::mojom::internal::WebNNServiceIntrospection_GetExistingContextsDetails_Params_Data> params(
          message);
  params.Allocate();

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(WebNNServiceIntrospection::Name_);
  message.set_method_name("GetExistingContextsDetails");
#endif
  std::unique_ptr<mojo::MessageReceiver> responder(
      new WebNNServiceIntrospection_GetExistingContextsDetails_ForwardToCallback(
          std::move(callback)));
  ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder));
}

void WebNNServiceIntrospectionProxy::GetAvailableExecutionProvidersDetails(
    GetAvailableExecutionProvidersDetailsCallback callback) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT0("mojom", "Send webnn::mojom::WebNNServiceIntrospection::GetAvailableExecutionProvidersDetails");
#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(
      std::to_underlying(messages::WebNNServiceIntrospection::kGetAvailableExecutionProvidersDetails), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::webnn::mojom::internal::WebNNServiceIntrospection_GetAvailableExecutionProvidersDetails_Params_Data> params(
          message);
  params.Allocate();

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(WebNNServiceIntrospection::Name_);
  message.set_method_name("GetAvailableExecutionProvidersDetails");
#endif
  std::unique_ptr<mojo::MessageReceiver> responder(
      new WebNNServiceIntrospection_GetAvailableExecutionProvidersDetails_ForwardToCallback(
          std::move(callback)));
  ::mojo::internal::SendMojoMessage(*receiver_, message, std::move(responder));
}
class WebNNServiceIntrospection_GetExistingContextsDetails_ProxyToResponder : public ::mojo::internal::ProxyToResponder {
 public:
  static WebNNServiceIntrospection::GetExistingContextsDetailsCallback CreateCallback(
      ::mojo::Message& message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder) {
    std::unique_ptr<WebNNServiceIntrospection_GetExistingContextsDetails_ProxyToResponder> proxy(
        new WebNNServiceIntrospection_GetExistingContextsDetails_ProxyToResponder(
            message, std::move(responder)));
    return base::BindOnce(&WebNNServiceIntrospection_GetExistingContextsDetails_ProxyToResponder::Run,
                          std::move(proxy));
  }

  ~WebNNServiceIntrospection_GetExistingContextsDetails_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:
  WebNNServiceIntrospection_GetExistingContextsDetails_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)
        << "WebNNServiceIntrospection::GetExistingContextsDetailsCallback 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(
      std::vector<WebNNContextIntrospectionDetailsPtr> in_contexts_details);
};

bool WebNNServiceIntrospection_GetExistingContextsDetails_ForwardToCallback::Accept(
    mojo::Message* message) {
  DCHECK(message->is_serialized());
  internal::WebNNServiceIntrospection_GetExistingContextsDetails_ResponseParams_Data* params =
      reinterpret_cast<
          internal::WebNNServiceIntrospection_GetExistingContextsDetails_ResponseParams_Data*>(
              message->mutable_payload());
  

  // Validation for WebNNServiceIntrospection.1
  bool success = true;
  std::vector<WebNNContextIntrospectionDetailsPtr> p_contexts_details{};
  WebNNServiceIntrospection_GetExistingContextsDetails_ResponseParamsDataView input_data_view(params, message);
  
  if (success && !input_data_view.ReadContextsDetails(&p_contexts_details))
    success = false;
  if (!success) {
    ReportValidationErrorForMessage(
        message,
        mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
        WebNNServiceIntrospection::Name_, 1, true);
    return false;
  }
  if (!callback_.is_null()) {
    std::move(callback_).Run(
std::move(p_contexts_details));
  }
  return true;
}

void WebNNServiceIntrospection_GetExistingContextsDetails_ProxyToResponder::Run(
    std::vector<WebNNContextIntrospectionDetailsPtr> in_contexts_details) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send reply webnn::mojom::WebNNServiceIntrospection::GetExistingContextsDetails", "async_response_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("contexts_details"), in_contexts_details,
                        "<value of type std::vector<WebNNContextIntrospectionDetailsPtr>>");
   });
#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(
      std::to_underlying(messages::WebNNServiceIntrospection::kGetExistingContextsDetails), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::webnn::mojom::internal::WebNNServiceIntrospection_GetExistingContextsDetails_ResponseParams_Data> params(
          message);
  params.Allocate();
  mojo::internal::MessageFragment<
      typename decltype(params->contexts_details)::BaseType>
      contexts_details_fragment(params.message());
  constexpr const mojo::internal::ContainerValidateParams& contexts_details_validate_params =
      mojo::internal::GetArrayValidator<0, false, nullptr>();
  
  mojo::internal::Serialize<mojo::ArrayDataView<::webnn::mojom::WebNNContextIntrospectionDetailsDataView>>(
    in_contexts_details,
    contexts_details_fragment,
    &contexts_details_validate_params);

  params->contexts_details.Set(
      contexts_details_fragment.is_null() ? nullptr : contexts_details_fragment.data());

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

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(WebNNServiceIntrospection::Name_);
  message.set_method_name("GetExistingContextsDetails");
#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;
}
class WebNNServiceIntrospection_GetAvailableExecutionProvidersDetails_ProxyToResponder : public ::mojo::internal::ProxyToResponder {
 public:
  static WebNNServiceIntrospection::GetAvailableExecutionProvidersDetailsCallback CreateCallback(
      ::mojo::Message& message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder) {
    std::unique_ptr<WebNNServiceIntrospection_GetAvailableExecutionProvidersDetails_ProxyToResponder> proxy(
        new WebNNServiceIntrospection_GetAvailableExecutionProvidersDetails_ProxyToResponder(
            message, std::move(responder)));
    return base::BindOnce(&WebNNServiceIntrospection_GetAvailableExecutionProvidersDetails_ProxyToResponder::Run,
                          std::move(proxy));
  }

  ~WebNNServiceIntrospection_GetAvailableExecutionProvidersDetails_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:
  WebNNServiceIntrospection_GetAvailableExecutionProvidersDetails_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)
        << "WebNNServiceIntrospection::GetAvailableExecutionProvidersDetailsCallback 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(
      std::vector<WebNNExecutionProviderDetailsPtr> in_execution_providers);
};

bool WebNNServiceIntrospection_GetAvailableExecutionProvidersDetails_ForwardToCallback::Accept(
    mojo::Message* message) {
  DCHECK(message->is_serialized());
  internal::WebNNServiceIntrospection_GetAvailableExecutionProvidersDetails_ResponseParams_Data* params =
      reinterpret_cast<
          internal::WebNNServiceIntrospection_GetAvailableExecutionProvidersDetails_ResponseParams_Data*>(
              message->mutable_payload());
  

  // Validation for WebNNServiceIntrospection.2
  bool success = true;
  std::vector<WebNNExecutionProviderDetailsPtr> p_execution_providers{};
  WebNNServiceIntrospection_GetAvailableExecutionProvidersDetails_ResponseParamsDataView input_data_view(params, message);
  
  if (success && !input_data_view.ReadExecutionProviders(&p_execution_providers))
    success = false;
  if (!success) {
    ReportValidationErrorForMessage(
        message,
        mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
        WebNNServiceIntrospection::Name_, 2, true);
    return false;
  }
  if (!callback_.is_null()) {
    std::move(callback_).Run(
std::move(p_execution_providers));
  }
  return true;
}

void WebNNServiceIntrospection_GetAvailableExecutionProvidersDetails_ProxyToResponder::Run(
    std::vector<WebNNExecutionProviderDetailsPtr> in_execution_providers) {
#if BUILDFLAG(MOJO_TRACE_ENABLED)
  TRACE_EVENT1(
    "mojom", "Send reply webnn::mojom::WebNNServiceIntrospection::GetAvailableExecutionProvidersDetails", "async_response_parameters",
    [&](perfetto::TracedValue context){
      auto dict = std::move(context).WriteDictionary();
      perfetto::WriteIntoTracedValueWithFallback(
           dict.AddItem("execution_providers"), in_execution_providers,
                        "<value of type std::vector<WebNNExecutionProviderDetailsPtr>>");
   });
#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(
      std::to_underlying(messages::WebNNServiceIntrospection::kGetAvailableExecutionProvidersDetails), kFlags, estimated_payload_size);
  mojo::internal::MessageFragment<
      ::webnn::mojom::internal::WebNNServiceIntrospection_GetAvailableExecutionProvidersDetails_ResponseParams_Data> params(
          message);
  params.Allocate();
  mojo::internal::MessageFragment<
      typename decltype(params->execution_providers)::BaseType>
      execution_providers_fragment(params.message());
  constexpr const mojo::internal::ContainerValidateParams& execution_providers_validate_params =
      mojo::internal::GetArrayValidator<0, false, nullptr>();
  
  mojo::internal::Serialize<mojo::ArrayDataView<::webnn::mojom::WebNNExecutionProviderDetailsDataView>>(
    in_execution_providers,
    execution_providers_fragment,
    &execution_providers_validate_params);

  params->execution_providers.Set(
      execution_providers_fragment.is_null() ? nullptr : execution_providers_fragment.data());

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

#if defined(ENABLE_IPC_FUZZER)
  message.set_interface_name(WebNNServiceIntrospection::Name_);
  message.set_method_name("GetAvailableExecutionProvidersDetails");
#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;
}

// static
bool WebNNServiceIntrospectionStubDispatch::Accept(
    WebNNServiceIntrospection* impl,
    mojo::Message* message) {
  switch (static_cast<messages::WebNNServiceIntrospection>(message->header()->name)) {
    case messages::WebNNServiceIntrospection::kSetClient: {
      DCHECK(message->is_serialized());
      internal::WebNNServiceIntrospection_SetClient_Params_Data* params =
          reinterpret_cast<internal::WebNNServiceIntrospection_SetClient_Params_Data*>(
              message->mutable_payload());
      

      // Validation for WebNNServiceIntrospection.0
      bool success = true;
      ::mojo::PendingRemote<WebNNServiceIntrospectionClient> p_client{};
      WebNNServiceIntrospection_SetClient_ParamsDataView input_data_view(params, message);
      
      if (success) {
        p_client =
            input_data_view.TakeClient<decltype(p_client)>();
      }
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            WebNNServiceIntrospection::Name_, 0, false);
        return false;
      }
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->SetClient(        
        std::move(p_client));
      return true;
    }
    case messages::WebNNServiceIntrospection::kGetExistingContextsDetails: {
      break;
    }
    case messages::WebNNServiceIntrospection::kGetAvailableExecutionProvidersDetails: {
      break;
    }
  }
  return false;
}

// static
bool WebNNServiceIntrospectionStubDispatch::AcceptWithResponder(
    WebNNServiceIntrospection* 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::WebNNServiceIntrospection>(message->header()->name)) {
    case messages::WebNNServiceIntrospection::kSetClient: {
      break;
    }
    case messages::WebNNServiceIntrospection::kGetExistingContextsDetails: {
      internal::WebNNServiceIntrospection_GetExistingContextsDetails_Params_Data* params =
          reinterpret_cast<
              internal::WebNNServiceIntrospection_GetExistingContextsDetails_Params_Data*>(
                  message->mutable_payload());
      

      // Validation for WebNNServiceIntrospection.1
      bool success = true;
      WebNNServiceIntrospection_GetExistingContextsDetails_ParamsDataView input_data_view(params, message);
      
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            WebNNServiceIntrospection::Name_, 1, false);
        return false;
      }
      auto callback =
          WebNNServiceIntrospection_GetExistingContextsDetails_ProxyToResponder::CreateCallback(
              *message, std::move(responder));
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->GetExistingContextsDetails(std::move(callback));
      return true;
    }
    case messages::WebNNServiceIntrospection::kGetAvailableExecutionProvidersDetails: {
      internal::WebNNServiceIntrospection_GetAvailableExecutionProvidersDetails_Params_Data* params =
          reinterpret_cast<
              internal::WebNNServiceIntrospection_GetAvailableExecutionProvidersDetails_Params_Data*>(
                  message->mutable_payload());
      

      // Validation for WebNNServiceIntrospection.2
      bool success = true;
      WebNNServiceIntrospection_GetAvailableExecutionProvidersDetails_ParamsDataView input_data_view(params, message);
      
      if (!success) {
        ReportValidationErrorForMessage(
            message,
            mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED,
            WebNNServiceIntrospection::Name_, 2, false);
        return false;
      }
      auto callback =
          WebNNServiceIntrospection_GetAvailableExecutionProvidersDetails_ProxyToResponder::CreateCallback(
              *message, std::move(responder));
      // A null |impl| means no implementation was bound.
      DCHECK(impl);
      impl->GetAvailableExecutionProvidersDetails(std::move(callback));
      return true;
    }
  }
  return false;
}
namespace {
}  // namespace
static const mojo::internal::GenericValidationInfo kWebNNServiceIntrospectionValidationInfo[] = {
    { &internal::WebNNServiceIntrospection_SetClient_Params_Data::Validate,
     nullptr /* no response */},
    { &internal::WebNNServiceIntrospection_GetExistingContextsDetails_Params_Data::Validate,
     &internal::WebNNServiceIntrospection_GetExistingContextsDetails_ResponseParams_Data::Validate},
    { &internal::WebNNServiceIntrospection_GetAvailableExecutionProvidersDetails_Params_Data::Validate,
     &internal::WebNNServiceIntrospection_GetAvailableExecutionProvidersDetails_ResponseParams_Data::Validate},
};

bool WebNNServiceIntrospectionRequestValidator::Accept(mojo::Message* message) {
  return mojo::internal::ValidateRequestGenericPacked(
    message,
    ::webnn::mojom::WebNNServiceIntrospection::Name_,
    kWebNNServiceIntrospectionValidationInfo);
}

bool WebNNServiceIntrospectionResponseValidator::Accept(mojo::Message* message) {
  return mojo::internal::ValidateResponseGenericPacked(
    message,
    ::webnn::mojom::WebNNServiceIntrospection::Name_,
    kWebNNServiceIntrospectionValidationInfo);
}


}  // webnn::mojom


namespace mojo {


// static
bool StructTraits<::webnn::mojom::WebNNExecutionProviderDetails::DataView, ::webnn::mojom::WebNNExecutionProviderDetailsPtr>::Read(
    ::webnn::mojom::WebNNExecutionProviderDetails::DataView input,
    ::webnn::mojom::WebNNExecutionProviderDetailsPtr* output) {
  bool success = true;
  ::webnn::mojom::WebNNExecutionProviderDetailsPtr result(::webnn::mojom::WebNNExecutionProviderDetails::New());
  
      if (success && !input.ReadName(&result->name))
        success = false;
      if (success && !input.ReadVendor(&result->vendor))
        success = false;
      if (success && !input.ReadHardwareType(&result->hardware_type))
        success = false;
      if (success && !input.ReadVendorId(&result->vendor_id))
        success = false;
      if (success && !input.ReadDeviceId(&result->device_id))
        success = false;
      if (success && !input.ReadVersion(&result->version))
        success = false;
      if (success)
        result->first_selected = input.first_selected();
  *output = std::move(result);
  return success;
}


// static
bool StructTraits<::webnn::mojom::WebNNContextIntrospectionDetails::DataView, ::webnn::mojom::WebNNContextIntrospectionDetailsPtr>::Read(
    ::webnn::mojom::WebNNContextIntrospectionDetails::DataView input,
    ::webnn::mojom::WebNNContextIntrospectionDetailsPtr* output) {
  bool success = true;
  ::webnn::mojom::WebNNContextIntrospectionDetailsPtr result(::webnn::mojom::WebNNContextIntrospectionDetails::New());
  
      if (success)
        result->context_id = input.context_id();
      if (success && !input.ReadContextBackend(&result->context_backend))
        success = false;
      if (success && !input.ReadExecutionProviders(&result->execution_providers))
        success = false;
  *output = std::move(result);
  return success;
}

}  // namespace mojo


// Symbols declared in the -test-utils.h header are defined here instead of a
// separate .cc file to save compile time.


namespace webnn::mojom {


void WebNNServiceIntrospectionClientInterceptorForTesting::OnUpdateExistingContextDetails(std::vector<WebNNContextIntrospectionDetailsPtr> contexts_details) {
  GetForwardingInterface()->OnUpdateExistingContextDetails(
    std::move(contexts_details)
    );
}
void WebNNServiceIntrospectionClientInterceptorForTesting::OnUpdateAvailableExecutionProvidersDetails(std::vector<WebNNExecutionProviderDetailsPtr> available_execution_providers) {
  GetForwardingInterface()->OnUpdateAvailableExecutionProvidersDetails(
    std::move(available_execution_providers)
    );
}
WebNNServiceIntrospectionClientAsyncWaiter::WebNNServiceIntrospectionClientAsyncWaiter(
    WebNNServiceIntrospectionClient* proxy) : proxy_(proxy) {}

WebNNServiceIntrospectionClientAsyncWaiter::~WebNNServiceIntrospectionClientAsyncWaiter() = default;





void WebNNServiceIntrospectionInterceptorForTesting::SetClient(::mojo::PendingRemote<WebNNServiceIntrospectionClient> client) {
  GetForwardingInterface()->SetClient(
    std::move(client)
    );
}
void WebNNServiceIntrospectionInterceptorForTesting::GetExistingContextsDetails(GetExistingContextsDetailsCallback callback) {
  GetForwardingInterface()->GetExistingContextsDetails(std::move(callback));
}
void WebNNServiceIntrospectionInterceptorForTesting::GetAvailableExecutionProvidersDetails(GetAvailableExecutionProvidersDetailsCallback callback) {
  GetForwardingInterface()->GetAvailableExecutionProvidersDetails(std::move(callback));
}
WebNNServiceIntrospectionAsyncWaiter::WebNNServiceIntrospectionAsyncWaiter(
    WebNNServiceIntrospection* proxy) : proxy_(proxy) {}

WebNNServiceIntrospectionAsyncWaiter::~WebNNServiceIntrospectionAsyncWaiter() = default;


void WebNNServiceIntrospectionAsyncWaiter::GetExistingContextsDetails(
    std::vector<WebNNContextIntrospectionDetailsPtr>* out_contexts_details) {
  base::RunLoop loop;
  proxy_->GetExistingContextsDetails(
      base::BindOnce(
          [](base::RunLoop* loop,
             std::vector<WebNNContextIntrospectionDetailsPtr>* out_contexts_details
,
             std::vector<WebNNContextIntrospectionDetailsPtr> contexts_details) {*out_contexts_details = std::move(contexts_details);
            loop->Quit();
          },
          &loop,
          out_contexts_details));
  loop.Run();
}

std::vector<WebNNContextIntrospectionDetailsPtr> WebNNServiceIntrospectionAsyncWaiter::GetExistingContextsDetails(
    ) {
  std::vector<WebNNContextIntrospectionDetailsPtr> async_wait_result;
  GetExistingContextsDetails(&async_wait_result);
  return async_wait_result;
}

void WebNNServiceIntrospectionAsyncWaiter::GetAvailableExecutionProvidersDetails(
    std::vector<WebNNExecutionProviderDetailsPtr>* out_execution_providers) {
  base::RunLoop loop;
  proxy_->GetAvailableExecutionProvidersDetails(
      base::BindOnce(
          [](base::RunLoop* loop,
             std::vector<WebNNExecutionProviderDetailsPtr>* out_execution_providers
,
             std::vector<WebNNExecutionProviderDetailsPtr> execution_providers) {*out_execution_providers = std::move(execution_providers);
            loop->Quit();
          },
          &loop,
          out_execution_providers));
  loop.Run();
}

std::vector<WebNNExecutionProviderDetailsPtr> WebNNServiceIntrospectionAsyncWaiter::GetAvailableExecutionProvidersDetails(
    ) {
  std::vector<WebNNExecutionProviderDetailsPtr> async_wait_result;
  GetAvailableExecutionProvidersDetails(&async_wait_result);
  return async_wait_result;
}






}  // webnn::mojom


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