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

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

Issue 634083002: gpu: Compositor management of GpuMemoryBuffer instances. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cc-pre-chromium-image-refactor
Patch Set: mac build fix Created 6 years, 2 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_shared_memory.h" 7 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h"
8 #include "content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h" 8 #include "content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h"
9 9
10 namespace content { 10 namespace content {
11 11
12 // static 12 // static
13 void GpuMemoryBufferImpl::Create(const gfx::Size& size, 13 void GpuMemoryBufferImpl::Create(const gfx::Size& size,
14 unsigned internalformat, 14 Format format,
15 unsigned usage, 15 Usage usage,
16 int client_id, 16 int client_id,
17 const CreationCallback& callback) { 17 const CreationCallback& callback) {
18 if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( 18 if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported(
19 size, internalformat, usage)) { 19 size, format, usage)) {
20 GpuMemoryBufferImplSharedMemory::Create( 20 GpuMemoryBufferImplSharedMemory::Create(size, format, callback);
21 size, internalformat, usage, callback);
22 return; 21 return;
23 } 22 }
24 23
25 callback.Run(scoped_ptr<GpuMemoryBufferImpl>()); 24 callback.Run(scoped_ptr<GpuMemoryBufferImpl>());
26 } 25 }
27 26
28 // static 27 // static
29 void GpuMemoryBufferImpl::AllocateForChildProcess( 28 void GpuMemoryBufferImpl::AllocateForChildProcess(
30 const gfx::Size& size, 29 const gfx::Size& size,
31 unsigned internalformat, 30 Format format,
32 unsigned usage, 31 Usage usage,
33 base::ProcessHandle child_process, 32 base::ProcessHandle child_process,
34 int child_client_id, 33 int child_client_id,
35 const AllocationCallback& callback) { 34 const AllocationCallback& callback) {
36 if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( 35 if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported(
37 size, internalformat, usage)) { 36 size, format, usage)) {
38 GpuMemoryBufferImplSharedMemory::AllocateForChildProcess( 37 GpuMemoryBufferImplSharedMemory::AllocateForChildProcess(
39 size, internalformat, child_process, callback); 38 size, format, child_process, callback);
40 return; 39 return;
41 } 40 }
42 41
43 callback.Run(gfx::GpuMemoryBufferHandle()); 42 callback.Run(gfx::GpuMemoryBufferHandle());
44 } 43 }
45 44
46 // static 45 // static
47 void GpuMemoryBufferImpl::DeletedByChildProcess( 46 void GpuMemoryBufferImpl::DeletedByChildProcess(
48 gfx::GpuMemoryBufferType type, 47 gfx::GpuMemoryBufferType type,
49 const gfx::GpuMemoryBufferId& id, 48 const gfx::GpuMemoryBufferId& id,
50 base::ProcessHandle child_process) { 49 base::ProcessHandle child_process) {
51 } 50 }
52 51
53 // static 52 // static
54 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( 53 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle(
55 const gfx::GpuMemoryBufferHandle& handle, 54 const gfx::GpuMemoryBufferHandle& handle,
56 const gfx::Size& size, 55 const gfx::Size& size,
57 unsigned internalformat, 56 Format format,
58 const DestructionCallback& callback) { 57 const DestructionCallback& callback) {
59 switch (handle.type) { 58 switch (handle.type) {
60 case gfx::SHARED_MEMORY_BUFFER: 59 case gfx::SHARED_MEMORY_BUFFER:
61 return GpuMemoryBufferImplSharedMemory::CreateFromHandle( 60 return GpuMemoryBufferImplSharedMemory::CreateFromHandle(
62 handle, size, internalformat, callback); 61 handle, size, format, callback);
63 case gfx::SURFACE_TEXTURE_BUFFER: 62 case gfx::SURFACE_TEXTURE_BUFFER:
64 return GpuMemoryBufferImplSurfaceTexture::CreateFromHandle( 63 return GpuMemoryBufferImplSurfaceTexture::CreateFromHandle(
65 handle, size, internalformat, callback); 64 handle, size, format, callback);
66 default: 65 default:
67 return scoped_ptr<GpuMemoryBufferImpl>(); 66 return scoped_ptr<GpuMemoryBufferImpl>();
68 } 67 }
69 } 68 }
70 69
71 } // namespace content 70 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698