1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
// Copyright 2016 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_IPC_SERVICE_GPU_CHANNEL_MANAGER_DELEGATE_H_
#define GPU_IPC_SERVICE_GPU_CHANNEL_MANAGER_DELEGATE_H_
#include "build/build_config.h"
#include "gpu/command_buffer/common/constants.h"
#include "gpu/config/gpu_info.h"
#include "gpu/ipc/common/gpu_disk_cache_type.h"
#include "gpu/ipc/common/surface_handle.h"
#include "third_party/blink/public/common/tokens/tokens.h"
class GURL;
namespace gpu {
// TODO(kylechar): Rename this class. It's used to provide GpuServiceImpl
// functionality to multiple classes in src/gpu/ so delegate is inaccurate.
class GpuChannelManagerDelegate {
public:
// Force the loss of all GL contexts.
virtual void LoseAllContexts() = 0;
// Called on any successful context creation.
virtual void DidCreateContextSuccessfully() = 0;
// Tells the delegate that an offscreen context was created for the provided
// |active_url|.
virtual void DidCreateOffscreenContext(const GURL& active_url) = 0;
// Notification from GPU that the channel is destroyed.
virtual void DidDestroyChannel(int client_id) = 0;
// Notification that all GPU channels are shutdown properly.
// Note this is NOT called in error conditions such as losing channel due to
// context loss, or from debug messages.
virtual void DidDestroyAllChannels() = 0;
// Tells the delegate that an offscreen context was destroyed for the provided
// |active_url|.
virtual void DidDestroyOffscreenContext(const GURL& active_url) = 0;
// Tells the delegate that a context was lost.
virtual void DidLoseContext(error::ContextLostReason reason,
const GURL& active_url) = 0;
// Tells the delegate to cache the given blob information in persistent
// storage. The embedder is expected to repopulate the in-memory cache through
// the respective GpuChannelManager API.
virtual void StoreBlobToDisk(const gpu::GpuDiskCacheHandle& handle,
const std::string& key,
const std::string& shader) = 0;
// Tells the delegate to ask for a unique isolation key given a client id and
// identifying token on the client.
using GetIsolationKeyCallback =
base::OnceCallback<void(const std::string& isolation_key)>;
virtual void GetIsolationKey(int client_id,
const blink::WebGPUExecutionContextToken& token,
GetIsolationKeyCallback cb) = 0;
// Cleanly exits the GPU process in response to an error. This can only be
// called from the GPU thread.
virtual void MaybeExitOnContextLost(
error::ContextLostReason context_lost_reason) = 0;
// Returns true if the GPU process is exiting. This can be called from any
// thread.
virtual bool IsExiting() const = 0;
// Returns GPU Scheduler
virtual gpu::Scheduler* GetGpuScheduler() = 0;
protected:
virtual ~GpuChannelManagerDelegate() = default;
};
} // namespace gpu
#endif // GPU_IPC_SERVICE_GPU_CHANNEL_MANAGER_DELEGATE_H_
|