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

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

Issue 701033005: content: Move type selection logic out of GpuMemoryBufferImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove blank line and add missing CONTENT_EXPORT 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
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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 if (delegate_->CanShutdown()) 313 if (delegate_->CanShutdown())
314 Send(new ChildProcessMsg_Shutdown()); 314 Send(new ChildProcessMsg_Shutdown());
315 } 315 }
316 316
317 void ChildProcessHostImpl::OnAllocateGpuMemoryBuffer( 317 void ChildProcessHostImpl::OnAllocateGpuMemoryBuffer(
318 uint32 width, 318 uint32 width,
319 uint32 height, 319 uint32 height,
320 gfx::GpuMemoryBuffer::Format format, 320 gfx::GpuMemoryBuffer::Format format,
321 gfx::GpuMemoryBuffer::Usage usage, 321 gfx::GpuMemoryBuffer::Usage usage,
322 IPC::Message* reply) { 322 IPC::Message* reply) {
323 base::CheckedNumeric<int> size = width; 323 // TODO(reveman): Add support for other types of GpuMemoryBuffers.
324 size *= height; 324 if (!GpuMemoryBufferImplSharedMemory::IsFormatSupported(format) ||
325 if (!size.IsValid()) { 325 !GpuMemoryBufferImplSharedMemory::IsUsageSupported(usage)) {
piman 2014/11/11 22:38:30 Why removing this?
reveman 2014/11/12 05:09:20 This check is now done by GpuMemoryBufferImplShare
piman 2014/11/14 03:59:44 Ok, can you add a comment? It's generally good to
reveman 2014/11/17 02:26:53 Done.
326 GpuMemoryBufferAllocated(reply, gfx::GpuMemoryBufferHandle()); 326 GpuMemoryBufferAllocated(reply, gfx::GpuMemoryBufferHandle());
327 return; 327 return;
328 } 328 }
329
330 // TODO(reveman): Add support for other types of GpuMemoryBuffers.
331 if (!GpuMemoryBufferImplSharedMemory::IsConfigurationSupported(
332 gfx::Size(width, height), format, usage)) {
333 GpuMemoryBufferAllocated(reply, gfx::GpuMemoryBufferHandle());
334 return;
335 }
336 329
337 // Note: It is safe to use base::Unretained here as the shared memory 330 // Note: It is safe to use base::Unretained here as the shared memory
338 // implementation of AllocateForChildProcess() calls this synchronously. 331 // implementation of AllocateForChildProcess() calls this synchronously.
339 GpuMemoryBufferImplSharedMemory::AllocateForChildProcess( 332 GpuMemoryBufferImplSharedMemory::AllocateForChildProcess(
340 g_next_gpu_memory_buffer_id.GetNext(), 333 g_next_gpu_memory_buffer_id.GetNext(),
341 gfx::Size(width, height), 334 gfx::Size(width, height),
342 format, 335 format,
343 peer_handle_, 336 peer_handle_,
344 base::Bind(&ChildProcessHostImpl::GpuMemoryBufferAllocated, 337 base::Bind(&ChildProcessHostImpl::GpuMemoryBufferAllocated,
345 base::Unretained(this), 338 base::Unretained(this),
346 reply)); 339 reply));
347 } 340 }
348 341
349 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer( 342 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer(
350 gfx::GpuMemoryBufferId id, 343 gfx::GpuMemoryBufferId id,
351 uint32 sync_point) { 344 uint32 sync_point) {
352 // Note: Nothing to do here as ownership of shared memory backed 345 // Note: Nothing to do here as ownership of shared memory backed
353 // GpuMemoryBuffers is passed with IPC. 346 // GpuMemoryBuffers is passed with IPC.
354 } 347 }
355 348
356 void ChildProcessHostImpl::GpuMemoryBufferAllocated( 349 void ChildProcessHostImpl::GpuMemoryBufferAllocated(
357 IPC::Message* reply, 350 IPC::Message* reply,
358 const gfx::GpuMemoryBufferHandle& handle) { 351 const gfx::GpuMemoryBufferHandle& handle) {
359 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply, 352 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply,
360 handle); 353 handle);
361 Send(reply); 354 Send(reply);
362 } 355 }
363 356
364 } // namespace content 357 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698