// third_party/blink/public/mojom/frame/intrinsic_sizing_info.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 "third_party/blink/public/mojom/frame/intrinsic_sizing_info.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 "third_party/blink/public/mojom/frame/intrinsic_sizing_info.mojom-params-data.h"
#include "third_party/blink/public/mojom/frame/intrinsic_sizing_info.mojom-shared-message-ids.h"

#include "third_party/blink/public/mojom/frame/intrinsic_sizing_info.mojom-import-headers.h"
#include "third_party/blink/public/mojom/frame/intrinsic_sizing_info.mojom-test-utils.h"


namespace blink::mojom {
IntrinsicSizingInfo::IntrinsicSizingInfo()
    : size(),
      aspect_ratio(),
      has_width(),
      has_height(),
      is_cleared(false) {}

IntrinsicSizingInfo::IntrinsicSizingInfo(
    const ::gfx::SizeF& size_in,
    const ::gfx::SizeF& aspect_ratio_in,
    bool has_width_in,
    bool has_height_in,
    bool is_cleared_in)
    : size(std::move(size_in)),
      aspect_ratio(std::move(aspect_ratio_in)),
      has_width(std::move(has_width_in)),
      has_height(std::move(has_height_in)),
      is_cleared(std::move(is_cleared_in)) {}

IntrinsicSizingInfo::~IntrinsicSizingInfo() = default;

void IntrinsicSizingInfo::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "size"), this->size,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::SizeF&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "aspect_ratio"), this->aspect_ratio,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::SizeF&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "has_width"), this->has_width,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "has_height"), this->has_height,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "is_cleared"), this->is_cleared,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

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


}  // blink::mojom


namespace mojo {


// static
bool StructTraits<::blink::mojom::IntrinsicSizingInfo::DataView, ::blink::mojom::IntrinsicSizingInfoPtr>::Read(
    ::blink::mojom::IntrinsicSizingInfo::DataView input,
    ::blink::mojom::IntrinsicSizingInfoPtr* output) {
  bool success = true;
  ::blink::mojom::IntrinsicSizingInfoPtr result(::blink::mojom::IntrinsicSizingInfo::New());
  
      if (success && !input.ReadSize(&result->size))
        success = false;
      if (success && !input.ReadAspectRatio(&result->aspect_ratio))
        success = false;
      if (success)
        result->has_width = input.has_width();
      if (success)
        result->has_height = input.has_height();
      if (success)
        result->is_cleared = input.is_cleared();
  *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 blink::mojom {




}  // blink::mojom


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