// services/viz/public/mojom/compositing/view_transition_request.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 "services/viz/public/mojom/compositing/view_transition_request.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 "services/viz/public/mojom/compositing/view_transition_request.mojom-params-data.h"
#include "services/viz/public/mojom/compositing/view_transition_request.mojom-shared-message-ids.h"

#include "services/viz/public/mojom/compositing/view_transition_request.mojom-import-headers.h"
#include "services/viz/public/mojom/compositing/view_transition_request.mojom-test-utils.h"


namespace viz::mojom {
ViewTransitionRequest::ViewTransitionRequest()
    : type(),
      transition_token(),
      maybe_cross_frame_sink(),
      sequence_id(),
      capture_resource_ids() {}

ViewTransitionRequest::ViewTransitionRequest(
    ::viz::mojom::CompositorFrameTransitionDirectiveType type_in,
    const ::blink::ViewTransitionToken& transition_token_in,
    bool maybe_cross_frame_sink_in,
    uint32_t sequence_id_in,
    std::vector<::viz::ViewTransitionElementResourceId> capture_resource_ids_in)
    : type(std::move(type_in)),
      transition_token(std::move(transition_token_in)),
      maybe_cross_frame_sink(std::move(maybe_cross_frame_sink_in)),
      sequence_id(std::move(sequence_id_in)),
      capture_resource_ids(std::move(capture_resource_ids_in)) {}

ViewTransitionRequest::~ViewTransitionRequest() = default;

void ViewTransitionRequest::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 ::viz::mojom::CompositorFrameTransitionDirectiveType>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "transition_token"), this->transition_token,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::blink::ViewTransitionToken&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "maybe_cross_frame_sink"), this->maybe_cross_frame_sink,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "sequence_id"), this->sequence_id,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type uint32_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "capture_resource_ids"), this->capture_resource_ids,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const std::vector<::viz::ViewTransitionElementResourceId>&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

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


}  // viz::mojom


namespace mojo {


// static
bool StructTraits<::viz::mojom::ViewTransitionRequest::DataView, ::viz::mojom::ViewTransitionRequestPtr>::Read(
    ::viz::mojom::ViewTransitionRequest::DataView input,
    ::viz::mojom::ViewTransitionRequestPtr* output) {
  bool success = true;
  ::viz::mojom::ViewTransitionRequestPtr result(::viz::mojom::ViewTransitionRequest::New());
  
      if (success && !input.ReadType(&result->type))
        success = false;
      if (success && !input.ReadTransitionToken(&result->transition_token))
        success = false;
      if (success)
        result->maybe_cross_frame_sink = input.maybe_cross_frame_sink();
      if (success)
        result->sequence_id = input.sequence_id();
      if (success && !input.ReadCaptureResourceIds(&result->capture_resource_ids))
        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 viz::mojom {




}  // viz::mojom


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