OLD | NEW |
| (Empty) |
1 // Copyright 2016 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_SERVICE_GPU_CHANNEL_MANAGER_DELEGATE_H_ | |
6 #define GPU_IPC_SERVICE_GPU_CHANNEL_MANAGER_DELEGATE_H_ | |
7 | |
8 #include "gpu/command_buffer/common/constants.h" | |
9 #include "gpu/ipc/common/surface_handle.h" | |
10 | |
11 #if defined(OS_MACOSX) | |
12 #include "ui/base/cocoa/remote_layer_api.h" | |
13 #include "ui/events/latency_info.h" | |
14 #include "ui/gfx/mac/io_surface.h" | |
15 #endif | |
16 | |
17 class GURL; | |
18 | |
19 namespace IPC { | |
20 struct ChannelHandle; | |
21 } | |
22 | |
23 namespace gpu { | |
24 | |
25 struct GPUMemoryUmaStats; | |
26 | |
27 class GpuChannelManagerDelegate { | |
28 public: | |
29 // Tells the delegate that a context has subscribed to a new target and | |
30 // the browser should start sending the corresponding information | |
31 virtual void AddSubscription(int32_t client_id, unsigned int target) = 0; | |
32 | |
33 // Tells the delegate that an offscreen context was created for the provided | |
34 // |active_url|. | |
35 virtual void DidCreateOffscreenContext(const GURL& active_url) = 0; | |
36 | |
37 // Notification from GPU that the channel is destroyed. | |
38 virtual void DidDestroyChannel(int client_id) = 0; | |
39 | |
40 // Tells the delegate that an offscreen context was destroyed for the provided | |
41 // |active_url|. | |
42 virtual void DidDestroyOffscreenContext(const GURL& active_url) = 0; | |
43 | |
44 // Tells the delegate that a context was lost. | |
45 virtual void DidLoseContext(bool offscreen, | |
46 error::ContextLostReason reason, | |
47 const GURL& active_url) = 0; | |
48 | |
49 // Tells the delegate about GPU memory usage statistics for UMA logging. | |
50 virtual void GpuMemoryUmaStats(const GPUMemoryUmaStats& params) = 0; | |
51 | |
52 // Tells the delegate that no contexts are subscribed to the target anymore | |
53 // so the delegate should stop sending the corresponding information. | |
54 virtual void RemoveSubscription(int32_t client_id, unsigned int target) = 0; | |
55 | |
56 // Tells the delegate to cache the given shader information in persistent | |
57 // storage. The embedder is expected to repopulate the in-memory cache through | |
58 // the respective GpuChannelManager API. | |
59 virtual void StoreShaderToDisk(int32_t client_id, | |
60 const std::string& key, | |
61 const std::string& shader) = 0; | |
62 | |
63 #if defined(OS_MACOSX) | |
64 // Tells the delegate that an accelerated surface has swapped. | |
65 virtual void SendAcceleratedSurfaceBuffersSwapped( | |
66 int32_t surface_id, | |
67 CAContextID ca_context_id, | |
68 const gfx::ScopedRefCountedIOSurfaceMachPort& io_surface, | |
69 const gfx::Size& size, | |
70 float scale_factor, | |
71 std::vector<ui::LatencyInfo> latency_info) = 0; | |
72 #endif | |
73 | |
74 #if defined(OS_WIN) | |
75 virtual void SendAcceleratedSurfaceCreatedChildWindow( | |
76 SurfaceHandle parent_window, | |
77 SurfaceHandle child_window) = 0; | |
78 #endif | |
79 | |
80 // Sets the currently active URL. Use GURL() to clear the URL. | |
81 virtual void SetActiveURL(const GURL& url) = 0; | |
82 | |
83 protected: | |
84 virtual ~GpuChannelManagerDelegate() {} | |
85 }; | |
86 | |
87 } // namespace gpu | |
88 | |
89 #endif // GPU_IPC_SERVICE_GPU_CHANNEL_MANAGER_DELEGATE_H_ | |
OLD | NEW |