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

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

Issue 600693002: content: Cleanup GpuMemoryBufferImpl destruction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove scoped_refptr<> from sender param of DeletedGpuMemoryBuffer 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 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 8
9 namespace content { 9 namespace content {
10 10
(...skipping 16 matching lines...) Expand all
27 // static 27 // static
28 void GpuMemoryBufferImpl::AllocateForChildProcess( 28 void GpuMemoryBufferImpl::AllocateForChildProcess(
29 const gfx::Size& size, 29 const gfx::Size& size,
30 unsigned internalformat, 30 unsigned internalformat,
31 unsigned usage, 31 unsigned usage,
32 base::ProcessHandle child_process, 32 base::ProcessHandle child_process,
33 int child_client_id, 33 int child_client_id,
34 const AllocationCallback& callback) { 34 const AllocationCallback& callback) {
35 if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( 35 if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported(
36 size, internalformat, usage)) { 36 size, internalformat, usage)) {
37 GpuMemoryBufferImplSharedMemory::AllocateSharedMemoryForChildProcess( 37 GpuMemoryBufferImplSharedMemory::AllocateForChildProcess(
38 size, internalformat, child_process, callback); 38 size, internalformat, child_process, callback);
39 return; 39 return;
40 } 40 }
41 41
42 callback.Run(gfx::GpuMemoryBufferHandle()); 42 callback.Run(gfx::GpuMemoryBufferHandle());
43 } 43 }
44 44
45 // static 45 // static
46 void GpuMemoryBufferImpl::DeletedByChildProcess( 46 void GpuMemoryBufferImpl::DeletedByChildProcess(
47 gfx::GpuMemoryBufferType type, 47 gfx::GpuMemoryBufferType type,
48 const gfx::GpuMemoryBufferId& id, 48 const gfx::GpuMemoryBufferId& id,
49 base::ProcessHandle child_process) { 49 base::ProcessHandle child_process) {
50 } 50 }
51 51
52 // static 52 // static
53 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( 53 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle(
54 const gfx::GpuMemoryBufferHandle& handle, 54 const gfx::GpuMemoryBufferHandle& handle,
55 const gfx::Size& size, 55 const gfx::Size& size,
56 unsigned internalformat) { 56 unsigned internalformat,
57 const DestructionCallback& callback) {
57 switch (handle.type) { 58 switch (handle.type) {
58 case gfx::SHARED_MEMORY_BUFFER: { 59 case gfx::SHARED_MEMORY_BUFFER:
59 scoped_ptr<GpuMemoryBufferImplSharedMemory> buffer( 60 return GpuMemoryBufferImplSharedMemory::CreateFromHandle(
60 new GpuMemoryBufferImplSharedMemory(size, internalformat)); 61 handle, size, internalformat, callback);
61 if (!buffer->InitializeFromHandle(handle))
62 return scoped_ptr<GpuMemoryBufferImpl>();
63
64 return buffer.PassAs<GpuMemoryBufferImpl>();
65 }
66 default: 62 default:
67 return scoped_ptr<GpuMemoryBufferImpl>(); 63 return scoped_ptr<GpuMemoryBufferImpl>();
68 } 64 }
69 } 65 }
70 66
71 } // namespace content 67 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.cc ('k') | content/renderer/render_thread_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698