// Copyright 2026 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. module webnn.mojom; struct WebNNExecutionProviderDetails { // Name of the execution provider, e.g. "OpenVINOExecutionProvider". string name; // Vendor of the execution provider, e.g. "Intel". string vendor; // Hardware type of the execution provider, e.g. "CPU", "GPU", "NPU". string hardware_type; // Vendor ID of the hardware device used by the execution provider. string vendor_id; // Device ID of the hardware device used by the execution provider. string device_id; // Version of the execution provider if provided otherwise empty. string version; // Indicates if this execution provider is the first selected one, otherwise // the EP is a fallback option. bool first_selected; }; struct WebNNContextIntrospectionDetails { int32 context_id; // The backend used by the context, e.g. "CoreML", "LiteRT", etc. string context_backend; // The list of execution providers supported by the context. // This is backend-specific information and may be empty if the backend does // not provide this information. array execution_providers; }; // Interface for the client to receive WebNN introspection data. interface WebNNServiceIntrospectionClient { // Called when the webnn contexts list from the provider is updated. OnUpdateExistingContextDetails( array contexts_details); // Called when the available execution providers list from the platform is // updated. OnUpdateAvailableExecutionProvidersDetails( array available_execution_providers); }; // Interface for controlling WebNN introspection. interface WebNNServiceIntrospection { // Sets the client to receive contexts details. SetClient(pending_remote client); // Query the list of existing contexts from the provider. GetExistingContextsDetails() => (array contexts_details); // Query the list of available execution providers from the platform. // This is backend-specific information and may be empty if the backend does // not provide this information. GetAvailableExecutionProvidersDetails() => (array execution_providers); // Force the creation of the ONNX Runtime environment for introspection. // This will create the ORT environment if it hasn't been created yet, // force installation of execution providers if applicable so WebNN Internals // can show them. Only available on Windows since ORT is only used on Windows. [EnableIf=is_win] ForceOrtEnvironmentCreationForIntrospection() => (array execution_providers); };