#ifndef SERVICES_WEBNN_PUBLIC_MOJOM_WEBNN_CONTEXT_MOJOM_H_
#define SERVICES_WEBNN_PUBLIC_MOJOM_WEBNN_CONTEXT_MOJOM_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_context.mojom-features.h"
#include "services/webnn/public/mojom/webnn_context.mojom-shared.h"
#include "services/webnn/public/mojom/webnn_context.mojom-forward.h"
#include "services/webnn/public/mojom/features.mojom-forward.h"
#include "services/webnn/public/mojom/webnn_buffer.mojom-forward.h"
#include "services/webnn/public/mojom/webnn_error.mojom.h"
#include "services/webnn/public/mojom/webnn_graph_builder.mojom-forward.h"
#include "third_party/blink/public/mojom/tokens/tokens.mojom.h"
#include <string>
#include <vector>
#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 "base/component_export.h"
namespace webnn::mojom {
class WebNNContextProxy;
template <typename ImplRefTraits>
class WebNNContextStub;
class WebNNContextRequestValidator;
class WebNNContextResponseValidator;
class COMPONENT_EXPORT(WEBNN_MOJOM) WebNNContext
: public WebNNContextInterfaceBase { … };
class COMPONENT_EXPORT(WEBNN_MOJOM) WebNNContextProxy
: public WebNNContext { … };
class COMPONENT_EXPORT(WEBNN_MOJOM) WebNNContextStubDispatch { … };
template <typename ImplRefTraits =
mojo::RawPtrImplRefTraits<WebNNContext>>
class WebNNContextStub
: public mojo::MessageReceiverWithResponderStatus {
public:
using ImplPointerType = typename ImplRefTraits::PointerType;
WebNNContextStub() = default;
~WebNNContextStub() 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) WebNNContextRequestValidator : public mojo::MessageReceiver { … };
class COMPONENT_EXPORT(WEBNN_MOJOM) WebNNContextResponseValidator : public mojo::MessageReceiver { … };
class COMPONENT_EXPORT(WEBNN_MOJOM) CreateBufferResult { … };
class COMPONENT_EXPORT(WEBNN_MOJOM) CreateBufferSuccess { … };
template <typename T, CreateBufferSuccess::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);
template <typename T, CreateBufferSuccess::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) { … }
template <typename T, CreateBufferSuccess::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) { … }
template <typename T, CreateBufferSuccess::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) { … }
template <typename UnionPtrType>
CreateBufferResultPtr CreateBufferResult::Clone() const { … }
template <typename T,
typename std::enable_if<std::is_same<
T, CreateBufferResult>::value>::type*>
bool CreateBufferResult::Equals(const T& other) const { … }
template <typename StructPtrType>
CreateBufferSuccessPtr CreateBufferSuccess::Clone() const { … }
template <typename T, CreateBufferSuccess::EnableIfSame<T>*>
bool CreateBufferSuccess::Equals(const T& other_struct) const { … }
template <typename T, CreateBufferSuccess::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) { … }
}
namespace mojo {
template <>
struct COMPONENT_EXPORT(WEBNN_MOJOM) StructTraits<::webnn::mojom::CreateBufferSuccess::DataView,
::webnn::mojom::CreateBufferSuccessPtr> { … };
template <>
struct COMPONENT_EXPORT(WEBNN_MOJOM) UnionTraits<::webnn::mojom::CreateBufferResult::DataView,
::webnn::mojom::CreateBufferResultPtr> { … };
namespace internal {
template <>
inline bool GetRuntimeFeature_IsEnabled<::webnn::mojom::WebNNContext>() { … }
template <>
inline bool GetRuntimeFeature_ExpectEnabled<::webnn::mojom::WebNNContext>() {
return ::webnn::mojom::WebNNContext::RuntimeFeature_IsEnabled_(true);
}kIsRuntimeFeatureGuarded;
}
}
#endif