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

#include "cc/mojom/layer_selection_bound.mojom-import-headers.h"
#include "cc/mojom/layer_selection_bound.mojom-test-utils.h"


namespace cc::mojom {
LayerSelectionBound::LayerSelectionBound()
    : type(),
      edge_start(),
      edge_end(),
      layer_id(),
      hidden() {}

LayerSelectionBound::LayerSelectionBound(
    ::gfx::SelectionBound::Type type_in,
    const ::gfx::Point& edge_start_in,
    const ::gfx::Point& edge_end_in,
    int32_t layer_id_in,
    bool hidden_in)
    : type(std::move(type_in)),
      edge_start(std::move(edge_start_in)),
      edge_end(std::move(edge_end_in)),
      layer_id(std::move(layer_id_in)),
      hidden(std::move(hidden_in)) {}

LayerSelectionBound::~LayerSelectionBound() = default;

void LayerSelectionBound::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "type"), this->type,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::gfx::SelectionBound::Type>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "edge_start"), this->edge_start,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::Point&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "edge_end"), this->edge_end,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::Point&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "layer_id"), this->layer_id,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type int32_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "hidden"), this->hidden,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

bool LayerSelectionBound::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  return Data_::Validate(data, validation_context);
}
LayerSelection::LayerSelection()
    : start(),
      end() {}

LayerSelection::LayerSelection(
    const ::cc::LayerSelectionBound& start_in,
    const ::cc::LayerSelectionBound& end_in)
    : start(std::move(start_in)),
      end(std::move(end_in)) {}

LayerSelection::~LayerSelection() = default;

void LayerSelection::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "start"), this->start,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::cc::LayerSelectionBound&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "end"), this->end,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::cc::LayerSelectionBound&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

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


}  // cc::mojom


namespace mojo {


// static
bool StructTraits<::cc::mojom::LayerSelectionBound::DataView, ::cc::mojom::LayerSelectionBoundPtr>::Read(
    ::cc::mojom::LayerSelectionBound::DataView input,
    ::cc::mojom::LayerSelectionBoundPtr* output) {
  bool success = true;
  ::cc::mojom::LayerSelectionBoundPtr result(::cc::mojom::LayerSelectionBound::New());
  
      if (success && !input.ReadType(&result->type))
        success = false;
      if (success && !input.ReadEdgeStart(&result->edge_start))
        success = false;
      if (success && !input.ReadEdgeEnd(&result->edge_end))
        success = false;
      if (success)
        result->layer_id = input.layer_id();
      if (success)
        result->hidden = input.hidden();
  *output = std::move(result);
  return success;
}


// static
bool StructTraits<::cc::mojom::LayerSelection::DataView, ::cc::mojom::LayerSelectionPtr>::Read(
    ::cc::mojom::LayerSelection::DataView input,
    ::cc::mojom::LayerSelectionPtr* output) {
  bool success = true;
  ::cc::mojom::LayerSelectionPtr result(::cc::mojom::LayerSelection::New());
  
      if (success && !input.ReadStart(&result->start))
        success = false;
      if (success && !input.ReadEnd(&result->end))
        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 cc::mojom {




}  // cc::mojom


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