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

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 "content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.h " 7 #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" 8 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h"
9 9
10 namespace content { 10 namespace content {
11 11
12 // static 12 // static
13 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::Create( 13 void GpuMemoryBufferImpl::Create(const gfx::Size& size,
14 const gfx::Size& size, 14 unsigned internalformat,
15 unsigned internalformat, 15 unsigned usage,
16 unsigned usage) { 16 const CreationCallback& callback) {
17 if (GpuMemoryBufferImplOzoneNativeBuffer::IsConfigurationSupported(
18 internalformat, usage)) {
19 GpuMemoryBufferImplOzoneNativeBuffer::Create(
20 size, internalformat, usage, callback);
21 return;
22 }
23
17 if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( 24 if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported(
18 size, internalformat, usage)) { 25 size, internalformat, usage)) {
19 scoped_ptr<GpuMemoryBufferImplSharedMemory> buffer( 26 GpuMemoryBufferImplSharedMemory::Create(
20 new GpuMemoryBufferImplSharedMemory(size, internalformat)); 27 size, internalformat, usage, callback);
21 if (!buffer->Initialize()) 28 return;
22 return scoped_ptr<GpuMemoryBufferImpl>();
23
24 return buffer.PassAs<GpuMemoryBufferImpl>();
25 } 29 }
26 30
27 return scoped_ptr<GpuMemoryBufferImpl>(); 31 callback.Run(scoped_ptr<GpuMemoryBufferImpl>());
28 } 32 }
29 33
30 // static 34 // static
31 void GpuMemoryBufferImpl::AllocateForChildProcess( 35 void GpuMemoryBufferImpl::AllocateForChildProcess(
32 const gfx::Size& size, 36 const gfx::Size& size,
33 unsigned internalformat, 37 unsigned internalformat,
34 unsigned usage, 38 unsigned usage,
35 base::ProcessHandle child_process, 39 base::ProcessHandle child_process,
36 int child_id, 40 int child_id,
37 const AllocationCallback& callback) { 41 const AllocationCallback& callback) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 return scoped_ptr<GpuMemoryBufferImpl>(); 83 return scoped_ptr<GpuMemoryBufferImpl>();
80 84
81 return buffer.PassAs<GpuMemoryBufferImpl>(); 85 return buffer.PassAs<GpuMemoryBufferImpl>();
82 } 86 }
83 default: 87 default:
84 return scoped_ptr<GpuMemoryBufferImpl>(); 88 return scoped_ptr<GpuMemoryBufferImpl>();
85 } 89 }
86 } 90 }
87 91
88 } // namespace content 92 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698