// content/browser/xr/webxr_internals/mojom/webxr_internals.mojom-shared.cc is auto generated by mojom_bindings_generator.py, do not edit

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/xr/webxr_internals/mojom/webxr_internals.mojom-shared.h"
#include <utility>
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/cpp/bindings/lib/validation_util.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value.h"

#include "content/browser/xr/webxr_internals/mojom/webxr_internals.mojom-params-data.h"
namespace webxr {
namespace mojom {

namespace internal {


// static
bool DeviceInfo_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 40, validation_context)) {
    return false;
  }

  // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
  // the message comes from an older version.
  [[maybe_unused]] const DeviceInfo_Data* object =
      static_cast<const DeviceInfo_Data*>(data);

  if (!mojo::internal::ValidatePointerNonNullable(
          object->operating_system_name, 1, validation_context)) {
    return false;
  }
  constexpr const mojo::internal::ContainerValidateParams& operating_system_name_validate_params =
      mojo::internal::GetArrayValidator<0, false, nullptr>();
  if (!mojo::internal::ValidateContainer(object->operating_system_name, validation_context,
                                         &operating_system_name_validate_params)) {
    return false;
  }

  if (!mojo::internal::ValidatePointerNonNullable(
          object->operating_system_version, 2, validation_context)) {
    return false;
  }
  constexpr const mojo::internal::ContainerValidateParams& operating_system_version_validate_params =
      mojo::internal::GetArrayValidator<0, false, nullptr>();
  if (!mojo::internal::ValidateContainer(object->operating_system_version, validation_context,
                                         &operating_system_version_validate_params)) {
    return false;
  }

  if (!mojo::internal::ValidatePointerNonNullable(
          object->gpu_gl_vendor, 3, validation_context)) {
    return false;
  }
  constexpr const mojo::internal::ContainerValidateParams& gpu_gl_vendor_validate_params =
      mojo::internal::GetArrayValidator<0, false, nullptr>();
  if (!mojo::internal::ValidateContainer(object->gpu_gl_vendor, validation_context,
                                         &gpu_gl_vendor_validate_params)) {
    return false;
  }

  if (!mojo::internal::ValidatePointerNonNullable(
          object->gpu_gl_renderer, 4, validation_context)) {
    return false;
  }
  constexpr const mojo::internal::ContainerValidateParams& gpu_gl_renderer_validate_params =
      mojo::internal::GetArrayValidator<0, false, nullptr>();
  if (!mojo::internal::ValidateContainer(object->gpu_gl_renderer, validation_context,
                                         &gpu_gl_renderer_validate_params)) {
    return false;
  }

  return true;
}

DeviceInfo_Data::DeviceInfo_Data()
    : header_({sizeof(*this), 0}) {}


// static
bool SessionRequestedRecord_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 24, validation_context)) {
    return false;
  }

  // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
  // the message comes from an older version.
  [[maybe_unused]] const SessionRequestedRecord_Data* object =
      static_cast<const SessionRequestedRecord_Data*>(data);

  if (!mojo::internal::ValidatePointerNonNullable(
          object->options, 1, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateStruct(object->options, validation_context))
    return false;

  if (!mojo::internal::ValidatePointerNonNullable(
          object->requested_time, 2, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateStruct(object->requested_time, validation_context))
    return false;

  return true;
}

SessionRequestedRecord_Data::SessionRequestedRecord_Data()
    : header_({sizeof(*this), 0}) {}


// static
bool SessionRejectedRecord_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 48, validation_context)) {
    return false;
  }

  // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
  // the message comes from an older version.
  [[maybe_unused]] const SessionRejectedRecord_Data* object =
      static_cast<const SessionRejectedRecord_Data*>(data);


  if (!::device::mojom::internal::RequestSessionError_Data
        ::Validate(object->failure_reason, validation_context))
    return false;

  if (!mojo::internal::ValidatePointerNonNullable(
          object->rejected_time, 3, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateStruct(object->rejected_time, validation_context))
    return false;

  if (!mojo::internal::ValidatePointerNonNullable(
          object->failure_reason_description, 4, validation_context)) {
    return false;
  }
  constexpr const mojo::internal::ContainerValidateParams& failure_reason_description_validate_params =
      mojo::internal::GetArrayValidator<0, false, nullptr>();
  if (!mojo::internal::ValidateContainer(object->failure_reason_description, validation_context,
                                         &failure_reason_description_validate_params)) {
    return false;
  }

  if (!mojo::internal::ValidatePointerNonNullable(
          object->rejected_features, 5, validation_context)) {
    return false;
  }
  constexpr const mojo::internal::ContainerValidateParams& rejected_features_validate_params =
      mojo::internal::GetArrayOfEnumsValidator<0, false, ::device::mojom::internal::XRSessionFeature_Data::Validate>();
  if (!mojo::internal::ValidateContainer(object->rejected_features, validation_context,
                                         &rejected_features_validate_params)) {
    return false;
  }

  return true;
}

SessionRejectedRecord_Data::SessionRejectedRecord_Data()
    : header_({sizeof(*this), 0}) {}


// static
bool SessionStartedRecord_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 32, validation_context)) {
    return false;
  }

  // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
  // the message comes from an older version.
  [[maybe_unused]] const SessionStartedRecord_Data* object =
      static_cast<const SessionStartedRecord_Data*>(data);


  if (!::device::mojom::internal::XRDeviceId_Data
        ::Validate(object->device_id, validation_context))
    return false;

  if (!mojo::internal::ValidatePointerNonNullable(
          object->started_time, 3, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateStruct(object->started_time, validation_context))
    return false;

  return true;
}

SessionStartedRecord_Data::SessionStartedRecord_Data()
    : header_({sizeof(*this), 0}) {}


// static
bool SessionStoppedRecord_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 24, validation_context)) {
    return false;
  }

  // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
  // the message comes from an older version.
  [[maybe_unused]] const SessionStoppedRecord_Data* object =
      static_cast<const SessionStoppedRecord_Data*>(data);

  if (!mojo::internal::ValidatePointerNonNullable(
          object->stopped_time, 2, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateStruct(object->stopped_time, validation_context))
    return false;

  return true;
}

SessionStoppedRecord_Data::SessionStoppedRecord_Data()
    : header_({sizeof(*this), 0}) {}


// static
bool RuntimeInfo_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 24, validation_context)) {
    return false;
  }

  // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
  // the message comes from an older version.
  [[maybe_unused]] const RuntimeInfo_Data* object =
      static_cast<const RuntimeInfo_Data*>(data);


  if (!::device::mojom::internal::XRDeviceId_Data
        ::Validate(object->device_id, validation_context))
    return false;

  if (!mojo::internal::ValidatePointerNonNullable(
          object->supported_features, 2, validation_context)) {
    return false;
  }
  constexpr const mojo::internal::ContainerValidateParams& supported_features_validate_params =
      mojo::internal::GetArrayOfEnumsValidator<0, false, ::device::mojom::internal::XRSessionFeature_Data::Validate>();
  if (!mojo::internal::ValidateContainer(object->supported_features, validation_context,
                                         &supported_features_validate_params)) {
    return false;
  }

  return true;
}

RuntimeInfo_Data::RuntimeInfo_Data()
    : header_({sizeof(*this), 0}) {}


// static
bool WebXrInternalsHandler_GetDeviceInfo_Params_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 8, validation_context)) {
    return false;
  }

  // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
  // the message comes from an older version.
  [[maybe_unused]] const WebXrInternalsHandler_GetDeviceInfo_Params_Data* object =
      static_cast<const WebXrInternalsHandler_GetDeviceInfo_Params_Data*>(data);

  return true;
}

WebXrInternalsHandler_GetDeviceInfo_Params_Data::WebXrInternalsHandler_GetDeviceInfo_Params_Data()
    : header_({sizeof(*this), 0}) {}


// static
bool WebXrInternalsHandler_GetDeviceInfo_ResponseParams_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 16, validation_context)) {
    return false;
  }

  // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
  // the message comes from an older version.
  [[maybe_unused]] const WebXrInternalsHandler_GetDeviceInfo_ResponseParams_Data* object =
      static_cast<const WebXrInternalsHandler_GetDeviceInfo_ResponseParams_Data*>(data);

  if (!mojo::internal::ValidatePointerNonNullable(
          object->device_info, 1, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateStruct(object->device_info, validation_context))
    return false;

  return true;
}

WebXrInternalsHandler_GetDeviceInfo_ResponseParams_Data::WebXrInternalsHandler_GetDeviceInfo_ResponseParams_Data()
    : header_({sizeof(*this), 0}) {}


// static
bool WebXrInternalsHandler_GetActiveRuntimes_Params_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 8, validation_context)) {
    return false;
  }

  // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
  // the message comes from an older version.
  [[maybe_unused]] const WebXrInternalsHandler_GetActiveRuntimes_Params_Data* object =
      static_cast<const WebXrInternalsHandler_GetActiveRuntimes_Params_Data*>(data);

  return true;
}

WebXrInternalsHandler_GetActiveRuntimes_Params_Data::WebXrInternalsHandler_GetActiveRuntimes_Params_Data()
    : header_({sizeof(*this), 0}) {}


// static
bool WebXrInternalsHandler_GetActiveRuntimes_ResponseParams_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 16, validation_context)) {
    return false;
  }

  // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
  // the message comes from an older version.
  [[maybe_unused]] const WebXrInternalsHandler_GetActiveRuntimes_ResponseParams_Data* object =
      static_cast<const WebXrInternalsHandler_GetActiveRuntimes_ResponseParams_Data*>(data);

  if (!mojo::internal::ValidatePointerNonNullable(
          object->active_runtimes, 1, validation_context)) {
    return false;
  }
  constexpr const mojo::internal::ContainerValidateParams& active_runtimes_validate_params =
      mojo::internal::GetArrayValidator<0, false, nullptr>();
  if (!mojo::internal::ValidateContainer(object->active_runtimes, validation_context,
                                         &active_runtimes_validate_params)) {
    return false;
  }

  return true;
}

WebXrInternalsHandler_GetActiveRuntimes_ResponseParams_Data::WebXrInternalsHandler_GetActiveRuntimes_ResponseParams_Data()
    : header_({sizeof(*this), 0}) {}


// static
bool WebXrInternalsHandler_SubscribeToEvents_Params_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 16, validation_context)) {
    return false;
  }

  // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
  // the message comes from an older version.
  [[maybe_unused]] const WebXrInternalsHandler_SubscribeToEvents_Params_Data* object =
      static_cast<const WebXrInternalsHandler_SubscribeToEvents_Params_Data*>(data);

  if (!mojo::internal::ValidateHandleOrInterfaceNonNullable(
          object->listener, 1, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateHandleOrInterface(object->listener,
                                                 validation_context)) {
    return false;
  }

  return true;
}

WebXrInternalsHandler_SubscribeToEvents_Params_Data::WebXrInternalsHandler_SubscribeToEvents_Params_Data()
    : header_({sizeof(*this), 0}) {}


// static
bool XRInternalsSessionListener_LogXrSessionRequested_Params_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 16, validation_context)) {
    return false;
  }

  // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
  // the message comes from an older version.
  [[maybe_unused]] const XRInternalsSessionListener_LogXrSessionRequested_Params_Data* object =
      static_cast<const XRInternalsSessionListener_LogXrSessionRequested_Params_Data*>(data);

  if (!mojo::internal::ValidatePointerNonNullable(
          object->session_requested_record, 1, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateStruct(object->session_requested_record, validation_context))
    return false;

  return true;
}

XRInternalsSessionListener_LogXrSessionRequested_Params_Data::XRInternalsSessionListener_LogXrSessionRequested_Params_Data()
    : header_({sizeof(*this), 0}) {}


// static
bool XRInternalsSessionListener_LogXrSessionRejected_Params_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 16, validation_context)) {
    return false;
  }

  // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
  // the message comes from an older version.
  [[maybe_unused]] const XRInternalsSessionListener_LogXrSessionRejected_Params_Data* object =
      static_cast<const XRInternalsSessionListener_LogXrSessionRejected_Params_Data*>(data);

  if (!mojo::internal::ValidatePointerNonNullable(
          object->session_rejected_record, 1, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateStruct(object->session_rejected_record, validation_context))
    return false;

  return true;
}

XRInternalsSessionListener_LogXrSessionRejected_Params_Data::XRInternalsSessionListener_LogXrSessionRejected_Params_Data()
    : header_({sizeof(*this), 0}) {}


// static
bool XRInternalsSessionListener_LogXrSessionStarted_Params_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 16, validation_context)) {
    return false;
  }

  // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
  // the message comes from an older version.
  [[maybe_unused]] const XRInternalsSessionListener_LogXrSessionStarted_Params_Data* object =
      static_cast<const XRInternalsSessionListener_LogXrSessionStarted_Params_Data*>(data);

  if (!mojo::internal::ValidatePointerNonNullable(
          object->session_started_record, 1, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateStruct(object->session_started_record, validation_context))
    return false;

  return true;
}

XRInternalsSessionListener_LogXrSessionStarted_Params_Data::XRInternalsSessionListener_LogXrSessionStarted_Params_Data()
    : header_({sizeof(*this), 0}) {}


// static
bool XRInternalsSessionListener_LogXrSessionStopped_Params_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 16, validation_context)) {
    return false;
  }

  // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
  // the message comes from an older version.
  [[maybe_unused]] const XRInternalsSessionListener_LogXrSessionStopped_Params_Data* object =
      static_cast<const XRInternalsSessionListener_LogXrSessionStopped_Params_Data*>(data);

  if (!mojo::internal::ValidatePointerNonNullable(
          object->session_stopped_record, 1, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateStruct(object->session_stopped_record, validation_context))
    return false;

  return true;
}

XRInternalsSessionListener_LogXrSessionStopped_Params_Data::XRInternalsSessionListener_LogXrSessionStopped_Params_Data()
    : header_({sizeof(*this), 0}) {}


// static
bool XRInternalsSessionListener_LogXrRuntimeAdded_Params_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 16, validation_context)) {
    return false;
  }

  // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
  // the message comes from an older version.
  [[maybe_unused]] const XRInternalsSessionListener_LogXrRuntimeAdded_Params_Data* object =
      static_cast<const XRInternalsSessionListener_LogXrRuntimeAdded_Params_Data*>(data);

  if (!mojo::internal::ValidatePointerNonNullable(
          object->runtime_added_record, 1, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateStruct(object->runtime_added_record, validation_context))
    return false;

  return true;
}

XRInternalsSessionListener_LogXrRuntimeAdded_Params_Data::XRInternalsSessionListener_LogXrRuntimeAdded_Params_Data()
    : header_({sizeof(*this), 0}) {}


// static
bool XRInternalsSessionListener_LogXrRuntimeRemoved_Params_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 16, validation_context)) {
    return false;
  }

  // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
  // the message comes from an older version.
  [[maybe_unused]] const XRInternalsSessionListener_LogXrRuntimeRemoved_Params_Data* object =
      static_cast<const XRInternalsSessionListener_LogXrRuntimeRemoved_Params_Data*>(data);


  if (!::device::mojom::internal::XRDeviceId_Data
        ::Validate(object->device_id, validation_context))
    return false;

  return true;
}

XRInternalsSessionListener_LogXrRuntimeRemoved_Params_Data::XRInternalsSessionListener_LogXrRuntimeRemoved_Params_Data()
    : header_({sizeof(*this), 0}) {}


// static
bool XRInternalsSessionListener_LogFrameData_Params_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 16, validation_context)) {
    return false;
  }

  // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
  // the message comes from an older version.
  [[maybe_unused]] const XRInternalsSessionListener_LogFrameData_Params_Data* object =
      static_cast<const XRInternalsSessionListener_LogFrameData_Params_Data*>(data);

  if (!mojo::internal::ValidatePointerNonNullable(
          object->xrframe_statistics, 1, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateStruct(object->xrframe_statistics, validation_context))
    return false;

  return true;
}

XRInternalsSessionListener_LogFrameData_Params_Data::XRInternalsSessionListener_LogFrameData_Params_Data()
    : header_({sizeof(*this), 0}) {}


// static
bool XRInternalsSessionListener_LogConsoleMessages_Params_Data::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  if (!data)
    return true;
  if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
          data, 16, validation_context)) {
    return false;
  }

  // NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
  // the message comes from an older version.
  [[maybe_unused]] const XRInternalsSessionListener_LogConsoleMessages_Params_Data* object =
      static_cast<const XRInternalsSessionListener_LogConsoleMessages_Params_Data*>(data);

  if (!mojo::internal::ValidatePointerNonNullable(
          object->xrlogging_statistics, 1, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateStruct(object->xrlogging_statistics, validation_context))
    return false;

  return true;
}

XRInternalsSessionListener_LogConsoleMessages_Params_Data::XRInternalsSessionListener_LogConsoleMessages_Params_Data()
    : header_({sizeof(*this), 0}) {}

}  // namespace internal
}  // namespace mojom
}  // namespace webxr