blob: ed4e03f6a3a3ecf0866196f9825648cc5a8832b3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/gl/gl_image_ref_counted_memory.h"
#include "base/logging.h"
#include "base/memory/ref_counted_memory.h"
namespace gfx {
GLImageRefCountedMemory::GLImageRefCountedMemory(const gfx::Size& size,
unsigned internalformat)
: GLImageMemory(size, internalformat) {
}
GLImageRefCountedMemory::~GLImageRefCountedMemory() {
DCHECK(!ref_counted_memory_.get());
}
bool GLImageRefCountedMemory::Initialize(
base::RefCountedMemory* ref_counted_memory) {
if (!HasValidFormat())
return false;
DCHECK(!ref_counted_memory_.get());
ref_counted_memory_ = ref_counted_memory;
GLImageMemory::Initialize(ref_counted_memory_->front());
return true;
}
void GLImageRefCountedMemory::Destroy(bool have_context) {
GLImageMemory::Destroy(have_context);
ref_counted_memory_ = NULL;
}
} // namespace gfx
|