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

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

Issue 263553009: content: Cleanup GpuMemoryBuffer allocation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove use of ChildProcessHostImpl and use base::CheckedNumeric Created 6 years, 7 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 | Annotate | Revision Log
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(gfx::Size size, 11 GpuMemoryBufferImpl::GpuMemoryBufferImpl(const gfx::Size& size,
12 unsigned internalformat) 12 unsigned internalformat)
13 : size_(size), internalformat_(internalformat), mapped_(false) { 13 : size_(size), internalformat_(internalformat), mapped_(false) {
14 DCHECK(IsFormatValid(internalformat)); 14 DCHECK(IsFormatValid(internalformat));
15 } 15 }
16 16
17 GpuMemoryBufferImpl::~GpuMemoryBufferImpl() {} 17 GpuMemoryBufferImpl::~GpuMemoryBufferImpl() {}
18 18
19 // static 19 // static
20 bool GpuMemoryBufferImpl::IsFormatValid(unsigned internalformat) { 20 bool GpuMemoryBufferImpl::IsFormatValid(unsigned internalformat) {
21 switch (internalformat) { 21 switch (internalformat) {
(...skipping 17 matching lines...) Expand all
39 } 39 }
40 } 40 }
41 41
42 bool GpuMemoryBufferImpl::IsMapped() const { return mapped_; } 42 bool GpuMemoryBufferImpl::IsMapped() const { return mapped_; }
43 43
44 uint32 GpuMemoryBufferImpl::GetStride() const { 44 uint32 GpuMemoryBufferImpl::GetStride() const {
45 return size_.width() * BytesPerPixel(internalformat_); 45 return size_.width() * BytesPerPixel(internalformat_);
46 } 46 }
47 47
48 } // namespace content 48 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698