Chromium Code Reviews| Index: content/common/gpu/gpu_channel_manager.cc |
| diff --git a/content/common/gpu/gpu_channel_manager.cc b/content/common/gpu/gpu_channel_manager.cc |
| index 1da6aecf2f3c82608fc57654592fc22c5d557c85..9fed03a8a629dd7f2d14dfc6eb512dee389cc867 100644 |
| --- a/content/common/gpu/gpu_channel_manager.cc |
| +++ b/content/common/gpu/gpu_channel_manager.cc |
| @@ -30,7 +30,8 @@ GpuChannelManager::GpuChannelManager(ChildThread* gpu_child_thread, |
| GpuMemoryManager::kDefaultMaxSurfacesWithFrontbufferSoftLimit)), |
| watchdog_(watchdog), |
| sync_point_manager_(new SyncPointManager), |
| - program_cache_(NULL) { |
| + program_cache_(NULL), |
| + image_sync_point_(0) { |
| DCHECK(gpu_child_thread); |
| DCHECK(io_message_loop); |
| DCHECK(shutdown_event); |
| @@ -95,6 +96,8 @@ bool GpuChannelManager::OnMessageReceived(const IPC::Message& msg) { |
| IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) |
| IPC_MESSAGE_HANDLER(GpuMsg_CreateViewCommandBuffer, |
| OnCreateViewCommandBuffer) |
| + IPC_MESSAGE_HANDLER(GpuMsg_CreateImage, OnCreateImage) |
| + IPC_MESSAGE_HANDLER(GpuMsg_DeleteImage, OnDeleteImage) |
| IPC_MESSAGE_UNHANDLED(handled = false) |
| IPC_END_MESSAGE_MAP_EX() |
| return handled; |
| @@ -169,6 +172,67 @@ void GpuChannelManager::OnCreateViewCommandBuffer( |
| Send(new GpuHostMsg_CommandBufferCreated(route_id)); |
| } |
| +void GpuChannelManager::OnCreateImageSyncPointRetired( |
| + gfx::PluginWindowHandle window, |
| + int32 client_id, |
| + int32 image_id) { |
| + gfx::Size size; |
| + |
| + GpuChannelMap::const_iterator iter = gpu_channels_.find(client_id); |
| + if (iter != gpu_channels_.end()) { |
| + iter->second->CreateImage(window, image_id, &size); |
| + } |
| + |
| + Send(new GpuHostMsg_ImageCreated(size)); |
| +} |
| + |
| +void GpuChannelManager::OnCreateImage( |
| + gfx::PluginWindowHandle window, |
| + int32 client_id, |
| + int32 image_id) { |
| + DCHECK(image_id); |
| + |
| + if (image_sync_point_) |
|
piman
2012/10/13 18:00:38
I'm not convinced :)
It's possible - at least in t
reveman
2012/10/17 07:37:11
Latest patch puts all image ops in a queue and pop
|
| + sync_point_manager()->AddSyncPointCallback( |
| + image_sync_point_, |
| + base::Bind(&GpuChannelManager::OnCreateImageSyncPointRetired, |
| + base::Unretained(this), |
| + window, |
| + client_id, |
| + image_id)); |
| + else |
| + OnCreateImageSyncPointRetired(window, client_id, image_id); |
| +} |
| + |
| +void GpuChannelManager::OnDeleteImageSyncPointRetired( |
| + int32 client_id, |
| + int32 image_id) { |
| + GpuChannelMap::const_iterator iter = gpu_channels_.find(client_id); |
| + if (iter != gpu_channels_.end()) { |
| + iter->second->DeleteImage(image_id); |
| + } |
| +} |
| + |
| +void GpuChannelManager::OnDeleteImage( |
| + int32 client_id, |
| + int32 image_id, |
| + int32 sync_point) { |
| + DCHECK(image_id); |
| + |
| + if (sync_point) |
| + image_sync_point_ = sync_point; |
| + |
| + if (image_sync_point_) |
|
piman
2012/10/13 18:00:38
nit: style requires braces (on both clauses) when
reveman
2012/10/17 07:37:11
Done.
|
| + sync_point_manager()->AddSyncPointCallback( |
| + sync_point, |
| + base::Bind(&GpuChannelManager::OnDeleteImageSyncPointRetired, |
| + base::Unretained(this), |
| + client_id, |
| + image_id)); |
| + else |
| + OnDeleteImageSyncPointRetired(client_id, image_id); |
| +} |
| + |
| void GpuChannelManager::LoseAllContexts() { |
| MessageLoop::current()->PostTask( |
| FROM_HERE, |