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

#include "services/viz/public/mojom/compositing/blit_request.mojom-blink-import-headers.h"
#include "services/viz/public/mojom/compositing/blit_request.mojom-blink-test-utils.h"
#include "mojo/public/cpp/bindings/lib/wtf_serialization.h"


namespace viz::mojom::blink {
BlitRequest::BlitRequest()
    : destination_region_offset(),
      letterboxing_behavior(),
      shared_image(),
      sync_token(),
      populates_mappable_shared_image() {}

BlitRequest::BlitRequest(
    const ::gfx::Point& destination_region_offset_in,
    LetterboxingBehavior letterboxing_behavior_in,
    ::gpu::ExportedSharedImage shared_image_in,
    const ::gpu::SyncToken& sync_token_in,
    bool populates_mappable_shared_image_in)
    : destination_region_offset(std::move(destination_region_offset_in)),
      letterboxing_behavior(std::move(letterboxing_behavior_in)),
      shared_image(std::move(shared_image_in)),
      sync_token(std::move(sync_token_in)),
      populates_mappable_shared_image(std::move(populates_mappable_shared_image_in)) {}

BlitRequest::~BlitRequest() = default;

void BlitRequest::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "destination_region_offset"), this->destination_region_offset,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gfx::Point&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "letterboxing_behavior"), this->letterboxing_behavior,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type LetterboxingBehavior>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "shared_image"), this->shared_image,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::gpu::ExportedSharedImage>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "sync_token"), this->sync_token,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::gpu::SyncToken&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "populates_mappable_shared_image"), this->populates_mappable_shared_image,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

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


}  // viz::mojom::blink


namespace mojo {


// static
bool StructTraits<::viz::mojom::blink::BlitRequest::DataView, ::viz::mojom::blink::BlitRequestPtr>::Read(
    ::viz::mojom::blink::BlitRequest::DataView input,
    ::viz::mojom::blink::BlitRequestPtr* output) {
  bool success = true;
  ::viz::mojom::blink::BlitRequestPtr result(::viz::mojom::blink::BlitRequest::New());
  
      if (success && !input.ReadDestinationRegionOffset(&result->destination_region_offset))
        success = false;
      if (success && !input.ReadLetterboxingBehavior(&result->letterboxing_behavior))
        success = false;
      if (success && !input.ReadSharedImage(&result->shared_image))
        success = false;
      if (success && !input.ReadSyncToken(&result->sync_token))
        success = false;
      if (success)
        result->populates_mappable_shared_image = input.populates_mappable_shared_image();
  *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::blink {




}  // viz::mojom::blink


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