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

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

Issue 1503393005: Check that shared memory GpuMemoryBuffer opening succeeds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/logging.h" 7 #include "base/logging.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 #if defined(OS_MACOSX) 10 #if defined(OS_MACOSX)
(...skipping 26 matching lines...) Expand all
37 } 37 }
38 38
39 // static 39 // static
40 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( 40 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle(
41 const gfx::GpuMemoryBufferHandle& handle, 41 const gfx::GpuMemoryBufferHandle& handle,
42 const gfx::Size& size, 42 const gfx::Size& size,
43 gfx::BufferFormat format, 43 gfx::BufferFormat format,
44 gfx::BufferUsage usage, 44 gfx::BufferUsage usage,
45 const DestructionCallback& callback) { 45 const DestructionCallback& callback) {
46 switch (handle.type) { 46 switch (handle.type) {
47 case gfx::SHARED_MEMORY_BUFFER: 47 case gfx::SHARED_MEMORY_BUFFER: {
48 return GpuMemoryBufferImplSharedMemory::CreateFromHandle( 48 scoped_ptr<GpuMemoryBufferImpl> buffer =
49 handle, size, format, usage, callback); 49 GpuMemoryBufferImplSharedMemory::CreateFromHandle(
50 handle, size, format, usage, callback);
51 CHECK(buffer);
reveman 2015/12/08 18:05:50 How about changing the base::SharedMemory::IsHandl
52 return buffer.Pass();
53 }
50 #if defined(OS_MACOSX) 54 #if defined(OS_MACOSX)
51 case gfx::IO_SURFACE_BUFFER: 55 case gfx::IO_SURFACE_BUFFER:
52 return GpuMemoryBufferImplIOSurface::CreateFromHandle( 56 return GpuMemoryBufferImplIOSurface::CreateFromHandle(
53 handle, size, format, usage, callback); 57 handle, size, format, usage, callback);
54 #endif 58 #endif
55 #if defined(OS_ANDROID) 59 #if defined(OS_ANDROID)
56 case gfx::SURFACE_TEXTURE_BUFFER: 60 case gfx::SURFACE_TEXTURE_BUFFER:
57 return GpuMemoryBufferImplSurfaceTexture::CreateFromHandle( 61 return GpuMemoryBufferImplSurfaceTexture::CreateFromHandle(
58 handle, size, format, usage, callback); 62 handle, size, format, usage, callback);
59 #endif 63 #endif
(...skipping 24 matching lines...) Expand all
84 88
85 gfx::GpuMemoryBufferId GpuMemoryBufferImpl::GetId() const { 89 gfx::GpuMemoryBufferId GpuMemoryBufferImpl::GetId() const {
86 return id_; 90 return id_;
87 } 91 }
88 92
89 ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() { 93 ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() {
90 return reinterpret_cast<ClientBuffer>(this); 94 return reinterpret_cast<ClientBuffer>(this);
91 } 95 }
92 96
93 } // namespace content 97 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698