OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_H_ | 5 #ifndef CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/id_map.h" | 13 #include "base/id_map.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/process.h" | 15 #include "base/process.h" |
16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
17 #include "content/common/gpu/gpu_command_buffer_stub.h" | 17 #include "content/common/gpu/gpu_command_buffer_stub.h" |
| 18 #include "content/common/gpu/gpu_surface_stub.h" |
18 #include "content/common/message_router.h" | 19 #include "content/common/message_router.h" |
19 #include "ipc/ipc_sync_channel.h" | 20 #include "ipc/ipc_sync_channel.h" |
20 #include "ui/gfx/native_widget_types.h" | 21 #include "ui/gfx/native_widget_types.h" |
21 #include "ui/gfx/size.h" | 22 #include "ui/gfx/size.h" |
22 | 23 |
23 class GpuChannelManager; | 24 class GpuChannelManager; |
24 struct GPUCreateCommandBufferConfig; | 25 struct GPUCreateCommandBufferConfig; |
25 class GpuWatchdog; | 26 class GpuWatchdog; |
26 class TransportTexture; | 27 class TransportTexture; |
27 | 28 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 // Message handlers. | 106 // Message handlers. |
106 void OnInitialize(base::ProcessHandle renderer_process); | 107 void OnInitialize(base::ProcessHandle renderer_process); |
107 void OnCreateOffscreenCommandBuffer( | 108 void OnCreateOffscreenCommandBuffer( |
108 int32 parent_route_id, | 109 int32 parent_route_id, |
109 const gfx::Size& size, | 110 const gfx::Size& size, |
110 const GPUCreateCommandBufferConfig& init_params, | 111 const GPUCreateCommandBufferConfig& init_params, |
111 uint32 parent_texture_id, | 112 uint32 parent_texture_id, |
112 int32* route_id); | 113 int32* route_id); |
113 void OnDestroyCommandBuffer(int32 route_id); | 114 void OnDestroyCommandBuffer(int32 route_id); |
114 | 115 |
| 116 void OnCreateOffscreenSurface(const gfx::Size& size, |
| 117 int* route_id); |
| 118 void OnDestroySurface(int route_id); |
| 119 |
115 void OnCreateVideoDecoder(int32 decoder_host_id, | 120 void OnCreateVideoDecoder(int32 decoder_host_id, |
116 const std::vector<uint32>& configs); | 121 const std::vector<uint32>& configs); |
117 void OnDestroyVideoDecoder(int32 decoder_id); | 122 void OnDestroyVideoDecoder(int32 decoder_id); |
118 void OnCreateTransportTexture(int32 context_route_id, int32 host_id); | 123 void OnCreateTransportTexture(int32 context_route_id, int32 host_id); |
119 | 124 |
120 // The lifetime of objects of this class is managed by a GpuChannelManager. | 125 // The lifetime of objects of this class is managed by a GpuChannelManager. |
121 // The GpuChannelManager destroy all the GpuChannels that they own when they | 126 // The GpuChannelManager destroy all the GpuChannels that they own when they |
122 // are destroyed. So a raw pointer is safe. | 127 // are destroyed. So a raw pointer is safe. |
123 GpuChannelManager* gpu_channel_manager_; | 128 GpuChannelManager* gpu_channel_manager_; |
124 | 129 |
125 scoped_ptr<IPC::SyncChannel> channel_; | 130 scoped_ptr<IPC::SyncChannel> channel_; |
126 | 131 |
127 // The id of the renderer who is on the other side of the channel. | 132 // The id of the renderer who is on the other side of the channel. |
128 int renderer_id_; | 133 int renderer_id_; |
129 | 134 |
130 // Handle to the renderer process that is on the other side of the channel. | 135 // Handle to the renderer process that is on the other side of the channel. |
131 base::ProcessHandle renderer_process_; | 136 base::ProcessHandle renderer_process_; |
132 | 137 |
133 // The process id of the renderer process. | 138 // The process id of the renderer process. |
134 base::ProcessId renderer_pid_; | 139 base::ProcessId renderer_pid_; |
135 | 140 |
136 // Used to implement message routing functionality to CommandBuffer objects | 141 // Used to implement message routing functionality to CommandBuffer objects |
137 MessageRouter router_; | 142 MessageRouter router_; |
138 | 143 |
139 #if defined(ENABLE_GPU) | 144 #if defined(ENABLE_GPU) |
140 typedef IDMap<GpuCommandBufferStub, IDMapOwnPointer> StubMap; | 145 typedef IDMap<GpuCommandBufferStub, IDMapOwnPointer> StubMap; |
141 StubMap stubs_; | 146 StubMap stubs_; |
| 147 |
| 148 typedef IDMap<GpuSurfaceStub, IDMapOwnPointer> SurfaceMap; |
| 149 SurfaceMap surfaces_; |
| 150 |
142 std::set<int32> latched_routes_; | 151 std::set<int32> latched_routes_; |
143 #endif // defined (ENABLE_GPU) | 152 #endif // defined (ENABLE_GPU) |
144 | 153 |
145 // A collection of transport textures created. | 154 // A collection of transport textures created. |
146 typedef IDMap<TransportTexture, IDMapOwnPointer> TransportTextureMap; | 155 typedef IDMap<TransportTexture, IDMapOwnPointer> TransportTextureMap; |
147 TransportTextureMap transport_textures_; | 156 TransportTextureMap transport_textures_; |
148 | 157 |
149 bool log_messages_; // True if we should log sent and received messages. | 158 bool log_messages_; // True if we should log sent and received messages. |
150 gpu::gles2::DisallowedExtensions disallowed_extensions_; | 159 gpu::gles2::DisallowedExtensions disallowed_extensions_; |
151 GpuWatchdog* watchdog_; | 160 GpuWatchdog* watchdog_; |
152 | 161 |
153 DISALLOW_COPY_AND_ASSIGN(GpuChannel); | 162 DISALLOW_COPY_AND_ASSIGN(GpuChannel); |
154 }; | 163 }; |
155 | 164 |
156 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 165 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
OLD | NEW |