Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: content/common/child_process_host_impl.cc

Issue 685983005: gpu: Associate all GpuMemoryBuffers with unique IDs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: one more ozone build fix Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/common/child_process_host_impl.h ('k') | content/common/child_process_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 .Append(kMacOSName) 72 .Append(kMacOSName)
73 .Append(new_basename); 73 .Append(new_basename);
74 74
75 return new_path; 75 return new_path;
76 } 76 }
77 #endif // OS_MACOSX 77 #endif // OS_MACOSX
78 78
79 // Global atomic to generate child process unique IDs. 79 // Global atomic to generate child process unique IDs.
80 base::StaticAtomicSequenceNumber g_unique_id; 80 base::StaticAtomicSequenceNumber g_unique_id;
81 81
82 // Global atomic to generate gpu memory buffer unique IDs.
83 base::StaticAtomicSequenceNumber g_next_gpu_memory_buffer_id;
84
82 } // namespace 85 } // namespace
83 86
84 namespace content { 87 namespace content {
85 88
86 int ChildProcessHost::kInvalidUniqueID = -1; 89 int ChildProcessHost::kInvalidUniqueID = -1;
87 90
88 // static 91 // static
89 ChildProcessHost* ChildProcessHost::Create(ChildProcessHostDelegate* delegate) { 92 ChildProcessHost* ChildProcessHost::Create(ChildProcessHostDelegate* delegate) {
90 return new ChildProcessHostImpl(delegate); 93 return new ChildProcessHostImpl(delegate);
91 } 94 }
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 // TODO(reveman): Add support for other types of GpuMemoryBuffers. 330 // TODO(reveman): Add support for other types of GpuMemoryBuffers.
328 if (!GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( 331 if (!GpuMemoryBufferImplSharedMemory::IsConfigurationSupported(
329 gfx::Size(width, height), format, usage)) { 332 gfx::Size(width, height), format, usage)) {
330 GpuMemoryBufferAllocated(reply, gfx::GpuMemoryBufferHandle()); 333 GpuMemoryBufferAllocated(reply, gfx::GpuMemoryBufferHandle());
331 return; 334 return;
332 } 335 }
333 336
334 // Note: It is safe to use base::Unretained here as the shared memory 337 // Note: It is safe to use base::Unretained here as the shared memory
335 // implementation of AllocateForChildProcess() calls this synchronously. 338 // implementation of AllocateForChildProcess() calls this synchronously.
336 GpuMemoryBufferImplSharedMemory::AllocateForChildProcess( 339 GpuMemoryBufferImplSharedMemory::AllocateForChildProcess(
340 g_next_gpu_memory_buffer_id.GetNext(),
337 gfx::Size(width, height), 341 gfx::Size(width, height),
338 format, 342 format,
339 peer_handle_, 343 peer_handle_,
340 base::Bind(&ChildProcessHostImpl::GpuMemoryBufferAllocated, 344 base::Bind(&ChildProcessHostImpl::GpuMemoryBufferAllocated,
341 base::Unretained(this), 345 base::Unretained(this),
342 reply)); 346 reply));
343 } 347 }
344 348
345 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer( 349 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer(
346 gfx::GpuMemoryBufferType type, 350 gfx::GpuMemoryBufferType type,
347 const gfx::GpuMemoryBufferId& id, 351 gfx::GpuMemoryBufferId id,
348 uint32 sync_point) { 352 uint32 sync_point) {
349 // Note: Nothing to do here as ownership of shared memory backed 353 // Note: Nothing to do here as ownership of shared memory backed
350 // GpuMemoryBuffers is passed with IPC. 354 // GpuMemoryBuffers is passed with IPC.
351 } 355 }
352 356
353 void ChildProcessHostImpl::GpuMemoryBufferAllocated( 357 void ChildProcessHostImpl::GpuMemoryBufferAllocated(
354 IPC::Message* reply, 358 IPC::Message* reply,
355 const gfx::GpuMemoryBufferHandle& handle) { 359 const gfx::GpuMemoryBufferHandle& handle) {
356 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply, 360 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply,
357 handle); 361 handle);
358 Send(reply); 362 Send(reply);
359 } 363 }
360 364
361 } // namespace content 365 } // namespace content
OLDNEW
« no previous file with comments | « content/common/child_process_host_impl.h ('k') | content/common/child_process_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698