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

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

Issue 701873005: Handle failed GpuMemoryBuffer allocations properly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 | « content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.cc ('k') | 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 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_surface_texture.h" 5 #include "content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h"
6 6
7 #include "base/atomic_sequence_num.h" 7 #include "base/atomic_sequence_num.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 10 matching lines...) Expand all
21 uint32 sync_point) { 21 uint32 sync_point) {
22 GpuMemoryBufferFactoryHost::GetInstance()->DestroyGpuMemoryBuffer(handle, 22 GpuMemoryBufferFactoryHost::GetInstance()->DestroyGpuMemoryBuffer(handle,
23 sync_point); 23 sync_point);
24 } 24 }
25 25
26 void GpuMemoryBufferCreated( 26 void GpuMemoryBufferCreated(
27 const gfx::Size& size, 27 const gfx::Size& size,
28 gfx::GpuMemoryBuffer::Format format, 28 gfx::GpuMemoryBuffer::Format format,
29 const GpuMemoryBufferImpl::CreationCallback& callback, 29 const GpuMemoryBufferImpl::CreationCallback& callback,
30 const gfx::GpuMemoryBufferHandle& handle) { 30 const gfx::GpuMemoryBufferHandle& handle) {
31 if (handle.is_null()) {
32 callback.Run(scoped_ptr<GpuMemoryBufferImpl>());
33 return;
34 }
35
31 DCHECK_EQ(gfx::SURFACE_TEXTURE_BUFFER, handle.type); 36 DCHECK_EQ(gfx::SURFACE_TEXTURE_BUFFER, handle.type);
32
33 callback.Run(GpuMemoryBufferImplSurfaceTexture::CreateFromHandle( 37 callback.Run(GpuMemoryBufferImplSurfaceTexture::CreateFromHandle(
34 handle, size, format, base::Bind(&GpuMemoryBufferDeleted, handle))); 38 handle, size, format, base::Bind(&GpuMemoryBufferDeleted, handle)));
35 } 39 }
36 40
37 void GpuMemoryBufferCreatedForChildProcess( 41 void GpuMemoryBufferCreatedForChildProcess(
38 const GpuMemoryBufferImpl::AllocationCallback& callback, 42 const GpuMemoryBufferImpl::AllocationCallback& callback,
39 const gfx::GpuMemoryBufferHandle& handle) { 43 const gfx::GpuMemoryBufferHandle& handle) {
40 DCHECK_EQ(gfx::SURFACE_TEXTURE_BUFFER, handle.type); 44 DCHECK_IMPLIES(!handle.is_null(), gfx::SURFACE_TEXTURE_BUFFER == handle.type);
41 45
42 callback.Run(handle); 46 callback.Run(handle);
43 } 47 }
44 48
45 } // namespace 49 } // namespace
46 50
47 GpuMemoryBufferImplSurfaceTexture::GpuMemoryBufferImplSurfaceTexture( 51 GpuMemoryBufferImplSurfaceTexture::GpuMemoryBufferImplSurfaceTexture(
48 const gfx::Size& size, 52 const gfx::Size& size,
49 Format format, 53 Format format,
50 const DestructionCallback& callback, 54 const DestructionCallback& callback,
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 214
211 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplSurfaceTexture::GetHandle() 215 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplSurfaceTexture::GetHandle()
212 const { 216 const {
213 gfx::GpuMemoryBufferHandle handle; 217 gfx::GpuMemoryBufferHandle handle;
214 handle.type = gfx::SURFACE_TEXTURE_BUFFER; 218 handle.type = gfx::SURFACE_TEXTURE_BUFFER;
215 handle.global_id = id_; 219 handle.global_id = id_;
216 return handle; 220 return handle;
217 } 221 }
218 222
219 } // namespace content 223 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698