1 // Copyright 2018 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef GPU_IPC_COMMON_GPU_CLIENT_IDS_H_
6 #define GPU_IPC_COMMON_GPU_CLIENT_IDS_H_
7 
8 namespace gpu {
9 
10 // The list of client id constants used to identify unique GPU clients. In the
11 // general case, GPU clients are assigned unique IDs in the browser. But these
12 // special constants are used for particular clients that should always be
13 // assigned the same ID.
14 
15 // The ID used by the display compositor running in the GPU process.
16 constexpr int32_t kDisplayCompositorClientId = -1;
17 
18 // The ID used for storing shaders created by skia in the GPU process. Note that
19 // this ID doesn't correspond to a real Gpu client/channel, but is required so
20 // we can use the same disk caching system for shaders and use a unique
21 // namespace for these shaders.
22 constexpr int32_t kGrShaderCacheClientId = -2;
23 
24 // The ID used by PlatformVideoFramePool for video decoding buffer allocation
25 // in the GPU process. These are never accessed on the host side so we can use
26 // the same client ID for all clients.
27 constexpr int32_t kPlatformVideoFramePoolClientId = -3;
28 
IsReservedClientId(int32_t client_id)29 inline bool IsReservedClientId(int32_t client_id) {
30   return client_id < 0;
31 }
32 
33 }  // namespace gpu
34 
35 #endif  // GPU_IPC_COMMON_GPU_CLIENT_IDS_H_
36