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

Side by Side Diff: content/common/gpu/client/gpu_memory_buffer_impl_ozone.cc

Issue 540443002: Enable sync allocation of GpuMemoryBuffers from the browser process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/gpu/client/gpu_memory_buffer_impl.h" 5 #include "content/common/gpu/client/gpu_memory_buffer_impl.h"
6 6
7 #include "base/bind.h"
reveman 2014/09/09 23:17:54 nit: I don't think you need this.
alexst (slow to review) 2014/09/10 01:57:49 right, missed one, thanks.
7 #include "content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.h " 8 #include "content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.h "
8 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h" 9 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h"
9 10
10 namespace content { 11 namespace content {
11 12
12 // static 13 // static
13 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::Create( 14 void GpuMemoryBufferImpl::Create(const gfx::Size& size,
14 const gfx::Size& size, 15 unsigned internalformat,
15 unsigned internalformat, 16 unsigned usage,
16 unsigned usage) { 17 const CreationCallback& callback) {
18 if (GpuMemoryBufferImplOzoneNativeBuffer::IsConfigurationSupported(
19 internalformat, usage)) {
20 GpuMemoryBufferImplOzoneNativeBuffer::Create(
21 size, internalformat, usage, callback);
22 return;
23 }
24
17 if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( 25 if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported(
18 size, internalformat, usage)) { 26 size, internalformat, usage)) {
19 scoped_ptr<GpuMemoryBufferImplSharedMemory> buffer( 27 GpuMemoryBufferImplSharedMemory::Create(
20 new GpuMemoryBufferImplSharedMemory(size, internalformat)); 28 size, internalformat, usage, callback);
21 if (!buffer->Initialize()) 29 return;
22 return scoped_ptr<GpuMemoryBufferImpl>();
23
24 return buffer.PassAs<GpuMemoryBufferImpl>();
25 } 30 }
26 31
27 return scoped_ptr<GpuMemoryBufferImpl>(); 32 callback.Run(scoped_ptr<GpuMemoryBufferImpl>());
28 } 33 }
29 34
30 // static 35 // static
31 void GpuMemoryBufferImpl::AllocateForChildProcess( 36 void GpuMemoryBufferImpl::AllocateForChildProcess(
32 const gfx::Size& size, 37 const gfx::Size& size,
33 unsigned internalformat, 38 unsigned internalformat,
34 unsigned usage, 39 unsigned usage,
35 base::ProcessHandle child_process, 40 base::ProcessHandle child_process,
36 int child_id, 41 int child_id,
37 const AllocationCallback& callback) { 42 const AllocationCallback& callback) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 return scoped_ptr<GpuMemoryBufferImpl>(); 84 return scoped_ptr<GpuMemoryBufferImpl>();
80 85
81 return buffer.PassAs<GpuMemoryBufferImpl>(); 86 return buffer.PassAs<GpuMemoryBufferImpl>();
82 } 87 }
83 default: 88 default:
84 return scoped_ptr<GpuMemoryBufferImpl>(); 89 return scoped_ptr<GpuMemoryBufferImpl>();
85 } 90 }
86 } 91 }
87 92
88 } // namespace content 93 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698