#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
#endif
#include "services/webnn/public/mojom/webnn_buffer.mojom.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-import-headers.h"
#include "services/webnn/public/mojom/webnn_buffer.mojom-test-utils.h"
namespace webnn::mojom {
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::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::BufferUsage::DataView, ::webnn::mojom::BufferUsagePtr>::Read(
::webnn::mojom::BufferUsage::DataView input,
::webnn::mojom::BufferUsagePtr* output) { … }
bool StructTraits<::webnn::mojom::BufferInfo::DataView, ::webnn::mojom::BufferInfoPtr>::Read(
::webnn::mojom::BufferInfo::DataView input,
::webnn::mojom::BufferInfoPtr* output) { … }
bool UnionTraits<::webnn::mojom::ReadBufferResult::DataView, ::webnn::mojom::ReadBufferResultPtr>::Read(
::webnn::mojom::ReadBufferResult::DataView input,
::webnn::mojom::ReadBufferResultPtr* output) { … }
}
namespace webnn::mojom {
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