0
Files
src/gpu/command_buffer/service/webgpu_decoder_impl.h
Loko Kung 76d0dabf0b Adds mojo interface for GPU process to ask browser for isolation key.
- Adds the necessary mojom interface and helpers so that the WebGPU
  decoder is able to ask the browser for an isolation key at adapter
  creation time for workers only.
- Adds new IsolationKeyProvider interface for ease of testing and
  extensibility if there is a better way to get the isolation key given
  a token later on. Also because the in-process version doesn't have a
  good way to get the isolation key at the moment.
- Adds unit test for the WebGPU decoder for getting isolation key via a
  mock isolation key provider.
- Adds a queue for device requests to ensure that when isolation
  provider is available, we wait for the isolation key before creating
  devices. This requires an extra member variable to keep the queue of
  requests and handling for them to run and flushed later on. Also
  requires adding some deep copy utility to ensure that the descriptor
  is valid when the callback is issued (either on dtor or isolation key
  becoming available).
- Passes the isolation key to Dawn via the device descriptor extension.

Bug: dawn:549
Change-Id: I0bf0234c5c0506835cbe037566a7cc31ade10799
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3756347
Reviewed-by: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1056608}
2022-10-08 01:58:50 +00:00

46 lines
1.2 KiB
C++

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef GPU_COMMAND_BUFFER_SERVICE_WEBGPU_DECODER_IMPL_H_
#define GPU_COMMAND_BUFFER_SERVICE_WEBGPU_DECODER_IMPL_H_
#include "gpu/gpu_gles2_export.h"
#include "base/memory/scoped_refptr.h"
namespace gpu {
class CommandBufferServiceBase;
class DecoderClient;
struct GpuPreferences;
class IsolationKeyProvider;
class MemoryTracker;
class SharedContextState;
class SharedImageManager;
namespace gles2 {
class Outputter;
} // namespace gles2
namespace webgpu {
struct DawnCacheOptions;
class WebGPUDecoder;
GPU_GLES2_EXPORT WebGPUDecoder* CreateWebGPUDecoderImpl(
DecoderClient* client,
CommandBufferServiceBase* command_buffer_service,
SharedImageManager* shared_image_manager,
MemoryTracker* memory_tracker,
gles2::Outputter* outputter,
const GpuPreferences& gpu_preferences,
scoped_refptr<SharedContextState> shared_context_state,
const DawnCacheOptions& dawn_cache_options,
IsolationKeyProvider* isolation_key_provider);
} // namespace webgpu
} // namespace gpu
#endif // GPU_COMMAND_BUFFER_SERVICE_WEBGPU_DECODER_IMPL_H_