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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 .Append(kMacOSName) | 80 .Append(kMacOSName) |
81 .Append(new_basename); | 81 .Append(new_basename); |
82 | 82 |
83 return new_path; | 83 return new_path; |
84 } | 84 } |
85 #endif // OS_MACOSX | 85 #endif // OS_MACOSX |
86 | 86 |
87 // Global atomic to generate child process unique IDs. | 87 // Global atomic to generate child process unique IDs. |
88 base::StaticAtomicSequenceNumber g_unique_id; | 88 base::StaticAtomicSequenceNumber g_unique_id; |
89 | 89 |
90 // Global atomic to generate gpu memory buffer unique IDs. | |
91 base::StaticAtomicSequenceNumber g_next_gpu_memory_buffer_id; | |
92 | |
93 } // namespace | 90 } // namespace |
94 | 91 |
95 namespace content { | 92 namespace content { |
96 | 93 |
97 int ChildProcessHost::kInvalidUniqueID = -1; | 94 int ChildProcessHost::kInvalidUniqueID = -1; |
98 | 95 |
99 uint64 ChildProcessHost::kBrowserTracingProcessId = | 96 uint64 ChildProcessHost::kBrowserTracingProcessId = |
100 std::numeric_limits<uint64>::max(); | 97 std::numeric_limits<uint64>::max(); |
101 | 98 |
102 // static | 99 // static |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 base::SharedMemoryHandle* handle) { | 348 base::SharedMemoryHandle* handle) { |
352 AllocateSharedMemory(buffer_size, peer_process_.Handle(), handle); | 349 AllocateSharedMemory(buffer_size, peer_process_.Handle(), handle); |
353 } | 350 } |
354 | 351 |
355 void ChildProcessHostImpl::OnShutdownRequest() { | 352 void ChildProcessHostImpl::OnShutdownRequest() { |
356 if (delegate_->CanShutdown()) | 353 if (delegate_->CanShutdown()) |
357 Send(new ChildProcessMsg_Shutdown()); | 354 Send(new ChildProcessMsg_Shutdown()); |
358 } | 355 } |
359 | 356 |
360 void ChildProcessHostImpl::OnAllocateGpuMemoryBuffer( | 357 void ChildProcessHostImpl::OnAllocateGpuMemoryBuffer( |
| 358 gfx::GpuMemoryBufferId id, |
361 uint32 width, | 359 uint32 width, |
362 uint32 height, | 360 uint32 height, |
363 gfx::BufferFormat format, | 361 gfx::BufferFormat format, |
364 gfx::BufferUsage usage, | 362 gfx::BufferUsage usage, |
365 gfx::GpuMemoryBufferHandle* handle) { | 363 gfx::GpuMemoryBufferHandle* handle) { |
366 // TODO(reveman): Add support for other types of GpuMemoryBuffers. | 364 // TODO(reveman): Add support for other types of GpuMemoryBuffers. |
367 | 365 |
368 // AllocateForChildProcess() will check if |width| and |height| are valid | 366 // AllocateForChildProcess() will check if |width| and |height| are valid |
369 // and handle failure in a controlled way when not. We just need to make | 367 // and handle failure in a controlled way when not. We just need to make |
370 // sure |format| and |usage| are supported here. | 368 // sure |format| and |usage| are supported here. |
371 if (GpuMemoryBufferImplSharedMemory::IsFormatSupported(format) && | 369 if (GpuMemoryBufferImplSharedMemory::IsFormatSupported(format) && |
372 GpuMemoryBufferImplSharedMemory::IsUsageSupported(usage)) { | 370 GpuMemoryBufferImplSharedMemory::IsUsageSupported(usage)) { |
373 *handle = GpuMemoryBufferImplSharedMemory::AllocateForChildProcess( | 371 *handle = GpuMemoryBufferImplSharedMemory::AllocateForChildProcess( |
374 g_next_gpu_memory_buffer_id.GetNext(), gfx::Size(width, height), format, | 372 id, gfx::Size(width, height), format, peer_process_.Handle()); |
375 peer_process_.Handle()); | |
376 } | 373 } |
377 } | 374 } |
378 | 375 |
379 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer( | 376 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer( |
380 gfx::GpuMemoryBufferId id, | 377 gfx::GpuMemoryBufferId id, |
381 uint32 sync_point) { | 378 uint32 sync_point) { |
382 // Note: Nothing to do here as ownership of shared memory backed | 379 // Note: Nothing to do here as ownership of shared memory backed |
383 // GpuMemoryBuffers is passed with IPC. | 380 // GpuMemoryBuffers is passed with IPC. |
384 } | 381 } |
385 | 382 |
386 } // namespace content | 383 } // namespace content |
OLD | NEW |