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

#include "third_party/blink/public/mojom/messaging/cloneable_message.mojom-blink-import-headers.h"
#include "third_party/blink/public/mojom/messaging/cloneable_message.mojom-blink-test-utils.h"
#include "mojo/public/cpp/bindings/lib/wtf_serialization.h"


namespace blink::mojom::blink {
CloneableMessage::CloneableMessage()
    : encoded_message(),
      blobs(),
      sender_origin(),
      stack_trace_id(),
      stack_trace_debugger_id_first(),
      stack_trace_debugger_id_second(),
      stack_trace_should_pause(),
      sender_agent_cluster_id(),
      locked_to_sender_agent_cluster(),
      file_system_access_tokens() {}

CloneableMessage::CloneableMessage(
    ::mojo_base::BigBuffer encoded_message_in,
    ::blink::Vector<::scoped_refptr<::blink::BlobDataHandle>> blobs_in,
    const ::scoped_refptr<const ::blink::SecurityOrigin>& sender_origin_in,
    uint64_t stack_trace_id_in,
    int64_t stack_trace_debugger_id_first_in,
    int64_t stack_trace_debugger_id_second_in,
    bool stack_trace_should_pause_in,
    const ::base::UnguessableToken& sender_agent_cluster_id_in,
    bool locked_to_sender_agent_cluster_in,
    ::blink::Vector<::mojo::PendingRemote<::blink::mojom::blink::FileSystemAccessTransferToken>> file_system_access_tokens_in)
    : encoded_message(std::move(encoded_message_in)),
      blobs(std::move(blobs_in)),
      sender_origin(std::move(sender_origin_in)),
      stack_trace_id(std::move(stack_trace_id_in)),
      stack_trace_debugger_id_first(std::move(stack_trace_debugger_id_first_in)),
      stack_trace_debugger_id_second(std::move(stack_trace_debugger_id_second_in)),
      stack_trace_should_pause(std::move(stack_trace_should_pause_in)),
      sender_agent_cluster_id(std::move(sender_agent_cluster_id_in)),
      locked_to_sender_agent_cluster(std::move(locked_to_sender_agent_cluster_in)),
      file_system_access_tokens(std::move(file_system_access_tokens_in)) {}

CloneableMessage::~CloneableMessage() = default;

void CloneableMessage::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "encoded_message"), this->encoded_message,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::mojo_base::BigBuffer>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "blobs"), this->blobs,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::blink::Vector<::scoped_refptr<::blink::BlobDataHandle>>&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "sender_origin"), this->sender_origin,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::scoped_refptr<const ::blink::SecurityOrigin>&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "stack_trace_id"), this->stack_trace_id,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type uint64_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "stack_trace_debugger_id_first"), this->stack_trace_debugger_id_first,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type int64_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "stack_trace_debugger_id_second"), this->stack_trace_debugger_id_second,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type int64_t>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "stack_trace_should_pause"), this->stack_trace_should_pause,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "sender_agent_cluster_id"), this->sender_agent_cluster_id,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::base::UnguessableToken&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "locked_to_sender_agent_cluster"), this->locked_to_sender_agent_cluster,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "file_system_access_tokens"), this->file_system_access_tokens,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::blink::Vector<::mojo::PendingRemote<::blink::mojom::blink::FileSystemAccessTransferToken>>>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

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


}  // blink::mojom::blink


namespace mojo {


// static
bool StructTraits<::blink::mojom::blink::CloneableMessage::DataView, ::blink::mojom::blink::CloneableMessagePtr>::Read(
    ::blink::mojom::blink::CloneableMessage::DataView input,
    ::blink::mojom::blink::CloneableMessagePtr* output) {
  bool success = true;
  ::blink::mojom::blink::CloneableMessagePtr result(::blink::mojom::blink::CloneableMessage::New());
  
      if (success && !input.ReadEncodedMessage(&result->encoded_message))
        success = false;
      if (success && !input.ReadBlobs(&result->blobs))
        success = false;
      if (success && !input.ReadSenderOrigin(&result->sender_origin))
        success = false;
      if (success)
        result->stack_trace_id = input.stack_trace_id();
      if (success)
        result->stack_trace_debugger_id_first = input.stack_trace_debugger_id_first();
      if (success)
        result->stack_trace_debugger_id_second = input.stack_trace_debugger_id_second();
      if (success)
        result->stack_trace_should_pause = input.stack_trace_should_pause();
      if (success && !input.ReadSenderAgentClusterId(&result->sender_agent_cluster_id))
        success = false;
      if (success)
        result->locked_to_sender_agent_cluster = input.locked_to_sender_agent_cluster();
      if (success && !input.ReadFileSystemAccessTokens(&result->file_system_access_tokens))
        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 blink::mojom::blink {




}  // blink::mojom::blink


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