#ifndef SERVICES_WEBNN_PUBLIC_MOJOM_WEBNN_BUFFER_MOJOM_BLINK_H_
#define SERVICES_WEBNN_PUBLIC_MOJOM_WEBNN_BUFFER_MOJOM_BLINK_H_
#include <stdint.h>
#include <limits>
#include <optional>
#include <type_traits>
#include <utility>
#include "base/types/cxx23_to_underlying.h"
#include "mojo/public/cpp/bindings/clone_traits.h"
#include "mojo/public/cpp/bindings/equals_traits.h"
#include "mojo/public/cpp/bindings/lib/serialization.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 "third_party/perfetto/include/perfetto/tracing/traced_value_forward.h"
#include "services/webnn/public/mojom/webnn_buffer.mojom-features.h"
#include "services/webnn/public/mojom/webnn_buffer.mojom-shared.h"
#include "services/webnn/public/mojom/webnn_buffer.mojom-blink-forward.h"
#include "mojo/public/mojom/base/big_buffer.mojom-blink.h"
#include "services/webnn/public/mojom/webnn_graph.mojom-blink.h"
#include "services/webnn/public/mojom/webnn_error.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/lib/message_size_estimator.h"
#include "mojo/public/cpp/bindings/raw_ptr_impl_ref_traits.h"
#include "services/webnn/public/mojom/buffer_usage_mojom_traits.h"
#include "services/webnn/public/mojom/context_properties_mojom_traits.h"
#include "services/webnn/public/mojom/data_type_limits_mojom_traits.h"
#include "services/webnn/public/mojom/operand_descriptor_mojom_traits.h"
#include "services/webnn/public/mojom/supported_data_types_mojom_traits.h"
#include "base/component_export.h"
namespace webnn::mojom::blink {
class WebNNBufferProxy;
template <typename ImplRefTraits>
class WebNNBufferStub;
class WebNNBufferRequestValidator;
class WebNNBufferResponseValidator;
class COMPONENT_EXPORT(WEBNN_MOJOM_BLINK) WebNNBuffer
: public WebNNBufferInterfaceBase { … };
class COMPONENT_EXPORT(WEBNN_MOJOM_BLINK) WebNNBufferProxy
: public WebNNBuffer { … };
class COMPONENT_EXPORT(WEBNN_MOJOM_BLINK) WebNNBufferStubDispatch { … };
template <typename ImplRefTraits =
mojo::RawPtrImplRefTraits<WebNNBuffer>>
class WebNNBufferStub
: public mojo::MessageReceiverWithResponderStatus {
public:
using ImplPointerType = typename ImplRefTraits::PointerType;
WebNNBufferStub() = default;
~WebNNBufferStub() override = default;
void set_sink(ImplPointerType sink) { … }
ImplPointerType& sink() { … }
bool Accept(mojo::Message* message) override { … }
bool AcceptWithResponder(
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) override { … }
private:
ImplPointerType sink_;
};
class COMPONENT_EXPORT(WEBNN_MOJOM_BLINK) WebNNBufferRequestValidator : public mojo::MessageReceiver { … };
class COMPONENT_EXPORT(WEBNN_MOJOM_BLINK) WebNNBufferResponseValidator : public mojo::MessageReceiver { … };
class COMPONENT_EXPORT(WEBNN_MOJOM_BLINK) BufferUsage { … };
template <typename T, BufferUsage::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);
template <typename T, BufferUsage::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) { … }
template <typename T, BufferUsage::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) { … }
template <typename T, BufferUsage::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) { … }
class COMPONENT_EXPORT(WEBNN_MOJOM_BLINK) ReadBufferResult { … };
class COMPONENT_EXPORT(WEBNN_MOJOM_BLINK) BufferInfo { … };
template <typename T, BufferInfo::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);
template <typename T, BufferInfo::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) { … }
template <typename T, BufferInfo::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) { … }
template <typename T, BufferInfo::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) { … }
template <typename UnionPtrType>
ReadBufferResultPtr ReadBufferResult::Clone() const { … }
template <typename T,
typename std::enable_if<std::is_same<
T, ReadBufferResult>::value>::type*>
bool ReadBufferResult::Equals(const T& other) const { … }
template <typename StructPtrType>
BufferUsagePtr BufferUsage::Clone() const { … }
template <typename T, BufferUsage::EnableIfSame<T>*>
bool BufferUsage::Equals(const T& other_struct) const { … }
template <typename T, BufferUsage::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) { … }
template <typename StructPtrType>
BufferInfoPtr BufferInfo::Clone() const { … }
template <typename T, BufferInfo::EnableIfSame<T>*>
bool BufferInfo::Equals(const T& other_struct) const { … }
template <typename T, BufferInfo::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) { … }
}
namespace mojo {
template <>
struct COMPONENT_EXPORT(WEBNN_MOJOM_BLINK) StructTraits<::webnn::mojom::blink::BufferUsage::DataView,
::webnn::mojom::blink::BufferUsagePtr> { … };
template <>
struct COMPONENT_EXPORT(WEBNN_MOJOM_BLINK) StructTraits<::webnn::mojom::blink::BufferInfo::DataView,
::webnn::mojom::blink::BufferInfoPtr> { … };
template <>
struct COMPONENT_EXPORT(WEBNN_MOJOM_BLINK) UnionTraits<::webnn::mojom::blink::ReadBufferResult::DataView,
::webnn::mojom::blink::ReadBufferResultPtr> { … };
}
#endif