OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "content/common/gpu/gpu_channel_manager.h" | 5 #include "content/common/gpu/gpu_channel_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 return iter->second; | 110 return iter->second; |
111 } | 111 } |
112 | 112 |
113 bool GpuChannelManager::OnMessageReceived(const IPC::Message& msg) { | 113 bool GpuChannelManager::OnMessageReceived(const IPC::Message& msg) { |
114 bool handled = true; | 114 bool handled = true; |
115 IPC_BEGIN_MESSAGE_MAP(GpuChannelManager, msg) | 115 IPC_BEGIN_MESSAGE_MAP(GpuChannelManager, msg) |
116 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) | 116 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) |
117 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) | 117 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) |
118 IPC_MESSAGE_HANDLER(GpuMsg_CreateViewCommandBuffer, | 118 IPC_MESSAGE_HANDLER(GpuMsg_CreateViewCommandBuffer, |
119 OnCreateViewCommandBuffer) | 119 OnCreateViewCommandBuffer) |
| 120 IPC_MESSAGE_HANDLER(GpuMsg_CreateStreamTexture, OnCreateStreamTexture) |
120 IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer) | 121 IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer) |
121 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader) | 122 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader) |
122 IPC_MESSAGE_HANDLER(GpuMsg_RelinquishResources, OnRelinquishResources) | 123 IPC_MESSAGE_HANDLER(GpuMsg_RelinquishResources, OnRelinquishResources) |
123 IPC_MESSAGE_HANDLER(GpuMsg_UpdateValueState, OnUpdateValueState) | 124 IPC_MESSAGE_HANDLER(GpuMsg_UpdateValueState, OnUpdateValueState) |
124 IPC_MESSAGE_UNHANDLED(handled = false) | 125 IPC_MESSAGE_UNHANDLED(handled = false) |
125 IPC_END_MESSAGE_MAP() | 126 IPC_END_MESSAGE_MAP() |
126 return handled; | 127 return handled; |
127 } | 128 } |
128 | 129 |
129 bool GpuChannelManager::Send(IPC::Message* msg) { return router_->Send(msg); } | 130 bool GpuChannelManager::Send(IPC::Message* msg) { return router_->Send(msg); } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 192 |
192 GpuChannelMap::const_iterator iter = gpu_channels_.find(client_id); | 193 GpuChannelMap::const_iterator iter = gpu_channels_.find(client_id); |
193 if (iter != gpu_channels_.end()) { | 194 if (iter != gpu_channels_.end()) { |
194 result = iter->second->CreateViewCommandBuffer( | 195 result = iter->second->CreateViewCommandBuffer( |
195 window, surface_id, init_params, route_id); | 196 window, surface_id, init_params, route_id); |
196 } | 197 } |
197 | 198 |
198 Send(new GpuHostMsg_CommandBufferCreated(result)); | 199 Send(new GpuHostMsg_CommandBufferCreated(result)); |
199 } | 200 } |
200 | 201 |
| 202 void GpuChannelManager::OnCreateStreamTexture(int32 image_id, |
| 203 int32 client_id, |
| 204 int32 route_id, |
| 205 int32 stream_id) { |
| 206 bool result = false; |
| 207 GpuChannelMap::const_iterator iter = gpu_channels_.find(client_id); |
| 208 if (iter != gpu_channels_.end()) { |
| 209 result = iter->second->CreateStreamTexture(image_id, route_id, stream_id); |
| 210 } |
| 211 |
| 212 Send(new GpuHostMsg_StreamTextureCreated(result)); |
| 213 } |
| 214 |
201 void GpuChannelManager::DestroyGpuMemoryBuffer( | 215 void GpuChannelManager::DestroyGpuMemoryBuffer( |
202 gfx::GpuMemoryBufferId id, | 216 gfx::GpuMemoryBufferId id, |
203 int client_id) { | 217 int client_id) { |
204 io_task_runner_->PostTask( | 218 io_task_runner_->PostTask( |
205 FROM_HERE, base::Bind(&GpuChannelManager::DestroyGpuMemoryBufferOnIO, | 219 FROM_HERE, base::Bind(&GpuChannelManager::DestroyGpuMemoryBufferOnIO, |
206 base::Unretained(this), id, client_id)); | 220 base::Unretained(this), id, client_id)); |
207 } | 221 } |
208 | 222 |
209 void GpuChannelManager::DestroyGpuMemoryBufferOnIO( | 223 void GpuChannelManager::DestroyGpuMemoryBufferOnIO( |
210 gfx::GpuMemoryBufferId id, | 224 gfx::GpuMemoryBufferId id, |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 OnResourcesRelinquished(); | 321 OnResourcesRelinquished(); |
308 #endif | 322 #endif |
309 } | 323 } |
310 } | 324 } |
311 | 325 |
312 void GpuChannelManager::OnResourcesRelinquished() { | 326 void GpuChannelManager::OnResourcesRelinquished() { |
313 Send(new GpuHostMsg_ResourcesRelinquished()); | 327 Send(new GpuHostMsg_ResourcesRelinquished()); |
314 } | 328 } |
315 | 329 |
316 } // namespace content | 330 } // namespace content |
OLD | NEW |