// 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. All rights reserved.
// 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 <math.h>
#include <stdint.h>
#include <utility>

#include "base/hash/md5_constexpr.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/common/task_annotator.h"
#include "base/trace_event/trace_conversion_helper.h"
#include "base/trace_event/traced_value.h"
#include "mojo/public/cpp/bindings/lib/generated_code_util.h"
#include "mojo/public/cpp/bindings/lib/message_internal.h"
#include "mojo/public/cpp/bindings/lib/serialization_util.h"
#include "mojo/public/cpp/bindings/lib/unserialized_message_context.h"
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_context.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/interfaces/bindings/interface_control_messages.mojom.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 "mojo/public/cpp/bindings/lib/wtf_serialization.h"


#ifndef THIRD_PARTY_BLINK_PUBLIC_MOJOM_MESSAGING_CLONEABLE_MESSAGE_MOJOM_BLINK_JUMBO_H_
#define THIRD_PARTY_BLINK_PUBLIC_MOJOM_MESSAGING_CLONEABLE_MESSAGE_MOJOM_BLINK_JUMBO_H_
#endif
namespace blink {
namespace mojom {
namespace 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(),
      locked_agent_cluster_id(),
      native_file_system_tokens() {}

CloneableMessage::CloneableMessage(
    ::mojo_base::BigBuffer encoded_message_in,
    WTF::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::Optional<::base::UnguessableToken>& locked_agent_cluster_id_in,
    WTF::Vector<::mojo::PendingRemote<::blink::mojom::blink::NativeFileSystemTransferToken>> native_file_system_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)),
      locked_agent_cluster_id(std::move(locked_agent_cluster_id_in)),
      native_file_system_tokens(std::move(native_file_system_tokens_in)) {}

CloneableMessage::~CloneableMessage() = default;

void CloneableMessage::AsValueInto(base::trace_event::TracedValue* value) const {
  value->SetString("encoded_message", base::trace_event::ValueToString(this->encoded_message, "<value of type ::mojo_base::BigBuffer>"));
  value->BeginArray("blobs");
  for (const auto& item0 : this->blobs) {
    value->AppendString(base::trace_event::ValueToString(item0, "<value of type const ::scoped_refptr<::blink::BlobDataHandle>&>"));
  }
  value->EndArray();
  value->SetString("sender_origin", base::trace_event::ValueToString(this->sender_origin, "<value of type const ::scoped_refptr<const ::blink::SecurityOrigin>&>"));
  value->SetString("stack_trace_id", base::NumberToString(this->stack_trace_id));
  value->SetString("stack_trace_debugger_id_first", base::NumberToString(this->stack_trace_debugger_id_first));
  value->SetString("stack_trace_debugger_id_second", base::NumberToString(this->stack_trace_debugger_id_second));
  value->SetBoolean("stack_trace_should_pause", this->stack_trace_should_pause);
  value->SetString("locked_agent_cluster_id", base::trace_event::ValueToString(this->locked_agent_cluster_id, "<value of type const base::Optional<::base::UnguessableToken>&>"));
  value->BeginArray("native_file_system_tokens");
  for (const auto& item0 : this->native_file_system_tokens) {
    value->AppendBoolean(item0.is_valid());
  }
  value->EndArray();
}

bool CloneableMessage::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  return Data_::Validate(data, validation_context);
}
}  // namespace blink
}  // namespace mojom
}  // namespace 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.ReadLockedAgentClusterId(&result->locked_agent_cluster_id))
        success = false;
      if (success && !input.ReadNativeFileSystemTokens(&result->native_file_system_tokens))
        success = false;
  *output = std::move(result);
  return success;
}

}  // namespace mojo

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