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