blob: c0506c03852704ce215e1d366072259ae84c0278 [file] [log] [blame]
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SERVICES_WEBNN_WEBNN_CONTEXT_IMPL_H_
#define SERVICES_WEBNN_WEBNN_CONTEXT_IMPL_H_
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "services/webnn/public/mojom/webnn_service.mojom.h"
namespace webnn {
class WebNNContextProviderImpl;
class WebNNContextImpl : public mojom::WebNNContext {
public:
WebNNContextImpl(mojo::PendingReceiver<mojom::WebNNContext> receiver,
WebNNContextProviderImpl* context_provider);
WebNNContextImpl(const WebNNContextImpl&) = delete;
WebNNContextImpl& operator=(const WebNNContextImpl&) = delete;
~WebNNContextImpl() override;
private:
void OnConnectionError();
// mojom::WebNNContext
void CreateGraph(mojom::GraphInfoPtr graph_info,
CreateGraphCallback callback) override;
mojo::Receiver<mojom::WebNNContext> receiver_;
// Owns this object.
raw_ptr<WebNNContextProviderImpl> context_provider_;
};
} // namespace webnn
#endif // SERVICES_WEBNN_WEBNN_CONTEXT_IMPL_H_