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