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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 bool GpuChannelManager::OnMessageReceived(const IPC::Message& msg) { | 161 bool GpuChannelManager::OnMessageReceived(const IPC::Message& msg) { |
161 bool handled = true; | 162 bool handled = true; |
162 IPC_BEGIN_MESSAGE_MAP(GpuChannelManager, msg) | 163 IPC_BEGIN_MESSAGE_MAP(GpuChannelManager, msg) |
163 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) | 164 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) |
164 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) | 165 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) |
165 IPC_MESSAGE_HANDLER(GpuMsg_CreateViewCommandBuffer, | 166 IPC_MESSAGE_HANDLER(GpuMsg_CreateViewCommandBuffer, |
166 OnCreateViewCommandBuffer) | 167 OnCreateViewCommandBuffer) |
167 IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer) | 168 IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer) |
168 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader) | 169 IPC_MESSAGE_HANDLER(GpuMsg_LoadedShader, OnLoadedShader) |
169 IPC_MESSAGE_HANDLER(GpuMsg_RelinquishResources, OnRelinquishResources) | 170 IPC_MESSAGE_HANDLER(GpuMsg_RelinquishResources, OnRelinquishResources) |
| 171 IPC_MESSAGE_HANDLER(GpuMsg_UpdateValueState, OnUpdateValueState) |
170 IPC_MESSAGE_UNHANDLED(handled = false) | 172 IPC_MESSAGE_UNHANDLED(handled = false) |
171 IPC_END_MESSAGE_MAP() | 173 IPC_END_MESSAGE_MAP() |
172 return handled; | 174 return handled; |
173 } | 175 } |
174 | 176 |
175 bool GpuChannelManager::Send(IPC::Message* msg) { return router_->Send(msg); } | 177 bool GpuChannelManager::Send(IPC::Message* msg) { return router_->Send(msg); } |
176 | 178 |
177 void GpuChannelManager::OnEstablishChannel(int client_id, | 179 void GpuChannelManager::OnEstablishChannel(int client_id, |
178 bool share_context, | 180 bool share_context, |
179 bool allow_future_sync_points) { | 181 bool allow_future_sync_points) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 sync_point_manager()->AddSyncPointCallback( | 276 sync_point_manager()->AddSyncPointCallback( |
275 sync_point, | 277 sync_point, |
276 base::Bind(&GpuChannelManager::DestroyGpuMemoryBuffer, | 278 base::Bind(&GpuChannelManager::DestroyGpuMemoryBuffer, |
277 base::Unretained(this), | 279 base::Unretained(this), |
278 type, | 280 type, |
279 id, | 281 id, |
280 client_id)); | 282 client_id)); |
281 } | 283 } |
282 } | 284 } |
283 | 285 |
| 286 void GpuChannelManager::OnUpdateValueState( |
| 287 int client_id, unsigned int target, const gpu::ValueState& state) { |
| 288 // Only pass updated state to the channel corresponding to the |
| 289 // render_widget_host where the event originated. |
| 290 GpuChannelMap::const_iterator iter = gpu_channels_.find(client_id); |
| 291 if (iter != gpu_channels_.end()) { |
| 292 iter->second->HandleUpdateValueState(target, state); |
| 293 } |
| 294 } |
| 295 |
284 void GpuChannelManager::OnLoadedShader(std::string program_proto) { | 296 void GpuChannelManager::OnLoadedShader(std::string program_proto) { |
285 if (program_cache()) | 297 if (program_cache()) |
286 program_cache()->LoadProgram(program_proto); | 298 program_cache()->LoadProgram(program_proto); |
287 } | 299 } |
288 | 300 |
289 bool GpuChannelManager::HandleMessagesScheduled() { | 301 bool GpuChannelManager::HandleMessagesScheduled() { |
290 for (GpuChannelMap::iterator iter = gpu_channels_.begin(); | 302 for (GpuChannelMap::iterator iter = gpu_channels_.begin(); |
291 iter != gpu_channels_.end(); ++iter) { | 303 iter != gpu_channels_.end(); ++iter) { |
292 if (iter->second->handle_messages_scheduled()) | 304 if (iter->second->handle_messages_scheduled()) |
293 return true; | 305 return true; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 #else | 354 #else |
343 OnResourcesRelinquished(); | 355 OnResourcesRelinquished(); |
344 #endif | 356 #endif |
345 } | 357 } |
346 | 358 |
347 void GpuChannelManager::OnResourcesRelinquished() { | 359 void GpuChannelManager::OnResourcesRelinquished() { |
348 Send(new GpuHostMsg_ResourcesRelinquished()); | 360 Send(new GpuHostMsg_ResourcesRelinquished()); |
349 } | 361 } |
350 | 362 |
351 } // namespace content | 363 } // namespace content |
OLD | NEW |