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

Side by Side Diff: content/common/gpu/client/gpu_memory_buffer_impl.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, 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 "ui/gl/gl_bindings.h" 7 #include "ui/gl/gl_bindings.h"
8 8
9 namespace content { 9 namespace content {
10 10
11 GpuMemoryBufferImpl::GpuMemoryBufferImpl(const gfx::Size& size, 11 GpuMemoryBufferImpl::GpuMemoryBufferImpl(const gfx::Size& size,
12 unsigned internalformat) 12 unsigned internalformat,
13 : size_(size), internalformat_(internalformat), mapped_(false) { 13 const DestructionCallback& callback)
14 : size_(size),
15 internalformat_(internalformat),
16 callback_(callback),
17 mapped_(false) {
14 DCHECK(IsFormatValid(internalformat)); 18 DCHECK(IsFormatValid(internalformat));
15 } 19 }
16 20
17 GpuMemoryBufferImpl::~GpuMemoryBufferImpl() {} 21 GpuMemoryBufferImpl::~GpuMemoryBufferImpl() {
22 callback_.Run();
23 }
18 24
19 // static 25 // static
20 bool GpuMemoryBufferImpl::IsFormatValid(unsigned internalformat) { 26 bool GpuMemoryBufferImpl::IsFormatValid(unsigned internalformat) {
21 switch (internalformat) { 27 switch (internalformat) {
22 case GL_BGRA8_EXT: 28 case GL_BGRA8_EXT:
23 case GL_RGBA8_OES: 29 case GL_RGBA8_OES:
24 return true; 30 return true;
25 default: 31 default:
26 return false; 32 return false;
27 } 33 }
(...skipping 18 matching lines...) Expand all
46 return 4; 52 return 4;
47 default: 53 default:
48 NOTREACHED(); 54 NOTREACHED();
49 return 0; 55 return 0;
50 } 56 }
51 } 57 }
52 58
53 bool GpuMemoryBufferImpl::IsMapped() const { return mapped_; } 59 bool GpuMemoryBufferImpl::IsMapped() const { return mapped_; }
54 60
55 } // namespace content 61 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/gpu_memory_buffer_impl.h ('k') | content/common/gpu/client/gpu_memory_buffer_impl_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698