OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/gl/gl_image_ref_counted_memory.h" |
| 6 |
| 7 #include "base/memory/ref_counted_memory.h" |
| 8 |
| 9 namespace gfx { |
| 10 |
| 11 GLImageRefCountedMemory::GLImageRefCountedMemory(const gfx::Size& size, |
| 12 unsigned internalformat) |
| 13 : GLImageMemory(size, internalformat) { |
| 14 } |
| 15 |
| 16 GLImageRefCountedMemory::~GLImageRefCountedMemory() { |
| 17 Destroy(); |
| 18 } |
| 19 |
| 20 bool GLImageRefCountedMemory::Initialize( |
| 21 base::RefCountedMemory* ref_counted_memory) { |
| 22 if (!HasValidFormat()) |
| 23 return false; |
| 24 |
| 25 DCHECK(!ref_counted_memory_); |
| 26 ref_counted_memory_ = ref_counted_memory; |
| 27 GLImageMemory::Initialize(ref_counted_memory_->front()); |
| 28 return true; |
| 29 } |
| 30 |
| 31 void GLImageRefCountedMemory::Destroy() { |
| 32 GLImageMemory::Destroy(); |
| 33 ref_counted_memory_ = NULL; |
| 34 } |
| 35 |
| 36 } // namespace gfx |
OLD | NEW |