1 // Copyright 2012 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.
7 #include "CCScopedTexture.h"
11 CCScopedTexture::CCScopedTexture(CCResourceProvider
* resourceProvider
)
12 : m_resourceProvider(resourceProvider
)
14 ASSERT(m_resourceProvider
);
17 CCScopedTexture::~CCScopedTexture()
22 bool CCScopedTexture::allocate(int pool
, const IntSize
& size
, GC3Denum format
, CCResourceProvider::TextureUsageHint hint
)
25 ASSERT(!size
.isEmpty());
27 setDimensions(size
, format
);
28 setId(m_resourceProvider
->createResource(pool
, size
, format
, hint
));
31 m_allocateThreadIdentifier
= base::PlatformThread::CurrentId();
37 void CCScopedTexture::free()
40 ASSERT(m_allocateThreadIdentifier
== base::PlatformThread::CurrentId());
41 m_resourceProvider
->deleteResource(id());
46 void CCScopedTexture::leak()