// third_party/blink/public/mojom/remote_objects/remote_objects.mojom-blink.h 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.

#ifndef THIRD_PARTY_BLINK_PUBLIC_MOJOM_REMOTE_OBJECTS_REMOTE_OBJECTS_MOJOM_BLINK_H_
#define THIRD_PARTY_BLINK_PUBLIC_MOJOM_REMOTE_OBJECTS_REMOTE_OBJECTS_MOJOM_BLINK_H_

#include <stdint.h>

#include <limits>
#include <optional>
#include <type_traits>
#include <utility>
#include "mojo/public/cpp/bindings/clone_traits.h"
#include "mojo/public/cpp/bindings/equals_traits.h"
#include "mojo/public/cpp/bindings/struct_ptr.h"
#include "mojo/public/cpp/bindings/struct_traits.h"
#include "mojo/public/cpp/bindings/union_traits.h"
#include "mojo/public/cpp/bindings/lib/serialization.h"

#include "third_party/perfetto/include/perfetto/tracing/traced_value_forward.h"

#include "third_party/blink/public/mojom/remote_objects/remote_objects.mojom-features.h"  // IWYU pragma: export
#include "third_party/blink/public/mojom/remote_objects/remote_objects.mojom-shared.h"  // IWYU pragma: export
#include "third_party/blink/public/mojom/remote_objects/remote_objects.mojom-blink-forward.h"  // IWYU pragma: export
#include "mojo/public/mojom/base/big_buffer.mojom-blink.h"
#include "mojo/public/mojom/base/string16.mojom-blink.h"

#include "mojo/public/cpp/bindings/lib/wtf_clone_equals_util.h"
#include "mojo/public/cpp/bindings/lib/wtf_hash_util.h"
#include "third_party/blink/renderer/platform/wtf/hash_functions.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"

#include "mojo/public/cpp/bindings/lib/control_message_handler.h"
#include "mojo/public/cpp/bindings/raw_ptr_impl_ref_traits.h"


#include "third_party/blink/renderer/platform/platform_export.h"
#if !BLINK_MOJO_IMPL && !INSIDE_BLINK
#error "File must only be imported inside blink"
#endif




namespace blink::mojom::blink {

class RemoteObjectHostProxy;

template <typename ImplRefTraits>
class RemoteObjectHostStub;

class RemoteObjectHostRequestValidator;


class PLATFORM_EXPORT RemoteObjectHost
    : public RemoteObjectHostInterfaceBase {
 public:
  using IPCStableHashFunction = uint32_t(*)();
  static constexpr const char* Name_ = "blink.mojom.RemoteObjectHost";
  static IPCStableHashFunction MessageToMethodInfo_(mojo::Message& message);
  static const char* MessageToMethodName_(mojo::Message& message);
  static constexpr uint32_t Version_ = 0;
  static constexpr bool PassesAssociatedKinds_ = false;
  static constexpr bool HasUninterruptableMethods_ = false;

  using Base_ = RemoteObjectHostInterfaceBase;
  using Proxy_ = RemoteObjectHostProxy;

  template <typename ImplRefTraits>
  using Stub_ = RemoteObjectHostStub<ImplRefTraits>;

  using RequestValidator_ = RemoteObjectHostRequestValidator;
  using ResponseValidator_ = mojo::PassThroughFilter;
  enum MethodMinVersions : uint32_t {
    kGetObjectMinVersion = 0,
    kAcquireObjectMinVersion = 0,
    kReleaseObjectMinVersion = 0,
  };

// crbug.com/1340245 - this causes binary size bloat on Fuchsia, and we're OK
// with not having this data in traces there.
#if !BUILDFLAG(IS_FUCHSIA)
  struct GetObject_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct AcquireObject_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct ReleaseObject_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
#endif // !BUILDFLAG(IS_FUCHSIA)
  virtual ~RemoteObjectHost() = default;

  virtual void GetObject(int32_t object_id, ::mojo::PendingReceiver<RemoteObject> receiver) = 0;

  virtual void AcquireObject(int32_t object_id) = 0;

  virtual void ReleaseObject(int32_t object_id) = 0;
};

class RemoteObjectProxy;

template <typename ImplRefTraits>
class RemoteObjectStub;

class RemoteObjectRequestValidator;
class RemoteObjectResponseValidator;


class PLATFORM_EXPORT RemoteObject
    : public RemoteObjectInterfaceBase {
 public:
  using IPCStableHashFunction = uint32_t(*)();
  static constexpr const char* Name_ = "blink.mojom.RemoteObject";
  static IPCStableHashFunction MessageToMethodInfo_(mojo::Message& message);
  static const char* MessageToMethodName_(mojo::Message& message);
  static constexpr uint32_t Version_ = 0;
  static constexpr bool PassesAssociatedKinds_ = false;
  static inline constexpr uint32_t kSyncMethodOrdinals[] = {
    0, 
    1, 
    2
  };
  static constexpr bool HasUninterruptableMethods_ = false;

  using Base_ = RemoteObjectInterfaceBase;
  using Proxy_ = RemoteObjectProxy;

  template <typename ImplRefTraits>
  using Stub_ = RemoteObjectStub<ImplRefTraits>;

  using RequestValidator_ = RemoteObjectRequestValidator;
  using ResponseValidator_ = RemoteObjectResponseValidator;
  enum MethodMinVersions : uint32_t {
    kHasMethodMinVersion = 0,
    kGetMethodsMinVersion = 0,
    kInvokeMethodMinVersion = 0,
    kNotifyReleasedObjectMinVersion = 0,
  };

// crbug.com/1340245 - this causes binary size bloat on Fuchsia, and we're OK
// with not having this data in traces there.
#if !BUILDFLAG(IS_FUCHSIA)
  struct HasMethod_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct GetMethods_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct InvokeMethod_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct NotifyReleasedObject_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
#endif // !BUILDFLAG(IS_FUCHSIA)
  virtual ~RemoteObject() = default;

  // Sync method. This signature is used by the client side; the service side
  // should implement the signature with callback below.
  
  virtual bool HasMethod(const ::blink::String& name, bool* out_method_exists);
  using HasMethodCallback = base::OnceCallback<void(bool)>;
  using HasMethodMojoCallback = base::OnceCallback<void(bool)>;

  virtual void HasMethod(const ::blink::String& name, HasMethodCallback callback) = 0;

  // Sync method. This signature is used by the client side; the service side
  // should implement the signature with callback below.
  
  virtual bool GetMethods(::blink::Vector<::blink::String>* out_method_names);
  using GetMethodsCallback = base::OnceCallback<void(const ::blink::Vector<::blink::String>&)>;
  using GetMethodsMojoCallback = base::OnceCallback<void(const ::blink::Vector<::blink::String>&)>;

  virtual void GetMethods(GetMethodsCallback callback) = 0;

  // Sync method. This signature is used by the client side; the service side
  // should implement the signature with callback below.
  
  virtual bool InvokeMethod(const ::blink::String& name, ::blink::Vector<RemoteInvocationArgumentPtr> arguments, RemoteInvocationResultPtr* out_result);
  using InvokeMethodCallback = base::OnceCallback<void(RemoteInvocationResultPtr)>;
  using InvokeMethodMojoCallback = base::OnceCallback<void(RemoteInvocationResultPtr)>;

  virtual void InvokeMethod(const ::blink::String& name, ::blink::Vector<RemoteInvocationArgumentPtr> arguments, InvokeMethodCallback callback) = 0;

  virtual void NotifyReleasedObject() = 0;
};

class RemoteObjectGatewayFactoryProxy;

template <typename ImplRefTraits>
class RemoteObjectGatewayFactoryStub;

class RemoteObjectGatewayFactoryRequestValidator;


class PLATFORM_EXPORT RemoteObjectGatewayFactory
    : public RemoteObjectGatewayFactoryInterfaceBase {
 public:
  using IPCStableHashFunction = uint32_t(*)();
  static constexpr const char* Name_ = "blink.mojom.RemoteObjectGatewayFactory";
  static IPCStableHashFunction MessageToMethodInfo_(mojo::Message& message);
  static const char* MessageToMethodName_(mojo::Message& message);
  static constexpr uint32_t Version_ = 0;
  static constexpr bool PassesAssociatedKinds_ = false;
  static constexpr bool HasUninterruptableMethods_ = false;

  using Base_ = RemoteObjectGatewayFactoryInterfaceBase;
  using Proxy_ = RemoteObjectGatewayFactoryProxy;

  template <typename ImplRefTraits>
  using Stub_ = RemoteObjectGatewayFactoryStub<ImplRefTraits>;

  using RequestValidator_ = RemoteObjectGatewayFactoryRequestValidator;
  using ResponseValidator_ = mojo::PassThroughFilter;
  enum MethodMinVersions : uint32_t {
    kCreateRemoteObjectGatewayMinVersion = 0,
  };

// crbug.com/1340245 - this causes binary size bloat on Fuchsia, and we're OK
// with not having this data in traces there.
#if !BUILDFLAG(IS_FUCHSIA)
  struct CreateRemoteObjectGateway_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
#endif // !BUILDFLAG(IS_FUCHSIA)
  virtual ~RemoteObjectGatewayFactory() = default;

  virtual void CreateRemoteObjectGateway(::mojo::PendingRemote<RemoteObjectHost> host, ::mojo::PendingReceiver<RemoteObjectGateway> gateway) = 0;
};

class RemoteObjectGatewayProxy;

template <typename ImplRefTraits>
class RemoteObjectGatewayStub;

class RemoteObjectGatewayRequestValidator;


class PLATFORM_EXPORT RemoteObjectGateway
    : public RemoteObjectGatewayInterfaceBase {
 public:
  using IPCStableHashFunction = uint32_t(*)();
  static constexpr const char* Name_ = "blink.mojom.RemoteObjectGateway";
  static IPCStableHashFunction MessageToMethodInfo_(mojo::Message& message);
  static const char* MessageToMethodName_(mojo::Message& message);
  static constexpr uint32_t Version_ = 0;
  static constexpr bool PassesAssociatedKinds_ = false;
  static constexpr bool HasUninterruptableMethods_ = false;

  using Base_ = RemoteObjectGatewayInterfaceBase;
  using Proxy_ = RemoteObjectGatewayProxy;

  template <typename ImplRefTraits>
  using Stub_ = RemoteObjectGatewayStub<ImplRefTraits>;

  using RequestValidator_ = RemoteObjectGatewayRequestValidator;
  using ResponseValidator_ = mojo::PassThroughFilter;
  enum MethodMinVersions : uint32_t {
    kAddNamedObjectMinVersion = 0,
    kRemoveNamedObjectMinVersion = 0,
  };

// crbug.com/1340245 - this causes binary size bloat on Fuchsia, and we're OK
// with not having this data in traces there.
#if !BUILDFLAG(IS_FUCHSIA)
  struct AddNamedObject_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct RemoveNamedObject_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
#endif // !BUILDFLAG(IS_FUCHSIA)
  virtual ~RemoteObjectGateway() = default;

  virtual void AddNamedObject(const ::blink::String& name, int32_t object_id) = 0;

  virtual void RemoveNamedObject(const ::blink::String& name) = 0;
};



class PLATFORM_EXPORT RemoteObjectHostProxy
    : public RemoteObjectHost {
 public:
  using InterfaceType = RemoteObjectHost;

  explicit RemoteObjectHostProxy(mojo::MessageReceiverWithResponder* receiver);
  
  void GetObject(int32_t object_id, ::mojo::PendingReceiver<RemoteObject> receiver) final;
  
  void AcquireObject(int32_t object_id) final;
  
  void ReleaseObject(int32_t object_id) final;

 private:
  mojo::MessageReceiverWithResponder* receiver_;
};



class PLATFORM_EXPORT RemoteObjectProxy
    : public RemoteObject {
 public:
  using InterfaceType = RemoteObject;

  explicit RemoteObjectProxy(mojo::MessageReceiverWithResponder* receiver);
  
  bool HasMethod(const ::blink::String& name, bool* out_method_exists) final;
  
  void HasMethod(const ::blink::String& name, HasMethodCallback callback) final;
  
  bool GetMethods(::blink::Vector<::blink::String>* out_method_names) final;
  
  void GetMethods(GetMethodsCallback callback) final;
  
  bool InvokeMethod(const ::blink::String& name, ::blink::Vector<RemoteInvocationArgumentPtr> arguments, RemoteInvocationResultPtr* out_result) final;
  
  void InvokeMethod(const ::blink::String& name, ::blink::Vector<RemoteInvocationArgumentPtr> arguments, InvokeMethodCallback callback) final;
  
  void NotifyReleasedObject() final;

 private:
  mojo::MessageReceiverWithResponder* receiver_;
};



class PLATFORM_EXPORT RemoteObjectGatewayFactoryProxy
    : public RemoteObjectGatewayFactory {
 public:
  using InterfaceType = RemoteObjectGatewayFactory;

  explicit RemoteObjectGatewayFactoryProxy(mojo::MessageReceiverWithResponder* receiver);
  
  void CreateRemoteObjectGateway(::mojo::PendingRemote<RemoteObjectHost> host, ::mojo::PendingReceiver<RemoteObjectGateway> gateway) final;

 private:
  mojo::MessageReceiverWithResponder* receiver_;
};



class PLATFORM_EXPORT RemoteObjectGatewayProxy
    : public RemoteObjectGateway {
 public:
  using InterfaceType = RemoteObjectGateway;

  explicit RemoteObjectGatewayProxy(mojo::MessageReceiverWithResponder* receiver);
  
  void AddNamedObject(const ::blink::String& name, int32_t object_id) final;
  
  void RemoveNamedObject(const ::blink::String& name) final;

 private:
  mojo::MessageReceiverWithResponder* receiver_;
};
class PLATFORM_EXPORT RemoteObjectHostStubDispatch {
 public:
  static bool Accept(RemoteObjectHost* impl, mojo::Message* message);
  static bool AcceptWithResponder(
      RemoteObjectHost* impl,
      mojo::Message* message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder);
};

template <typename ImplRefTraits =
              mojo::RawPtrImplRefTraits<RemoteObjectHost>>
class RemoteObjectHostStub
    : public mojo::MessageReceiverWithResponderStatus {
 public:
  using ImplPointerType = typename ImplRefTraits::PointerType;

  RemoteObjectHostStub() = default;
  ~RemoteObjectHostStub() override = default;

  void set_sink(ImplPointerType sink) { sink_ = std::move(sink); }
  ImplPointerType& sink() { return sink_; }

  bool Accept(mojo::Message* message) override {
    if (ImplRefTraits::IsNull(sink_))
      return false;
    return RemoteObjectHostStubDispatch::Accept(
        ImplRefTraits::GetRawPointer(&sink_), message);
  }

  bool AcceptWithResponder(
      mojo::Message* message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder) override {
    if (ImplRefTraits::IsNull(sink_))
      return false;
    return RemoteObjectHostStubDispatch::AcceptWithResponder(
        ImplRefTraits::GetRawPointer(&sink_), message, std::move(responder));
  }

 private:
  ImplPointerType sink_;
};
class PLATFORM_EXPORT RemoteObjectStubDispatch {
 public:
  static bool Accept(RemoteObject* impl, mojo::Message* message);
  static bool AcceptWithResponder(
      RemoteObject* impl,
      mojo::Message* message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder);
};

template <typename ImplRefTraits =
              mojo::RawPtrImplRefTraits<RemoteObject>>
class RemoteObjectStub
    : public mojo::MessageReceiverWithResponderStatus {
 public:
  using ImplPointerType = typename ImplRefTraits::PointerType;

  RemoteObjectStub() = default;
  ~RemoteObjectStub() override = default;

  void set_sink(ImplPointerType sink) { sink_ = std::move(sink); }
  ImplPointerType& sink() { return sink_; }

  bool Accept(mojo::Message* message) override {
    if (ImplRefTraits::IsNull(sink_))
      return false;
    return RemoteObjectStubDispatch::Accept(
        ImplRefTraits::GetRawPointer(&sink_), message);
  }

  bool AcceptWithResponder(
      mojo::Message* message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder) override {
    if (ImplRefTraits::IsNull(sink_))
      return false;
    return RemoteObjectStubDispatch::AcceptWithResponder(
        ImplRefTraits::GetRawPointer(&sink_), message, std::move(responder));
  }

 private:
  ImplPointerType sink_;
};
class PLATFORM_EXPORT RemoteObjectGatewayFactoryStubDispatch {
 public:
  static bool Accept(RemoteObjectGatewayFactory* impl, mojo::Message* message);
  static bool AcceptWithResponder(
      RemoteObjectGatewayFactory* impl,
      mojo::Message* message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder);
};

template <typename ImplRefTraits =
              mojo::RawPtrImplRefTraits<RemoteObjectGatewayFactory>>
class RemoteObjectGatewayFactoryStub
    : public mojo::MessageReceiverWithResponderStatus {
 public:
  using ImplPointerType = typename ImplRefTraits::PointerType;

  RemoteObjectGatewayFactoryStub() = default;
  ~RemoteObjectGatewayFactoryStub() override = default;

  void set_sink(ImplPointerType sink) { sink_ = std::move(sink); }
  ImplPointerType& sink() { return sink_; }

  bool Accept(mojo::Message* message) override {
    if (ImplRefTraits::IsNull(sink_))
      return false;
    return RemoteObjectGatewayFactoryStubDispatch::Accept(
        ImplRefTraits::GetRawPointer(&sink_), message);
  }

  bool AcceptWithResponder(
      mojo::Message* message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder) override {
    if (ImplRefTraits::IsNull(sink_))
      return false;
    return RemoteObjectGatewayFactoryStubDispatch::AcceptWithResponder(
        ImplRefTraits::GetRawPointer(&sink_), message, std::move(responder));
  }

 private:
  ImplPointerType sink_;
};
class PLATFORM_EXPORT RemoteObjectGatewayStubDispatch {
 public:
  static bool Accept(RemoteObjectGateway* impl, mojo::Message* message);
  static bool AcceptWithResponder(
      RemoteObjectGateway* impl,
      mojo::Message* message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder);
};

template <typename ImplRefTraits =
              mojo::RawPtrImplRefTraits<RemoteObjectGateway>>
class RemoteObjectGatewayStub
    : public mojo::MessageReceiverWithResponderStatus {
 public:
  using ImplPointerType = typename ImplRefTraits::PointerType;

  RemoteObjectGatewayStub() = default;
  ~RemoteObjectGatewayStub() override = default;

  void set_sink(ImplPointerType sink) { sink_ = std::move(sink); }
  ImplPointerType& sink() { return sink_; }

  bool Accept(mojo::Message* message) override {
    if (ImplRefTraits::IsNull(sink_))
      return false;
    return RemoteObjectGatewayStubDispatch::Accept(
        ImplRefTraits::GetRawPointer(&sink_), message);
  }

  bool AcceptWithResponder(
      mojo::Message* message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder) override {
    if (ImplRefTraits::IsNull(sink_))
      return false;
    return RemoteObjectGatewayStubDispatch::AcceptWithResponder(
        ImplRefTraits::GetRawPointer(&sink_), message, std::move(responder));
  }

 private:
  ImplPointerType sink_;
};
class PLATFORM_EXPORT RemoteObjectHostRequestValidator : public mojo::MessageReceiver {
 public:
  bool Accept(mojo::Message* message) override;
};
class PLATFORM_EXPORT RemoteObjectRequestValidator : public mojo::MessageReceiver {
 public:
  bool Accept(mojo::Message* message) override;
};
class PLATFORM_EXPORT RemoteObjectGatewayFactoryRequestValidator : public mojo::MessageReceiver {
 public:
  bool Accept(mojo::Message* message) override;
};
class PLATFORM_EXPORT RemoteObjectGatewayRequestValidator : public mojo::MessageReceiver {
 public:
  bool Accept(mojo::Message* message) override;
};
class PLATFORM_EXPORT RemoteObjectResponseValidator : public mojo::MessageReceiver {
 public:
  bool Accept(mojo::Message* message) override;
};







class PLATFORM_EXPORT RemoteInvocationArgument {
 public:
  using DataView = RemoteInvocationArgumentDataView;
  using Data_ = internal::RemoteInvocationArgument_Data;
  using Tag = Data_::RemoteInvocationArgument_Tag;

  template <typename... Args>
  static RemoteInvocationArgumentPtr New(Args&&... args) {
    static_assert(
        sizeof...(args) < 0,
        "Do not use Union::New(); to create a union of a given subtype, use "
        "New<SubType>(), not New() followed by set_<sub_type>(). To represent "
        "an empty union, mark the field or parameter as nullable in the mojom "
        "definition.");
    return nullptr;
  }

  // Construct an instance holding |number_value|.
  static RemoteInvocationArgumentPtr NewNumberValue(
      double value);
  // Construct an instance holding |boolean_value|.
  static RemoteInvocationArgumentPtr NewBooleanValue(
      bool value);
  // Construct an instance holding |string_value|.
  static RemoteInvocationArgumentPtr NewStringValue(
      const ::blink::String& value);
  // Construct an instance holding |singleton_value|.
  static RemoteInvocationArgumentPtr NewSingletonValue(
      SingletonJavaScriptValue value);
  // Construct an instance holding |array_value|.
  static RemoteInvocationArgumentPtr NewArrayValue(
      ::blink::Vector<RemoteInvocationArgumentPtr> value);
  // Construct an instance holding |typed_array_value|.
  static RemoteInvocationArgumentPtr NewTypedArrayValue(
      RemoteTypedArrayPtr value);
  // Construct an instance holding |object_id_value|.
  static RemoteInvocationArgumentPtr NewObjectIdValue(
      int32_t value);

  template <typename U>
  static RemoteInvocationArgumentPtr From(const U& u) {
    return mojo::TypeConverter<RemoteInvocationArgumentPtr, U>::Convert(u);
  }

  template <typename U>
  U To() const {
    return mojo::TypeConverter<U, RemoteInvocationArgument>::Convert(*this);
  }
  ~RemoteInvocationArgument();

  // Delete the copy constructor and copy assignment operators because `data_`
  // contains raw pointers that must not be copied.
  RemoteInvocationArgument(const RemoteInvocationArgument& other) = delete;
  RemoteInvocationArgument& operator=(const RemoteInvocationArgument& other) = delete;

  // Clone() is a template so it is only instantiated if it is used. Thus, the
  // bindings generator does not need to know whether Clone() or copy
  // constructor/assignment are available for members.
  template <typename UnionPtrType = RemoteInvocationArgumentPtr>
  RemoteInvocationArgumentPtr Clone() const;

  // Equals() is a template so it is only instantiated if it is used. Thus, the
  // bindings generator does not need to know whether Equals() or == operator
  // are available for members.
  template <typename T,
            typename std::enable_if<std::is_same<
                T, RemoteInvocationArgument>::value>::type* = nullptr>
  bool Equals(const T& other) const;

  template <typename T,
            typename std::enable_if<std::is_same<
                T, RemoteInvocationArgument>::value>::type* = nullptr>
  bool operator==(const T& rhs) const { return Equals(rhs); }

  Tag which() const {
    return tag_;
  }

  bool is_number_value() const { return tag_ == Tag::kNumberValue; }
  double get_number_value() const {
    CHECK(tag_ == Tag::kNumberValue);
    return data_.number_value;
  }
  void set_number_value(double number_value);

  bool is_boolean_value() const { return tag_ == Tag::kBooleanValue; }
  bool get_boolean_value() const {
    CHECK(tag_ == Tag::kBooleanValue);
    return data_.boolean_value;
  }
  void set_boolean_value(bool boolean_value);

  bool is_string_value() const { return tag_ == Tag::kStringValue; }
  const ::blink::String& get_string_value() const {
    CHECK(tag_ == Tag::kStringValue);
    return data_.string_value;
  }
  ::blink::String& get_string_value() {
    CHECK(tag_ == Tag::kStringValue);
    return data_.string_value;
  }
  void set_string_value(const ::blink::String& string_value);

  bool is_singleton_value() const { return tag_ == Tag::kSingletonValue; }
  SingletonJavaScriptValue get_singleton_value() const {
    CHECK(tag_ == Tag::kSingletonValue);
    return data_.singleton_value;
  }
  void set_singleton_value(SingletonJavaScriptValue singleton_value);

  bool is_array_value() const { return tag_ == Tag::kArrayValue; }
  const ::blink::Vector<RemoteInvocationArgumentPtr>& get_array_value() const {
    CHECK(tag_ == Tag::kArrayValue);
    return data_.array_value;
  }
  ::blink::Vector<RemoteInvocationArgumentPtr>& get_array_value() {
    CHECK(tag_ == Tag::kArrayValue);
    return data_.array_value;
  }
  void set_array_value(::blink::Vector<RemoteInvocationArgumentPtr> array_value);

  bool is_typed_array_value() const { return tag_ == Tag::kTypedArrayValue; }
  const RemoteTypedArrayPtr& get_typed_array_value() const {
    CHECK(tag_ == Tag::kTypedArrayValue);
    return data_.typed_array_value;
  }
  RemoteTypedArrayPtr& get_typed_array_value() {
    CHECK(tag_ == Tag::kTypedArrayValue);
    return data_.typed_array_value;
  }
  void set_typed_array_value(RemoteTypedArrayPtr typed_array_value);

  bool is_object_id_value() const { return tag_ == Tag::kObjectIdValue; }
  int32_t get_object_id_value() const {
    CHECK(tag_ == Tag::kObjectIdValue);
    return data_.object_id_value;
  }
  void set_object_id_value(int32_t object_id_value);

  template <typename UserType>
  static mojo::Message SerializeAsMessage(UserType* input) {
    return mojo::internal::SerializeAsMessageImpl<
        RemoteInvocationArgument::DataView>(input);
  }

  template <typename UserType>
  static bool DeserializeFromMessage(mojo::Message input,
                                     UserType* output) {
    return mojo::internal::DeserializeImpl<RemoteInvocationArgument::DataView>(
        input, input.payload(), input.payload_num_bytes(), output, Validate);
  }

 private:
  template <typename T>
  friend class ::mojo::InlinedStructPtr;
  template <typename T>
  friend class ::mojo::StructPtr;

  union Union_ {
    Union_(
        std::in_place_index_t<static_cast<size_t>(Tag::kNumberValue)>,
        double value);
    Union_(
        std::in_place_index_t<static_cast<size_t>(Tag::kBooleanValue)>,
        bool value);
    Union_(
        std::in_place_index_t<static_cast<size_t>(Tag::kStringValue)>,
        const ::blink::String& value);
    Union_(
        std::in_place_index_t<static_cast<size_t>(Tag::kSingletonValue)>,
        SingletonJavaScriptValue value);
    Union_(
        std::in_place_index_t<static_cast<size_t>(Tag::kArrayValue)>,
        ::blink::Vector<RemoteInvocationArgumentPtr> value);
    Union_(
        std::in_place_index_t<static_cast<size_t>(Tag::kTypedArrayValue)>,
        RemoteTypedArrayPtr value);
    Union_(
        std::in_place_index_t<static_cast<size_t>(Tag::kObjectIdValue)>,
        int32_t value);
    // The contents of the union are explicitly destroyed by `DestroyActive()`.
    ~Union_() {}

    double number_value;
    bool boolean_value;
    ::blink::String string_value;
    SingletonJavaScriptValue singleton_value;
    ::blink::Vector<RemoteInvocationArgumentPtr> array_value;
    RemoteTypedArrayPtr typed_array_value;
    int32_t object_id_value;
  };

  RemoteInvocationArgument(
      std::in_place_index_t<static_cast<size_t>(Tag::kNumberValue)>,
      double value);
  RemoteInvocationArgument(
      std::in_place_index_t<static_cast<size_t>(Tag::kBooleanValue)>,
      bool value);
  RemoteInvocationArgument(
      std::in_place_index_t<static_cast<size_t>(Tag::kStringValue)>,
      const ::blink::String& value);
  RemoteInvocationArgument(
      std::in_place_index_t<static_cast<size_t>(Tag::kSingletonValue)>,
      SingletonJavaScriptValue value);
  RemoteInvocationArgument(
      std::in_place_index_t<static_cast<size_t>(Tag::kArrayValue)>,
      ::blink::Vector<RemoteInvocationArgumentPtr> value);
  RemoteInvocationArgument(
      std::in_place_index_t<static_cast<size_t>(Tag::kTypedArrayValue)>,
      RemoteTypedArrayPtr value);
  RemoteInvocationArgument(
      std::in_place_index_t<static_cast<size_t>(Tag::kObjectIdValue)>,
      int32_t value);

  static bool Validate(const void* data,
                       mojo::internal::ValidationContext* validation_context);

  void DestroyActive();
  Tag tag_;
  Union_ data_;
};



class PLATFORM_EXPORT RemoteInvocationResultValue {
 public:
  using DataView = RemoteInvocationResultValueDataView;
  using Data_ = internal::RemoteInvocationResultValue_Data;
  using Tag = Data_::RemoteInvocationResultValue_Tag;

  template <typename... Args>
  static RemoteInvocationResultValuePtr New(Args&&... args) {
    static_assert(
        sizeof...(args) < 0,
        "Do not use Union::New(); to create a union of a given subtype, use "
        "New<SubType>(), not New() followed by set_<sub_type>(). To represent "
        "an empty union, mark the field or parameter as nullable in the mojom "
        "definition.");
    return nullptr;
  }

  // Construct an instance holding |number_value|.
  static RemoteInvocationResultValuePtr NewNumberValue(
      double value);
  // Construct an instance holding |boolean_value|.
  static RemoteInvocationResultValuePtr NewBooleanValue(
      bool value);
  // Construct an instance holding |string_value|.
  static RemoteInvocationResultValuePtr NewStringValue(
      const ::blink::String& value);
  // Construct an instance holding |singleton_value|.
  static RemoteInvocationResultValuePtr NewSingletonValue(
      SingletonJavaScriptValue value);
  // Construct an instance holding |object_id|.
  static RemoteInvocationResultValuePtr NewObjectId(
      int32_t value);

  template <typename U>
  static RemoteInvocationResultValuePtr From(const U& u) {
    return mojo::TypeConverter<RemoteInvocationResultValuePtr, U>::Convert(u);
  }

  template <typename U>
  U To() const {
    return mojo::TypeConverter<U, RemoteInvocationResultValue>::Convert(*this);
  }
  ~RemoteInvocationResultValue();

  // Delete the copy constructor and copy assignment operators because `data_`
  // contains raw pointers that must not be copied.
  RemoteInvocationResultValue(const RemoteInvocationResultValue& other) = delete;
  RemoteInvocationResultValue& operator=(const RemoteInvocationResultValue& other) = delete;

  // Clone() is a template so it is only instantiated if it is used. Thus, the
  // bindings generator does not need to know whether Clone() or copy
  // constructor/assignment are available for members.
  template <typename UnionPtrType = RemoteInvocationResultValuePtr>
  RemoteInvocationResultValuePtr Clone() const;

  // Equals() is a template so it is only instantiated if it is used. Thus, the
  // bindings generator does not need to know whether Equals() or == operator
  // are available for members.
  template <typename T,
            typename std::enable_if<std::is_same<
                T, RemoteInvocationResultValue>::value>::type* = nullptr>
  bool Equals(const T& other) const;

  template <typename T,
            typename std::enable_if<std::is_same<
                T, RemoteInvocationResultValue>::value>::type* = nullptr>
  bool operator==(const T& rhs) const { return Equals(rhs); }

  Tag which() const {
    return tag_;
  }

  bool is_number_value() const { return tag_ == Tag::kNumberValue; }
  double get_number_value() const {
    CHECK(tag_ == Tag::kNumberValue);
    return data_.number_value;
  }
  void set_number_value(double number_value);

  bool is_boolean_value() const { return tag_ == Tag::kBooleanValue; }
  bool get_boolean_value() const {
    CHECK(tag_ == Tag::kBooleanValue);
    return data_.boolean_value;
  }
  void set_boolean_value(bool boolean_value);

  bool is_string_value() const { return tag_ == Tag::kStringValue; }
  const ::blink::String& get_string_value() const {
    CHECK(tag_ == Tag::kStringValue);
    return data_.string_value;
  }
  ::blink::String& get_string_value() {
    CHECK(tag_ == Tag::kStringValue);
    return data_.string_value;
  }
  void set_string_value(const ::blink::String& string_value);

  bool is_singleton_value() const { return tag_ == Tag::kSingletonValue; }
  SingletonJavaScriptValue get_singleton_value() const {
    CHECK(tag_ == Tag::kSingletonValue);
    return data_.singleton_value;
  }
  void set_singleton_value(SingletonJavaScriptValue singleton_value);

  bool is_object_id() const { return tag_ == Tag::kObjectId; }
  int32_t get_object_id() const {
    CHECK(tag_ == Tag::kObjectId);
    return data_.object_id;
  }
  void set_object_id(int32_t object_id);

  template <typename UserType>
  static mojo::Message SerializeAsMessage(UserType* input) {
    return mojo::internal::SerializeAsMessageImpl<
        RemoteInvocationResultValue::DataView>(input);
  }

  template <typename UserType>
  static bool DeserializeFromMessage(mojo::Message input,
                                     UserType* output) {
    return mojo::internal::DeserializeImpl<RemoteInvocationResultValue::DataView>(
        input, input.payload(), input.payload_num_bytes(), output, Validate);
  }

 private:
  template <typename T>
  friend class ::mojo::InlinedStructPtr;
  template <typename T>
  friend class ::mojo::StructPtr;

  union Union_ {
    Union_(
        std::in_place_index_t<static_cast<size_t>(Tag::kNumberValue)>,
        double value);
    Union_(
        std::in_place_index_t<static_cast<size_t>(Tag::kBooleanValue)>,
        bool value);
    Union_(
        std::in_place_index_t<static_cast<size_t>(Tag::kStringValue)>,
        const ::blink::String& value);
    Union_(
        std::in_place_index_t<static_cast<size_t>(Tag::kSingletonValue)>,
        SingletonJavaScriptValue value);
    Union_(
        std::in_place_index_t<static_cast<size_t>(Tag::kObjectId)>,
        int32_t value);
    // The contents of the union are explicitly destroyed by `DestroyActive()`.
    ~Union_() {}

    double number_value;
    bool boolean_value;
    ::blink::String string_value;
    SingletonJavaScriptValue singleton_value;
    int32_t object_id;
  };

  RemoteInvocationResultValue(
      std::in_place_index_t<static_cast<size_t>(Tag::kNumberValue)>,
      double value);
  RemoteInvocationResultValue(
      std::in_place_index_t<static_cast<size_t>(Tag::kBooleanValue)>,
      bool value);
  RemoteInvocationResultValue(
      std::in_place_index_t<static_cast<size_t>(Tag::kStringValue)>,
      const ::blink::String& value);
  RemoteInvocationResultValue(
      std::in_place_index_t<static_cast<size_t>(Tag::kSingletonValue)>,
      SingletonJavaScriptValue value);
  RemoteInvocationResultValue(
      std::in_place_index_t<static_cast<size_t>(Tag::kObjectId)>,
      int32_t value);

  static bool Validate(const void* data,
                       mojo::internal::ValidationContext* validation_context);

  void DestroyActive();
  Tag tag_;
  Union_ data_;
};





class PLATFORM_EXPORT RemoteTypedArray {
 public:
  template <typename T>
  using EnableIfSame = std::enable_if_t<std::is_same<RemoteTypedArray, T>::value>;
  using DataView = RemoteTypedArrayDataView;
  using Data_ = internal::RemoteTypedArray_Data;

  template <typename... Args>
  static RemoteTypedArrayPtr New(Args&&... args) {
    return RemoteTypedArrayPtr(
        std::in_place, std::forward<Args>(args)...);
  }

  template <typename U>
  static RemoteTypedArrayPtr From(const U& u) {
    return mojo::TypeConverter<RemoteTypedArrayPtr, U>::Convert(u);
  }

  template <typename U>
  U To() const {
    return mojo::TypeConverter<U, RemoteTypedArray>::Convert(*this);
  }


  RemoteTypedArray();

  RemoteTypedArray(
      RemoteArrayType type,
      ::mojo_base::BigBuffer buffer);

RemoteTypedArray(const RemoteTypedArray&) = delete;
RemoteTypedArray& operator=(const RemoteTypedArray&) = delete;

  ~RemoteTypedArray();

  // Clone() is a template so it is only instantiated if it is used. Thus, the
  // bindings generator does not need to know whether Clone() or copy
  // constructor/assignment are available for members.
  template <typename StructPtrType = RemoteTypedArrayPtr>
  RemoteTypedArrayPtr Clone() const;

  // Equals() is a template so it is only instantiated if it is used. Thus, the
  // bindings generator does not need to know whether Equals() or == operator
  // are available for members.
  template <typename T, RemoteTypedArray::EnableIfSame<T>* = nullptr>
  bool Equals(const T& other) const;

  template <typename T, RemoteTypedArray::EnableIfSame<T>* = nullptr>
  bool operator==(const T& rhs) const { return Equals(rhs); }

  template <typename T, RemoteTypedArray::EnableIfSame<T>* = nullptr>
  bool operator!=(const T& rhs) const { return !operator==(rhs); }

  template <typename UserType>
  static mojo::Message SerializeAsMessage(UserType* input) {
    return mojo::internal::SerializeAsMessageImpl<
        RemoteTypedArray::DataView>(input);
  }

  // The returned Message is serialized only if the message is moved
  // cross-process or cross-language. Otherwise if the message is Deserialized
  // as the same UserType |input| will just be moved to |output| in
  // DeserializeFromMessage.
  template <typename UserType>
  static mojo::Message WrapAsMessage(UserType input) {
    return mojo::Message(std::make_unique<
        internal::RemoteTypedArray_UnserializedMessageContext<
            UserType, RemoteTypedArray::DataView>>(0, 0, std::move(input)),
        MOJO_CREATE_MESSAGE_FLAG_NONE);
  }

  template <typename UserType>
  static bool Deserialize(const void* data,
                          size_t data_num_bytes,
                          UserType* output) {
    mojo::Message message;
    return mojo::internal::DeserializeImpl<RemoteTypedArray::DataView>(
        message, data, data_num_bytes, output, Validate);
  }

  template <typename UserType>
  static bool Deserialize(base::span<const uint8_t> input,
                          UserType* output) {
    return RemoteTypedArray::Deserialize(
        input.empty() ? nullptr : input.data(), input.size(), output);
  }

  template <typename UserType>
  static bool DeserializeFromMessage(mojo::Message input,
                                     UserType* output) {
    auto context = input.TakeUnserializedContext<
        internal::RemoteTypedArray_UnserializedMessageContext<
            UserType, RemoteTypedArray::DataView>>();
    if (context) {
      *output = std::move(context->TakeData());
      return true;
    }
    input.SerializeIfNecessary();
    return mojo::internal::DeserializeImpl<RemoteTypedArray::DataView>(
        input, input.payload(), input.payload_num_bytes(), output, Validate);
  }

  
  RemoteArrayType type;
  
  ::mojo_base::BigBuffer buffer;

  // Serialise this struct into a trace.
  void WriteIntoTrace(perfetto::TracedValue traced_context) const;

 private:
  static bool Validate(const void* data,
                       mojo::internal::ValidationContext* validation_context);
};

// The comparison operators are templates, so they are only instantiated if they
// are used. Thus, the bindings generator does not need to know whether
// comparison operators are available for members.
template <typename T, RemoteTypedArray::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);

template <typename T, RemoteTypedArray::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) {
  return !(rhs < lhs);
}

template <typename T, RemoteTypedArray::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) {
  return rhs < lhs;
}

template <typename T, RemoteTypedArray::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) {
  return !(lhs < rhs);
}





class PLATFORM_EXPORT RemoteInvocationResult {
 public:
  template <typename T>
  using EnableIfSame = std::enable_if_t<std::is_same<RemoteInvocationResult, T>::value>;
  using DataView = RemoteInvocationResultDataView;
  using Data_ = internal::RemoteInvocationResult_Data;

  template <typename... Args>
  static RemoteInvocationResultPtr New(Args&&... args) {
    return RemoteInvocationResultPtr(
        std::in_place, std::forward<Args>(args)...);
  }

  template <typename U>
  static RemoteInvocationResultPtr From(const U& u) {
    return mojo::TypeConverter<RemoteInvocationResultPtr, U>::Convert(u);
  }

  template <typename U>
  U To() const {
    return mojo::TypeConverter<U, RemoteInvocationResult>::Convert(*this);
  }


  RemoteInvocationResult();

  RemoteInvocationResult(
      RemoteInvocationError error,
      RemoteInvocationResultValuePtr value);

RemoteInvocationResult(const RemoteInvocationResult&) = delete;
RemoteInvocationResult& operator=(const RemoteInvocationResult&) = delete;

  ~RemoteInvocationResult();

  // Clone() is a template so it is only instantiated if it is used. Thus, the
  // bindings generator does not need to know whether Clone() or copy
  // constructor/assignment are available for members.
  template <typename StructPtrType = RemoteInvocationResultPtr>
  RemoteInvocationResultPtr Clone() const;

  // Equals() is a template so it is only instantiated if it is used. Thus, the
  // bindings generator does not need to know whether Equals() or == operator
  // are available for members.
  template <typename T, RemoteInvocationResult::EnableIfSame<T>* = nullptr>
  bool Equals(const T& other) const;

  template <typename T, RemoteInvocationResult::EnableIfSame<T>* = nullptr>
  bool operator==(const T& rhs) const { return Equals(rhs); }

  template <typename T, RemoteInvocationResult::EnableIfSame<T>* = nullptr>
  bool operator!=(const T& rhs) const { return !operator==(rhs); }

  template <mojo::internal::SendValidation send_validation, typename UserType>
  static ::blink::Vector<uint8_t> Serialize(UserType* input) {
    return mojo::internal::SerializeImpl<
        RemoteInvocationResult::DataView, ::blink::Vector<uint8_t>, send_validation>(input);
  }

  template <typename UserType>
  static ::blink::Vector<uint8_t> Serialize(UserType* input) {
    return mojo::internal::SerializeImpl<
        RemoteInvocationResult::DataView, ::blink::Vector<uint8_t>>(input);
  }

  template <typename UserType>
  static mojo::Message SerializeAsMessage(UserType* input) {
    return mojo::internal::SerializeAsMessageImpl<
        RemoteInvocationResult::DataView>(input);
  }

  // The returned Message is serialized only if the message is moved
  // cross-process or cross-language. Otherwise if the message is Deserialized
  // as the same UserType |input| will just be moved to |output| in
  // DeserializeFromMessage.
  template <typename UserType>
  static mojo::Message WrapAsMessage(UserType input) {
    return mojo::Message(std::make_unique<
        internal::RemoteInvocationResult_UnserializedMessageContext<
            UserType, RemoteInvocationResult::DataView>>(0, 0, std::move(input)),
        MOJO_CREATE_MESSAGE_FLAG_NONE);
  }

  template <typename UserType>
  static bool Deserialize(const void* data,
                          size_t data_num_bytes,
                          UserType* output) {
    mojo::Message message;
    return mojo::internal::DeserializeImpl<RemoteInvocationResult::DataView>(
        message, data, data_num_bytes, output, Validate);
  }

  template <typename UserType>
  static bool Deserialize(base::span<const uint8_t> input,
                          UserType* output) {
    return RemoteInvocationResult::Deserialize(
        input.empty() ? nullptr : input.data(), input.size(), output);
  }

  template <typename UserType>
  static bool DeserializeFromMessage(mojo::Message input,
                                     UserType* output) {
    auto context = input.TakeUnserializedContext<
        internal::RemoteInvocationResult_UnserializedMessageContext<
            UserType, RemoteInvocationResult::DataView>>();
    if (context) {
      *output = std::move(context->TakeData());
      return true;
    }
    input.SerializeIfNecessary();
    return mojo::internal::DeserializeImpl<RemoteInvocationResult::DataView>(
        input, input.payload(), input.payload_num_bytes(), output, Validate);
  }

  
  RemoteInvocationError error;
  
  RemoteInvocationResultValuePtr value;

  // Serialise this struct into a trace.
  void WriteIntoTrace(perfetto::TracedValue traced_context) const;

 private:
  static bool Validate(const void* data,
                       mojo::internal::ValidationContext* validation_context);
};

// The comparison operators are templates, so they are only instantiated if they
// are used. Thus, the bindings generator does not need to know whether
// comparison operators are available for members.
template <typename T, RemoteInvocationResult::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);

template <typename T, RemoteInvocationResult::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) {
  return !(rhs < lhs);
}

template <typename T, RemoteInvocationResult::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) {
  return rhs < lhs;
}

template <typename T, RemoteInvocationResult::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) {
  return !(lhs < rhs);
}

template <typename UnionPtrType>
RemoteInvocationArgumentPtr RemoteInvocationArgument::Clone() const {
  switch (tag_) {
    case Tag::kNumberValue:
      return NewNumberValue(
          mojo::Clone(data_.number_value));
    case Tag::kBooleanValue:
      return NewBooleanValue(
          mojo::Clone(data_.boolean_value));
    case Tag::kStringValue:
      return NewStringValue(
          mojo::Clone(data_.string_value));
    case Tag::kSingletonValue:
      return NewSingletonValue(
          mojo::Clone(data_.singleton_value));
    case Tag::kArrayValue:
      return NewArrayValue(
          mojo::Clone(data_.array_value));
    case Tag::kTypedArrayValue:
      return NewTypedArrayValue(
          mojo::Clone(data_.typed_array_value));
    case Tag::kObjectIdValue:
      return NewObjectIdValue(
          mojo::Clone(data_.object_id_value));
  }
  return nullptr;
}

template <typename T,
          typename std::enable_if<std::is_same<
              T, RemoteInvocationArgument>::value>::type*>
bool RemoteInvocationArgument::Equals(const T& other) const {
  if (tag_ != other.which())
    return false;

  switch (tag_) {
    case Tag::kNumberValue:
      return mojo::Equals(data_.number_value, other.data_.number_value);
    case Tag::kBooleanValue:
      return mojo::Equals(data_.boolean_value, other.data_.boolean_value);
    case Tag::kStringValue:
      return mojo::Equals(data_.string_value, other.data_.string_value);
    case Tag::kSingletonValue:
      return mojo::Equals(data_.singleton_value, other.data_.singleton_value);
    case Tag::kArrayValue:
      return mojo::Equals(data_.array_value, other.data_.array_value);
    case Tag::kTypedArrayValue:
      return mojo::Equals(data_.typed_array_value, other.data_.typed_array_value);
    case Tag::kObjectIdValue:
      return mojo::Equals(data_.object_id_value, other.data_.object_id_value);
  }

  return false;
}
template <typename UnionPtrType>
RemoteInvocationResultValuePtr RemoteInvocationResultValue::Clone() const {
  switch (tag_) {
    case Tag::kNumberValue:
      return NewNumberValue(
          mojo::Clone(data_.number_value));
    case Tag::kBooleanValue:
      return NewBooleanValue(
          mojo::Clone(data_.boolean_value));
    case Tag::kStringValue:
      return NewStringValue(
          mojo::Clone(data_.string_value));
    case Tag::kSingletonValue:
      return NewSingletonValue(
          mojo::Clone(data_.singleton_value));
    case Tag::kObjectId:
      return NewObjectId(
          mojo::Clone(data_.object_id));
  }
  return nullptr;
}

template <typename T,
          typename std::enable_if<std::is_same<
              T, RemoteInvocationResultValue>::value>::type*>
bool RemoteInvocationResultValue::Equals(const T& other) const {
  if (tag_ != other.which())
    return false;

  switch (tag_) {
    case Tag::kNumberValue:
      return mojo::Equals(data_.number_value, other.data_.number_value);
    case Tag::kBooleanValue:
      return mojo::Equals(data_.boolean_value, other.data_.boolean_value);
    case Tag::kStringValue:
      return mojo::Equals(data_.string_value, other.data_.string_value);
    case Tag::kSingletonValue:
      return mojo::Equals(data_.singleton_value, other.data_.singleton_value);
    case Tag::kObjectId:
      return mojo::Equals(data_.object_id, other.data_.object_id);
  }

  return false;
}
template <typename StructPtrType>
RemoteTypedArrayPtr RemoteTypedArray::Clone() const {
  return New(
      mojo::Clone(type),
      mojo::Clone(buffer)
  );
}

template <typename T, RemoteTypedArray::EnableIfSame<T>*>
bool RemoteTypedArray::Equals(const T& other_struct) const {
  if (!mojo::Equals(this->type, other_struct.type))
    return false;
  if (!mojo::Equals(this->buffer, other_struct.buffer))
    return false;
  return true;
}

template <typename T, RemoteTypedArray::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
  if (lhs.type < rhs.type)
    return true;
  if (rhs.type < lhs.type)
    return false;
  if (lhs.buffer < rhs.buffer)
    return true;
  if (rhs.buffer < lhs.buffer)
    return false;
  return false;
}
template <typename StructPtrType>
RemoteInvocationResultPtr RemoteInvocationResult::Clone() const {
  return New(
      mojo::Clone(error),
      mojo::Clone(value)
  );
}

template <typename T, RemoteInvocationResult::EnableIfSame<T>*>
bool RemoteInvocationResult::Equals(const T& other_struct) const {
  if (!mojo::Equals(this->error, other_struct.error))
    return false;
  if (!mojo::Equals(this->value, other_struct.value))
    return false;
  return true;
}

template <typename T, RemoteInvocationResult::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
  if (lhs.error < rhs.error)
    return true;
  if (rhs.error < lhs.error)
    return false;
  if (lhs.value < rhs.value)
    return true;
  if (rhs.value < lhs.value)
    return false;
  return false;
}


}  // blink::mojom::blink

namespace mojo {


template <>
struct PLATFORM_EXPORT StructTraits<::blink::mojom::blink::RemoteTypedArray::DataView,
                                         ::blink::mojom::blink::RemoteTypedArrayPtr> {
  static bool IsNull(const ::blink::mojom::blink::RemoteTypedArrayPtr& input) { return !input; }
  static void SetToNull(::blink::mojom::blink::RemoteTypedArrayPtr* output) { output->reset(); }

  static decltype(::blink::mojom::blink::RemoteTypedArray::type) type(
      const ::blink::mojom::blink::RemoteTypedArrayPtr& input) {
    return input->type;
  }

  static  decltype(::blink::mojom::blink::RemoteTypedArray::buffer)& buffer(
       ::blink::mojom::blink::RemoteTypedArrayPtr& input) {
    return input->buffer;
  }

  static bool Read(::blink::mojom::blink::RemoteTypedArray::DataView input, ::blink::mojom::blink::RemoteTypedArrayPtr* output);
};


template <>
struct PLATFORM_EXPORT StructTraits<::blink::mojom::blink::RemoteInvocationResult::DataView,
                                         ::blink::mojom::blink::RemoteInvocationResultPtr> {
  static bool IsNull(const ::blink::mojom::blink::RemoteInvocationResultPtr& input) { return !input; }
  static void SetToNull(::blink::mojom::blink::RemoteInvocationResultPtr* output) { output->reset(); }

  static decltype(::blink::mojom::blink::RemoteInvocationResult::error) error(
      const ::blink::mojom::blink::RemoteInvocationResultPtr& input) {
    return input->error;
  }

  static const decltype(::blink::mojom::blink::RemoteInvocationResult::value)& value(
      const ::blink::mojom::blink::RemoteInvocationResultPtr& input) {
    return input->value;
  }

  static bool Read(::blink::mojom::blink::RemoteInvocationResult::DataView input, ::blink::mojom::blink::RemoteInvocationResultPtr* output);
};


template <>
struct PLATFORM_EXPORT UnionTraits<::blink::mojom::blink::RemoteInvocationArgument::DataView,
                                        ::blink::mojom::blink::RemoteInvocationArgumentPtr> {
  static bool IsNull(const ::blink::mojom::blink::RemoteInvocationArgumentPtr& input) { return !input; }
  static void SetToNull(::blink::mojom::blink::RemoteInvocationArgumentPtr* output) { output->reset(); }

  static ::blink::mojom::blink::RemoteInvocationArgument::Tag GetTag(const ::blink::mojom::blink::RemoteInvocationArgumentPtr& input) {
    return input->which();
  }

  static  double number_value(const ::blink::mojom::blink::RemoteInvocationArgumentPtr& input) {
    return input->get_number_value();
  }

  static  bool boolean_value(const ::blink::mojom::blink::RemoteInvocationArgumentPtr& input) {
    return input->get_boolean_value();
  }

  static const ::blink::String& string_value(const ::blink::mojom::blink::RemoteInvocationArgumentPtr& input) {
    return input->get_string_value();
  }

  static  ::blink::mojom::blink::SingletonJavaScriptValue singleton_value(const ::blink::mojom::blink::RemoteInvocationArgumentPtr& input) {
    return input->get_singleton_value();
  }

  static  ::blink::Vector<::blink::mojom::blink::RemoteInvocationArgumentPtr>& array_value( ::blink::mojom::blink::RemoteInvocationArgumentPtr& input) {
    return input->get_array_value();
  }

  static  ::blink::mojom::blink::RemoteTypedArrayPtr& typed_array_value( ::blink::mojom::blink::RemoteInvocationArgumentPtr& input) {
    return input->get_typed_array_value();
  }

  static  int32_t object_id_value(const ::blink::mojom::blink::RemoteInvocationArgumentPtr& input) {
    return input->get_object_id_value();
  }

  static bool Read(::blink::mojom::blink::RemoteInvocationArgument::DataView input, ::blink::mojom::blink::RemoteInvocationArgumentPtr* output);
};


template <>
struct PLATFORM_EXPORT UnionTraits<::blink::mojom::blink::RemoteInvocationResultValue::DataView,
                                        ::blink::mojom::blink::RemoteInvocationResultValuePtr> {
  static bool IsNull(const ::blink::mojom::blink::RemoteInvocationResultValuePtr& input) { return !input; }
  static void SetToNull(::blink::mojom::blink::RemoteInvocationResultValuePtr* output) { output->reset(); }

  static ::blink::mojom::blink::RemoteInvocationResultValue::Tag GetTag(const ::blink::mojom::blink::RemoteInvocationResultValuePtr& input) {
    return input->which();
  }

  static  double number_value(const ::blink::mojom::blink::RemoteInvocationResultValuePtr& input) {
    return input->get_number_value();
  }

  static  bool boolean_value(const ::blink::mojom::blink::RemoteInvocationResultValuePtr& input) {
    return input->get_boolean_value();
  }

  static const ::blink::String& string_value(const ::blink::mojom::blink::RemoteInvocationResultValuePtr& input) {
    return input->get_string_value();
  }

  static  ::blink::mojom::blink::SingletonJavaScriptValue singleton_value(const ::blink::mojom::blink::RemoteInvocationResultValuePtr& input) {
    return input->get_singleton_value();
  }

  static  int32_t object_id(const ::blink::mojom::blink::RemoteInvocationResultValuePtr& input) {
    return input->get_object_id();
  }

  static bool Read(::blink::mojom::blink::RemoteInvocationResultValue::DataView input, ::blink::mojom::blink::RemoteInvocationResultValuePtr* output);
};

}  // namespace mojo

#endif  // THIRD_PARTY_BLINK_PUBLIC_MOJOM_REMOTE_OBJECTS_REMOTE_OBJECTS_MOJOM_BLINK_H_