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 "content/common/gpu/gpu_channel.h" | 9 #include "content/common/gpu/gpu_channel.h" |
10 #include "content/common/gpu/gpu_memory_buffer_factory.h" | 10 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
11 #include "content/common/gpu/gpu_memory_manager.h" | 11 #include "content/common/gpu/gpu_memory_manager.h" |
12 #include "content/common/gpu/gpu_messages.h" | 12 #include "content/common/gpu/gpu_messages.h" |
13 #include "content/common/message_router.h" | 13 #include "content/common/message_router.h" |
| 14 #include "gpu/command_buffer/common/value_state.h" |
14 #include "gpu/command_buffer/service/feature_info.h" | 15 #include "gpu/command_buffer/service/feature_info.h" |
15 #include "gpu/command_buffer/service/gpu_switches.h" | 16 #include "gpu/command_buffer/service/gpu_switches.h" |
16 #include "gpu/command_buffer/service/mailbox_manager_impl.h" | 17 #include "gpu/command_buffer/service/mailbox_manager_impl.h" |
17 #include "gpu/command_buffer/service/memory_program_cache.h" | 18 #include "gpu/command_buffer/service/memory_program_cache.h" |
18 #include "gpu/command_buffer/service/shader_translator_cache.h" | 19 #include "gpu/command_buffer/service/shader_translator_cache.h" |
19 #include "gpu/command_buffer/service/sync_point_manager.h" | 20 #include "gpu/command_buffer/service/sync_point_manager.h" |
20 #include "ipc/message_filter.h" | 21 #include "ipc/message_filter.h" |
21 #include "ui/gl/gl_bindings.h" | 22 #include "ui/gl/gl_bindings.h" |
22 #include "ui/gl/gl_share_group.h" | 23 #include "ui/gl/gl_share_group.h" |
23 #if defined(USE_OZONE) | 24 #if defined(USE_OZONE) |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 bool GpuChannelManager::OnMessageReceived(const IPC::Message& msg) { | 171 bool GpuChannelManager::OnMessageReceived(const IPC::Message& msg) { |
171 bool handled = true; | 172 bool handled = true; |
172 IPC_BEGIN_MESSAGE_MAP(GpuChannelManager, msg) | 173 IPC_BEGIN_MESSAGE_MAP(GpuChannelManager, msg) |
173 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) | 174 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) |
174 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) | 175 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) |
175 IPC_MESSAGE_HANDLER(GpuMsg_CreateViewCommandBuffer, | 176 IPC_MESSAGE_HANDLER(GpuMsg_CreateViewCommandBuffer, |
176 OnCreateViewCommandBuffer) | 177 OnCreateViewCommandBuffer) |
177 IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer) | 178 IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer) |
178 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader) | 179 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader) |
179 IPC_MESSAGE_HANDLER(GpuMsg_RelinquishResources, OnRelinquishResources) | 180 IPC_MESSAGE_HANDLER(GpuMsg_RelinquishResources, OnRelinquishResources) |
| 181 IPC_MESSAGE_HANDLER(GpuMsg_UpdateValueState, OnUpdateValueState) |
180 IPC_MESSAGE_UNHANDLED(handled = false) | 182 IPC_MESSAGE_UNHANDLED(handled = false) |
181 IPC_END_MESSAGE_MAP() | 183 IPC_END_MESSAGE_MAP() |
182 return handled; | 184 return handled; |
183 } | 185 } |
184 | 186 |
185 bool GpuChannelManager::Send(IPC::Message* msg) { return router_->Send(msg); } | 187 bool GpuChannelManager::Send(IPC::Message* msg) { return router_->Send(msg); } |
186 | 188 |
187 void GpuChannelManager::OnEstablishChannel(int client_id, | 189 void GpuChannelManager::OnEstablishChannel(int client_id, |
188 bool share_context, | 190 bool share_context, |
189 bool allow_future_sync_points) { | 191 bool allow_future_sync_points) { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 } else { | 281 } else { |
280 sync_point_manager()->AddSyncPointCallback( | 282 sync_point_manager()->AddSyncPointCallback( |
281 sync_point, | 283 sync_point, |
282 base::Bind(&GpuChannelManager::DestroyGpuMemoryBuffer, | 284 base::Bind(&GpuChannelManager::DestroyGpuMemoryBuffer, |
283 base::Unretained(this), | 285 base::Unretained(this), |
284 id, | 286 id, |
285 client_id)); | 287 client_id)); |
286 } | 288 } |
287 } | 289 } |
288 | 290 |
| 291 void GpuChannelManager::OnUpdateValueState( |
| 292 int client_id, unsigned int target, const gpu::ValueState& state) { |
| 293 // Only pass updated state to the channel corresponding to the |
| 294 // render_widget_host where the event originated. |
| 295 GpuChannelMap::const_iterator iter = gpu_channels_.find(client_id); |
| 296 if (iter != gpu_channels_.end()) { |
| 297 iter->second->HandleUpdateValueState(target, state); |
| 298 } |
| 299 } |
| 300 |
289 void GpuChannelManager::OnLoadedShader(std::string program_proto) { | 301 void GpuChannelManager::OnLoadedShader(std::string program_proto) { |
290 if (program_cache()) | 302 if (program_cache()) |
291 program_cache()->LoadProgram(program_proto); | 303 program_cache()->LoadProgram(program_proto); |
292 } | 304 } |
293 | 305 |
294 bool GpuChannelManager::HandleMessagesScheduled() { | 306 bool GpuChannelManager::HandleMessagesScheduled() { |
295 for (GpuChannelMap::iterator iter = gpu_channels_.begin(); | 307 for (GpuChannelMap::iterator iter = gpu_channels_.begin(); |
296 iter != gpu_channels_.end(); ++iter) { | 308 iter != gpu_channels_.end(); ++iter) { |
297 if (iter->second->handle_messages_scheduled()) | 309 if (iter->second->handle_messages_scheduled()) |
298 return true; | 310 return true; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 #else | 359 #else |
348 OnResourcesRelinquished(); | 360 OnResourcesRelinquished(); |
349 #endif | 361 #endif |
350 } | 362 } |
351 | 363 |
352 void GpuChannelManager::OnResourcesRelinquished() { | 364 void GpuChannelManager::OnResourcesRelinquished() { |
353 Send(new GpuHostMsg_ResourcesRelinquished()); | 365 Send(new GpuHostMsg_ResourcesRelinquished()); |
354 } | 366 } |
355 | 367 |
356 } // namespace content | 368 } // namespace content |
OLD | NEW |