Chromium Code Reviews| 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/child_process_host_impl.h" | 5 #include "content/common/child_process_host_impl.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 | 249 |
| 250 if (!handled) { | 250 if (!handled) { |
| 251 handled = true; | 251 handled = true; |
| 252 IPC_BEGIN_MESSAGE_MAP(ChildProcessHostImpl, msg) | 252 IPC_BEGIN_MESSAGE_MAP(ChildProcessHostImpl, msg) |
| 253 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest, | 253 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest, |
| 254 OnShutdownRequest) | 254 OnShutdownRequest) |
| 255 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_SyncAllocateSharedMemory, | 255 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_SyncAllocateSharedMemory, |
| 256 OnAllocateSharedMemory) | 256 OnAllocateSharedMemory) |
| 257 IPC_MESSAGE_HANDLER_DELAY_REPLY( | 257 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer, |
| 258 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer, | 258 OnAllocateGpuMemoryBuffer) |
| 259 OnAllocateGpuMemoryBuffer) | |
| 260 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DeletedGpuMemoryBuffer, | 259 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DeletedGpuMemoryBuffer, |
| 261 OnDeletedGpuMemoryBuffer) | 260 OnDeletedGpuMemoryBuffer) |
| 262 IPC_MESSAGE_UNHANDLED(handled = false) | 261 IPC_MESSAGE_UNHANDLED(handled = false) |
| 263 IPC_END_MESSAGE_MAP() | 262 IPC_END_MESSAGE_MAP() |
| 264 | 263 |
| 265 if (!handled) | 264 if (!handled) |
| 266 handled = delegate_->OnMessageReceived(msg); | 265 handled = delegate_->OnMessageReceived(msg); |
| 267 } | 266 } |
| 268 | 267 |
| 269 #ifdef IPC_MESSAGE_LOG_ENABLED | 268 #ifdef IPC_MESSAGE_LOG_ENABLED |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 310 void ChildProcessHostImpl::OnShutdownRequest() { | 309 void ChildProcessHostImpl::OnShutdownRequest() { |
| 311 if (delegate_->CanShutdown()) | 310 if (delegate_->CanShutdown()) |
| 312 Send(new ChildProcessMsg_Shutdown()); | 311 Send(new ChildProcessMsg_Shutdown()); |
| 313 } | 312 } |
| 314 | 313 |
| 315 void ChildProcessHostImpl::OnAllocateGpuMemoryBuffer( | 314 void ChildProcessHostImpl::OnAllocateGpuMemoryBuffer( |
| 316 uint32 width, | 315 uint32 width, |
| 317 uint32 height, | 316 uint32 height, |
| 318 gfx::GpuMemoryBuffer::Format format, | 317 gfx::GpuMemoryBuffer::Format format, |
| 319 gfx::GpuMemoryBuffer::Usage usage, | 318 gfx::GpuMemoryBuffer::Usage usage, |
| 320 IPC::Message* reply) { | 319 gfx::GpuMemoryBufferHandle* handle) { |
| 321 // TODO(reveman): Add support for other types of GpuMemoryBuffers. | 320 // TODO(reveman): Add support for other types of GpuMemoryBuffers. |
|
reveman
2015/03/25 20:57:31
FYI, I'll have to change it back to _DELAY_REPLY w
jam
2015/03/25 22:26:14
oh if you're going to change this, i can close thi
| |
| 322 | 321 |
| 323 gfx::GpuMemoryBufferHandle handle; | |
| 324 // AllocateForChildProcess() will check if |width| and |height| are valid | 322 // AllocateForChildProcess() will check if |width| and |height| are valid |
| 325 // and handle failure in a controlled way when not. We just need to make | 323 // and handle failure in a controlled way when not. We just need to make |
| 326 // sure |format| and |usage| are supported here. | 324 // sure |format| and |usage| are supported here. |
| 327 if (GpuMemoryBufferImplSharedMemory::IsFormatSupported(format) && | 325 if (GpuMemoryBufferImplSharedMemory::IsFormatSupported(format) && |
| 328 usage == gfx::GpuMemoryBuffer::MAP) { | 326 usage == gfx::GpuMemoryBuffer::MAP) { |
| 329 handle = GpuMemoryBufferImplSharedMemory::AllocateForChildProcess( | 327 *handle = GpuMemoryBufferImplSharedMemory::AllocateForChildProcess( |
| 330 g_next_gpu_memory_buffer_id.GetNext(), | 328 g_next_gpu_memory_buffer_id.GetNext(), |
| 331 gfx::Size(width, height), | 329 gfx::Size(width, height), |
| 332 format, | 330 format, |
| 333 peer_process_.Handle()); | 331 peer_process_.Handle()); |
| 334 } | 332 } |
| 335 | |
| 336 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply, | |
| 337 handle); | |
| 338 Send(reply); | |
| 339 } | 333 } |
| 340 | 334 |
| 341 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer( | 335 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer( |
| 342 gfx::GpuMemoryBufferId id, | 336 gfx::GpuMemoryBufferId id, |
| 343 uint32 sync_point) { | 337 uint32 sync_point) { |
| 344 // Note: Nothing to do here as ownership of shared memory backed | 338 // Note: Nothing to do here as ownership of shared memory backed |
| 345 // GpuMemoryBuffers is passed with IPC. | 339 // GpuMemoryBuffers is passed with IPC. |
| 346 } | 340 } |
| 347 | 341 |
| 348 } // namespace content | 342 } // namespace content |
| OLD | NEW |