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

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

Issue 600693002: content: Cleanup GpuMemoryBufferImpl destruction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 void GpuMemoryBufferImpl::DeletedByChildProcess( 47 void GpuMemoryBufferImpl::DeletedByChildProcess(
48 gfx::GpuMemoryBufferType type, 48 gfx::GpuMemoryBufferType type,
49 const gfx::GpuMemoryBufferId& id, 49 const gfx::GpuMemoryBufferId& id,
50 base::ProcessHandle child_process) { 50 base::ProcessHandle child_process) {
51 } 51 }
52 52
53 // static 53 // static
54 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( 54 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle(
55 const gfx::GpuMemoryBufferHandle& handle, 55 const gfx::GpuMemoryBufferHandle& handle,
56 const gfx::Size& size, 56 const gfx::Size& size,
57 unsigned internalformat) { 57 unsigned internalformat,
58 const DestructionCallback& callback) {
58 switch (handle.type) { 59 switch (handle.type) {
59 case gfx::SHARED_MEMORY_BUFFER: { 60 case gfx::SHARED_MEMORY_BUFFER: {
60 scoped_ptr<GpuMemoryBufferImplSharedMemory> buffer( 61 scoped_ptr<GpuMemoryBufferImplSharedMemory> buffer(
61 new GpuMemoryBufferImplSharedMemory(size, internalformat)); 62 new GpuMemoryBufferImplSharedMemory(size, internalformat, callback));
62 if (!buffer->InitializeFromHandle(handle)) 63 if (!buffer->InitializeFromHandle(handle))
63 return scoped_ptr<GpuMemoryBufferImpl>(); 64 return scoped_ptr<GpuMemoryBufferImpl>();
64 65
65 return buffer.PassAs<GpuMemoryBufferImpl>(); 66 return buffer.PassAs<GpuMemoryBufferImpl>();
66 } 67 }
67 case gfx::SURFACE_TEXTURE_BUFFER: { 68 case gfx::SURFACE_TEXTURE_BUFFER: {
68 scoped_ptr<GpuMemoryBufferImplSurfaceTexture> buffer( 69 scoped_ptr<GpuMemoryBufferImplSurfaceTexture> buffer(
69 new GpuMemoryBufferImplSurfaceTexture(size, internalformat)); 70 new GpuMemoryBufferImplSurfaceTexture(
71 size, internalformat, callback));
70 if (!buffer->InitializeFromHandle(handle)) 72 if (!buffer->InitializeFromHandle(handle))
71 return scoped_ptr<GpuMemoryBufferImpl>(); 73 return scoped_ptr<GpuMemoryBufferImpl>();
72 74
73 return buffer.PassAs<GpuMemoryBufferImpl>(); 75 return buffer.PassAs<GpuMemoryBufferImpl>();
74 } 76 }
75 default: 77 default:
76 return scoped_ptr<GpuMemoryBufferImpl>(); 78 return scoped_ptr<GpuMemoryBufferImpl>();
77 } 79 }
78 } 80 }
79 81
80 } // namespace content 82 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698