#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
#endif
#include "services/webnn/public/mojom/webnn_buffer.mojom-blink.h"
#include <math.h>
#include <stdint.h>
#include <utility>
#include "base/debug/alias.h"
#include "base/hash/md5_constexpr.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/typed_macros.h"
#include "mojo/public/cpp/bindings/features.h"
#include "mojo/public/cpp/bindings/lib/default_construct_tag_internal.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/proxy_to_responder.h"
#include "mojo/public/cpp/bindings/lib/send_message_helper.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_errors.h"
#include "mojo/public/cpp/bindings/mojo_buildflags.h"
#include "mojo/public/cpp/bindings/urgent_message_scope.h"
#include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value.h"
#include "services/webnn/public/mojom/webnn_buffer.mojom-params-data.h"
#include "services/webnn/public/mojom/webnn_buffer.mojom-shared-message-ids.h"
#include "services/webnn/public/mojom/webnn_buffer.mojom-blink-import-headers.h"
#include "services/webnn/public/mojom/webnn_buffer.mojom-blink-test-utils.h"
#include "mojo/public/cpp/bindings/lib/wtf_serialization.h"
namespace webnn::mojom::blink {
BufferUsage::BufferUsage()
: … { … }
BufferUsage::BufferUsage(
bool web_gpu_interop_in,
bool read_from_in,
bool write_to_in)
: … { … }
BufferUsage::~BufferUsage() = default;
void BufferUsage::WriteIntoTrace(
perfetto::TracedValue traced_context) const { … }
bool BufferUsage::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
BufferInfo::BufferInfo()
: … { … }
BufferInfo::BufferInfo(
const ::webnn::OperandDescriptor& descriptor_in,
::webnn::MLBufferUsage usage_in)
: … { … }
BufferInfo::~BufferInfo() = default;
void BufferInfo::WriteIntoTrace(
perfetto::TracedValue traced_context) const { … }
bool BufferInfo::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
ReadBufferResult::ReadBufferResult() : … { … }
ReadBufferResult::~ReadBufferResult() { … }
void ReadBufferResult::set_buffer(
::mojo_base::BigBuffer buffer) { … }
void ReadBufferResult::set_error(
::webnn::mojom::blink::ErrorPtr error) { … }
void ReadBufferResult::DestroyActive() { … }
bool ReadBufferResult::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
const char WebNNBuffer::Name_[] = …;
WebNNBuffer::IPCStableHashFunction WebNNBuffer::MessageToMethodInfo_(mojo::Message& message) { … }
const char* WebNNBuffer::MessageToMethodName_(mojo::Message& message) { … }
#if !BUILDFLAG(IS_FUCHSIA)
uint32_t WebNNBuffer::ReadBuffer_Sym::IPCStableHash() { … }
uint32_t WebNNBuffer::WriteBuffer_Sym::IPCStableHash() { … }
# endif
class WebNNBuffer_ReadBuffer_ForwardToCallback
: public mojo::MessageReceiver { … };
WebNNBufferProxy::WebNNBufferProxy(mojo::MessageReceiverWithResponder* receiver)
: … { … }
void WebNNBufferProxy::ReadBuffer(
ReadBufferCallback callback) { … }
void WebNNBufferProxy::WriteBuffer(
::mojo_base::BigBuffer in_src_buffer) { … }
class WebNNBuffer_ReadBuffer_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool WebNNBuffer_ReadBuffer_ForwardToCallback::Accept(
mojo::Message* message) { … }
void WebNNBuffer_ReadBuffer_ProxyToResponder::Run(
ReadBufferResultPtr in_result) { … }
bool WebNNBufferStubDispatch::Accept(
WebNNBuffer* impl,
mojo::Message* message) { … }
bool WebNNBufferStubDispatch::AcceptWithResponder(
WebNNBuffer* impl,
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { … }
namespace {
}
static const mojo::internal::GenericValidationInfo kWebNNBufferValidationInfo[] = …;
bool WebNNBufferRequestValidator::Accept(mojo::Message* message) { … }
bool WebNNBufferResponseValidator::Accept(mojo::Message* message) { … }
}
namespace mojo {
bool StructTraits<::webnn::mojom::blink::BufferUsage::DataView, ::webnn::mojom::blink::BufferUsagePtr>::Read(
::webnn::mojom::blink::BufferUsage::DataView input,
::webnn::mojom::blink::BufferUsagePtr* output) { … }
bool StructTraits<::webnn::mojom::blink::BufferInfo::DataView, ::webnn::mojom::blink::BufferInfoPtr>::Read(
::webnn::mojom::blink::BufferInfo::DataView input,
::webnn::mojom::blink::BufferInfoPtr* output) { … }
bool UnionTraits<::webnn::mojom::blink::ReadBufferResult::DataView, ::webnn::mojom::blink::ReadBufferResultPtr>::Read(
::webnn::mojom::blink::ReadBufferResult::DataView input,
::webnn::mojom::blink::ReadBufferResultPtr* output) { … }
}
namespace webnn::mojom::blink {
void WebNNBufferInterceptorForTesting::ReadBuffer(ReadBufferCallback callback) { … }
void WebNNBufferInterceptorForTesting::WriteBuffer(::mojo_base::BigBuffer src_buffer) { … }
WebNNBufferAsyncWaiter::WebNNBufferAsyncWaiter(
WebNNBuffer* proxy) : … { … }
WebNNBufferAsyncWaiter::~WebNNBufferAsyncWaiter() = default;
void WebNNBufferAsyncWaiter::ReadBuffer(
ReadBufferResultPtr* out_result) { … }
ReadBufferResultPtr WebNNBufferAsyncWaiter::ReadBuffer(
) { … }
}
#if defined(__clang__)
#pragma clang diagnostic pop
#endif