| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 } | 246 } |
| 247 } | 247 } |
| 248 | 248 |
| 249 if (!handled) { | 249 if (!handled) { |
| 250 handled = true; | 250 handled = true; |
| 251 IPC_BEGIN_MESSAGE_MAP(ChildProcessHostImpl, msg) | 251 IPC_BEGIN_MESSAGE_MAP(ChildProcessHostImpl, msg) |
| 252 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest, | 252 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest, |
| 253 OnShutdownRequest) | 253 OnShutdownRequest) |
| 254 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_SyncAllocateSharedMemory, | 254 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_SyncAllocateSharedMemory, |
| 255 OnAllocateSharedMemory) | 255 OnAllocateSharedMemory) |
| 256 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer, | |
| 257 OnAllocateGpuMemoryBuffer) | |
| 258 IPC_MESSAGE_UNHANDLED(handled = false) | 256 IPC_MESSAGE_UNHANDLED(handled = false) |
| 259 IPC_END_MESSAGE_MAP() | 257 IPC_END_MESSAGE_MAP() |
| 260 | 258 |
| 261 if (!handled) | 259 if (!handled) |
| 262 handled = delegate_->OnMessageReceived(msg); | 260 handled = delegate_->OnMessageReceived(msg); |
| 263 } | 261 } |
| 264 | 262 |
| 265 #ifdef IPC_MESSAGE_LOG_ENABLED | 263 #ifdef IPC_MESSAGE_LOG_ENABLED |
| 266 if (logger->Enabled()) | 264 if (logger->Enabled()) |
| 267 logger->OnPostDispatchMessage(msg, channel_id_); | 265 logger->OnPostDispatchMessage(msg, channel_id_); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 uint32 buffer_size, | 298 uint32 buffer_size, |
| 301 base::SharedMemoryHandle* handle) { | 299 base::SharedMemoryHandle* handle) { |
| 302 AllocateSharedMemory(buffer_size, peer_handle_, handle); | 300 AllocateSharedMemory(buffer_size, peer_handle_, handle); |
| 303 } | 301 } |
| 304 | 302 |
| 305 void ChildProcessHostImpl::OnShutdownRequest() { | 303 void ChildProcessHostImpl::OnShutdownRequest() { |
| 306 if (delegate_->CanShutdown()) | 304 if (delegate_->CanShutdown()) |
| 307 Send(new ChildProcessMsg_Shutdown()); | 305 Send(new ChildProcessMsg_Shutdown()); |
| 308 } | 306 } |
| 309 | 307 |
| 310 void ChildProcessHostImpl::OnAllocateGpuMemoryBuffer( | |
| 311 uint32 width, | |
| 312 uint32 height, | |
| 313 uint32 internalformat, | |
| 314 uint32 usage, | |
| 315 gfx::GpuMemoryBufferHandle* handle) { | |
| 316 handle->type = gfx::SHARED_MEMORY_BUFFER; | |
| 317 AllocateSharedMemory( | |
| 318 width * height * GpuMemoryBufferImpl::BytesPerPixel(internalformat), | |
| 319 peer_handle_, | |
| 320 &handle->handle); | |
| 321 } | |
| 322 | |
| 323 } // namespace content | 308 } // namespace content |
| OLD | NEW |