// ui/gfx/mojom/delegated_ink_metadata.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 "ui/gfx/mojom/delegated_ink_metadata.mojom.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 "ui/gfx/mojom/delegated_ink_metadata.mojom-params-data.h"
#include "ui/gfx/mojom/delegated_ink_metadata.mojom-shared-message-ids.h"

#include "ui/gfx/mojom/delegated_ink_metadata.mojom-import-headers.h"
#include "ui/gfx/mojom/delegated_ink_metadata.mojom-test-utils.h"


namespace gfx::mojom {
DelegatedInkMetadata::DelegatedInkMetadata()
    : point(),
      diameter(),
      color(),
      timestamp(),
      presentation_area(),
      frame_time(),
      is_hovering() {}

DelegatedInkMetadata::DelegatedInkMetadata(
    const ::gfx::PointF& point_in,
    double diameter_in,
    ::SkColor color_in,
    ::base::TimeTicks timestamp_in,
    const ::gfx::RectF& presentation_area_in,
    ::base::TimeTicks frame_time_in,
    bool is_hovering_in)
    : point(std::move(point_in)),
      diameter(std::move(diameter_in)),
      color(std::move(color_in)),
      timestamp(std::move(timestamp_in)),
      presentation_area(std::move(presentation_area_in)),
      frame_time(std::move(frame_time_in)),
      is_hovering(std::move(is_hovering_in)) {}

DelegatedInkMetadata::~DelegatedInkMetadata() = default;

void DelegatedInkMetadata::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "point"), this->point,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::PointF&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "diameter"), this->diameter,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type double>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "color"), this->color,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::SkColor>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "timestamp"), this->timestamp,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::base::TimeTicks>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "presentation_area"), this->presentation_area,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::RectF&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "frame_time"), this->frame_time,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::base::TimeTicks>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "is_hovering"), this->is_hovering,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

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


}  // gfx::mojom


namespace mojo {


// static
bool StructTraits<::gfx::mojom::DelegatedInkMetadata::DataView, ::gfx::mojom::DelegatedInkMetadataPtr>::Read(
    ::gfx::mojom::DelegatedInkMetadata::DataView input,
    ::gfx::mojom::DelegatedInkMetadataPtr* output) {
  bool success = true;
  ::gfx::mojom::DelegatedInkMetadataPtr result(::gfx::mojom::DelegatedInkMetadata::New());
  
      if (success && !input.ReadPoint(&result->point))
        success = false;
      if (success)
        result->diameter = input.diameter();
      if (success && !input.ReadColor(&result->color))
        success = false;
      if (success && !input.ReadTimestamp(&result->timestamp))
        success = false;
      if (success && !input.ReadPresentationArea(&result->presentation_area))
        success = false;
      if (success && !input.ReadFrameTime(&result->frame_time))
        success = false;
      if (success)
        result->is_hovering = input.is_hovering();
  *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 gfx::mojom {




}  // gfx::mojom


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