// device/vr/public/mojom/xr_hand_tracking_data.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 "device/vr/public/mojom/xr_hand_tracking_data.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 "device/vr/public/mojom/xr_hand_tracking_data.mojom-params-data.h"
#include "device/vr/public/mojom/xr_hand_tracking_data.mojom-shared-message-ids.h"

#include "device/vr/public/mojom/xr_hand_tracking_data.mojom-blink-import-headers.h"
#include "device/vr/public/mojom/xr_hand_tracking_data.mojom-blink-test-utils.h"
#include "mojo/public/cpp/bindings/lib/wtf_serialization.h"


namespace device::mojom::blink {
XRHandJointData::XRHandJointData()
    : joint(),
      mojo_from_joint(),
      radius() {}

XRHandJointData::XRHandJointData(
    XRHandJoint joint_in,
    const std::optional<::gfx::Transform>& mojo_from_joint_in,
    float radius_in)
    : joint(std::move(joint_in)),
      mojo_from_joint(std::move(mojo_from_joint_in)),
      radius(std::move(radius_in)) {}

XRHandJointData::~XRHandJointData() = default;

void XRHandJointData::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "joint"), this->joint,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type XRHandJoint>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "mojo_from_joint"), this->mojo_from_joint,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const std::optional<::gfx::Transform>&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "radius"), this->radius,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type float>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

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

XRHandTrackingData::XRHandTrackingData(
    ::blink::Vector<XRHandJointDataPtr> hand_joint_data_in)
    : hand_joint_data(std::move(hand_joint_data_in)) {}

XRHandTrackingData::~XRHandTrackingData() = default;

void XRHandTrackingData::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "hand_joint_data"), this->hand_joint_data,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::blink::Vector<XRHandJointDataPtr>>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

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


}  // device::mojom::blink


namespace mojo {


// static
bool StructTraits<::device::mojom::blink::XRHandJointData::DataView, ::device::mojom::blink::XRHandJointDataPtr>::Read(
    ::device::mojom::blink::XRHandJointData::DataView input,
    ::device::mojom::blink::XRHandJointDataPtr* output) {
  bool success = true;
  ::device::mojom::blink::XRHandJointDataPtr result(::device::mojom::blink::XRHandJointData::New());
  
      if (success && !input.ReadJoint(&result->joint))
        success = false;
      if (success && !input.ReadMojoFromJoint(&result->mojo_from_joint))
        success = false;
      if (success)
        result->radius = input.radius();
  *output = std::move(result);
  return success;
}


// static
bool StructTraits<::device::mojom::blink::XRHandTrackingData::DataView, ::device::mojom::blink::XRHandTrackingDataPtr>::Read(
    ::device::mojom::blink::XRHandTrackingData::DataView input,
    ::device::mojom::blink::XRHandTrackingDataPtr* output) {
  bool success = true;
  ::device::mojom::blink::XRHandTrackingDataPtr result(::device::mojom::blink::XRHandTrackingData::New());
  
      if (success && !input.ReadHandJointData(&result->hand_joint_data))
        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 device::mojom::blink {




}  // device::mojom::blink


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