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

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

Issue 600693002: content: Cleanup GpuMemoryBufferImpl destruction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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_io_surface.h" 5 #include "content/common/gpu/client/gpu_memory_buffer_impl_io_surface.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/gl/gl_bindings.h" 8 #include "ui/gl/gl_bindings.h"
9 9
10 namespace content { 10 namespace content {
11 11
12 GpuMemoryBufferImplIOSurface::GpuMemoryBufferImplIOSurface( 12 GpuMemoryBufferImplIOSurface::GpuMemoryBufferImplIOSurface(
13 const gfx::Size& size, 13 const gfx::Size& size,
14 unsigned internalformat) 14 const DestructionCallback& callback)
15 : GpuMemoryBufferImpl(size, internalformat) {} 15 : GpuMemoryBufferImpl(size, internalformat), callback_(callback) {
16 }
16 17
17 GpuMemoryBufferImplIOSurface::~GpuMemoryBufferImplIOSurface() {} 18 GpuMemoryBufferImplIOSurface::~GpuMemoryBufferImplIOSurface() {
19 if (!io_surface_)
20 return;
21
22 // Call destruction callback if instance was successfully initialized.
23 callback_.Run();
piman 2014/09/24 03:19:10 I think it would be nice if the callback_ was mana
reveman 2014/09/24 06:03:38 Yes, that's much better. Thanks for the suggestion
24 }
18 25
19 // static 26 // static
20 bool GpuMemoryBufferImplIOSurface::IsFormatSupported(unsigned internalformat) { 27 bool GpuMemoryBufferImplIOSurface::IsFormatSupported(unsigned internalformat) {
21 switch (internalformat) { 28 switch (internalformat) {
22 case GL_BGRA8_EXT: 29 case GL_BGRA8_EXT:
23 return true; 30 return true;
24 default: 31 default:
25 return false; 32 return false;
26 } 33 }
27 } 34 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 91 }
85 92
86 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const { 93 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const {
87 gfx::GpuMemoryBufferHandle handle; 94 gfx::GpuMemoryBufferHandle handle;
88 handle.type = gfx::IO_SURFACE_BUFFER; 95 handle.type = gfx::IO_SURFACE_BUFFER;
89 handle.io_surface_id = IOSurfaceGetID(io_surface_); 96 handle.io_surface_id = IOSurfaceGetID(io_surface_);
90 return handle; 97 return handle;
91 } 98 }
92 99
93 } // namespace content 100 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698