// services/viz/privileged/mojom/gl/gpu_host.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 "services/viz/privileged/mojom/gl/gpu_host.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 "services/viz/privileged/mojom/gl/gpu_host.mojom-params-data.h"
namespace viz {
namespace mojom {

namespace internal {


// static
bool GpuHost_DidInitialize_Params_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 GpuHost_DidInitialize_Params_Data* object =
      static_cast<const GpuHost_DidInitialize_Params_Data*>(data);

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

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

  if (!mojo::internal::ValidateStruct(object->gpu_info_for_hardware_gpu, validation_context))
    return false;

  if (!mojo::internal::ValidateStruct(object->gpu_feature_info_for_hardware_gpu, validation_context))
    return false;

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

  return true;
}

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


// static
bool GpuHost_DidFailInitialize_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 GpuHost_DidFailInitialize_Params_Data* object =
      static_cast<const GpuHost_DidFailInitialize_Params_Data*>(data);

  return true;
}

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


// static
bool GpuHost_DidCreateContextSuccessfully_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 GpuHost_DidCreateContextSuccessfully_Params_Data* object =
      static_cast<const GpuHost_DidCreateContextSuccessfully_Params_Data*>(data);

  return true;
}

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


// static
bool GpuHost_DidCreateOffscreenContext_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 GpuHost_DidCreateOffscreenContext_Params_Data* object =
      static_cast<const GpuHost_DidCreateOffscreenContext_Params_Data*>(data);

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

  return true;
}

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


// static
bool GpuHost_DidDestroyOffscreenContext_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 GpuHost_DidDestroyOffscreenContext_Params_Data* object =
      static_cast<const GpuHost_DidDestroyOffscreenContext_Params_Data*>(data);

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

  return true;
}

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


// static
bool GpuHost_DidDestroyChannel_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 GpuHost_DidDestroyChannel_Params_Data* object =
      static_cast<const GpuHost_DidDestroyChannel_Params_Data*>(data);

  return true;
}

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


// static
bool GpuHost_DidDestroyAllChannels_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 GpuHost_DidDestroyAllChannels_Params_Data* object =
      static_cast<const GpuHost_DidDestroyAllChannels_Params_Data*>(data);

  return true;
}

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


// static
bool GpuHost_DidLoseContext_Params_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 GpuHost_DidLoseContext_Params_Data* object =
      static_cast<const GpuHost_DidLoseContext_Params_Data*>(data);


  if (!::viz::mojom::internal::ContextLostReason_Data
        ::Validate(object->reason, validation_context))
    return false;

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

  return true;
}

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


// static
bool GpuHost_DidUpdateGPUInfo_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 GpuHost_DidUpdateGPUInfo_Params_Data* object =
      static_cast<const GpuHost_DidUpdateGPUInfo_Params_Data*>(data);

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

  return true;
}

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


// static
bool GpuHost_DisableGpuCompositing_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 GpuHost_DisableGpuCompositing_Params_Data* object =
      static_cast<const GpuHost_DisableGpuCompositing_Params_Data*>(data);

  return true;
}

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


// static
bool GpuHost_GetIsolationKey_Params_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 GpuHost_GetIsolationKey_Params_Data* object =
      static_cast<const GpuHost_GetIsolationKey_Params_Data*>(data);

  if (!mojo::internal::ValidateInlinedUnionNonNullable(
          object->wgpu_context_token, 2, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateInlinedUnion(object->wgpu_context_token, validation_context))
    return false;

  return true;
}

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


// static
bool GpuHost_GetIsolationKey_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 GpuHost_GetIsolationKey_ResponseParams_Data* object =
      static_cast<const GpuHost_GetIsolationKey_ResponseParams_Data*>(data);

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

  return true;
}

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


// static
bool GpuHost_StoreBlobToDisk_Params_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 GpuHost_StoreBlobToDisk_Params_Data* object =
      static_cast<const GpuHost_StoreBlobToDisk_Params_Data*>(data);

  if (!mojo::internal::ValidateInlinedUnionNonNullable(
          object->cache_handle, 1, validation_context)) {
    return false;
  }
  if (!mojo::internal::ValidateInlinedUnion(object->cache_handle, validation_context))
    return false;

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

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

  return true;
}

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


// static
bool GpuHost_ClearGrShaderDiskCache_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 GpuHost_ClearGrShaderDiskCache_Params_Data* object =
      static_cast<const GpuHost_ClearGrShaderDiskCache_Params_Data*>(data);

  return true;
}

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


// static
bool GpuHost_CreateWebNNWeightsFile_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 GpuHost_CreateWebNNWeightsFile_Params_Data* object =
      static_cast<const GpuHost_CreateWebNNWeightsFile_Params_Data*>(data);

  return true;
}

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


// static
bool GpuHost_CreateWebNNWeightsFile_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 GpuHost_CreateWebNNWeightsFile_ResponseParams_Data* object =
      static_cast<const GpuHost_CreateWebNNWeightsFile_ResponseParams_Data*>(data);

  if (!mojo::internal::ValidateStruct(object->file, validation_context))
    return false;

  return true;
}

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

}  // namespace internal
}  // namespace mojom
}  // namespace viz