File: gpu_channel_manager_delegate.h

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (82 lines) | stat: -rw-r--r-- 3,134 bytes parent folder | download | duplicates (6)
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_