// gpu/ipc/common/vulkan_ycbcr_info.mojom-blink.cc is auto generated by mojom_bindings_generator.py, do not edit

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

#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
#endif

#include "gpu/ipc/common/vulkan_ycbcr_info.mojom-blink.h"
#include <stdint.h>
#include <utility>
#include "mojo/public/cpp/bindings/lib/default_construct_tag_internal.h"
#include "mojo/public/cpp/bindings/lib/serialization.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 "third_party/perfetto/include/perfetto/tracing/traced_value.h"

#include "gpu/ipc/common/vulkan_ycbcr_info.mojom-params-data.h"
#include "gpu/ipc/common/vulkan_ycbcr_info.mojom-shared-message-ids.h"

#include "gpu/ipc/common/vulkan_ycbcr_info.mojom-blink-import-headers.h"
#include "gpu/ipc/common/vulkan_ycbcr_info.mojom-blink-test-utils.h"
#include "mojo/public/cpp/bindings/lib/wtf_serialization.h"


namespace gpu::mojom::blink {
VulkanYCbCrInfo::VulkanYCbCrInfo()
    : image_format(),
      external_format(),
      suggested_ycbcr_model(),
      suggested_ycbcr_range(),
      suggested_xchroma_offset(),
      suggested_ychroma_offset(),
      format_features() {}

VulkanYCbCrInfo::VulkanYCbCrInfo(
    uint32_t image_format_in,
    uint64_t external_format_in,
    uint32_t suggested_ycbcr_model_in,
    uint32_t suggested_ycbcr_range_in,
    uint32_t suggested_xchroma_offset_in,
    uint32_t suggested_ychroma_offset_in,
    uint32_t format_features_in)
    : image_format(std::move(image_format_in)),
      external_format(std::move(external_format_in)),
      suggested_ycbcr_model(std::move(suggested_ycbcr_model_in)),
      suggested_ycbcr_range(std::move(suggested_ycbcr_range_in)),
      suggested_xchroma_offset(std::move(suggested_xchroma_offset_in)),
      suggested_ychroma_offset(std::move(suggested_ychroma_offset_in)),
      format_features(std::move(format_features_in)) {}

VulkanYCbCrInfo::~VulkanYCbCrInfo() = default;
size_t VulkanYCbCrInfo::Hash(size_t seed) const {
  seed = mojo::internal::WTFHash(seed, this->image_format);
  seed = mojo::internal::WTFHash(seed, this->external_format);
  seed = mojo::internal::WTFHash(seed, this->suggested_ycbcr_model);
  seed = mojo::internal::WTFHash(seed, this->suggested_ycbcr_range);
  seed = mojo::internal::WTFHash(seed, this->suggested_xchroma_offset);
  seed = mojo::internal::WTFHash(seed, this->suggested_ychroma_offset);
  seed = mojo::internal::WTFHash(seed, this->format_features);
  return seed;
}

void VulkanYCbCrInfo::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "image_format"), this->image_format,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type uint32_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "external_format"), this->external_format,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type uint64_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "suggested_ycbcr_model"), this->suggested_ycbcr_model,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type uint32_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "suggested_ycbcr_range"), this->suggested_ycbcr_range,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type uint32_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "suggested_xchroma_offset"), this->suggested_xchroma_offset,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type uint32_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "suggested_ychroma_offset"), this->suggested_ychroma_offset,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type uint32_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "format_features"), this->format_features,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type uint32_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

bool VulkanYCbCrInfo::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  return Data_::Validate(data, validation_context);
}


}  // gpu::mojom::blink


namespace mojo {


// static
bool StructTraits<::gpu::mojom::blink::VulkanYCbCrInfo::DataView, ::gpu::mojom::blink::VulkanYCbCrInfoPtr>::Read(
    ::gpu::mojom::blink::VulkanYCbCrInfo::DataView input,
    ::gpu::mojom::blink::VulkanYCbCrInfoPtr* output) {
  bool success = true;
  ::gpu::mojom::blink::VulkanYCbCrInfoPtr result(::gpu::mojom::blink::VulkanYCbCrInfo::New());
  
      if (success)
        result->image_format = input.image_format();
      if (success)
        result->external_format = input.external_format();
      if (success)
        result->suggested_ycbcr_model = input.suggested_ycbcr_model();
      if (success)
        result->suggested_ycbcr_range = input.suggested_ycbcr_range();
      if (success)
        result->suggested_xchroma_offset = input.suggested_xchroma_offset();
      if (success)
        result->suggested_ychroma_offset = input.suggested_ychroma_offset();
      if (success)
        result->format_features = input.format_features();
  *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 gpu::mojom::blink {




}  // gpu::mojom::blink


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