Implement android_webview url intercepting.
[chromium-blink-merge.git] / cc / scoped_texture.cc
blobd43ebe33019e1af0237353540c75736cd3c33db7
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.
5 #include "config.h"
7 #include "CCScopedTexture.h"
9 namespace cc {
11 CCScopedTexture::CCScopedTexture(CCResourceProvider* resourceProvider)
12 : m_resourceProvider(resourceProvider)
14 ASSERT(m_resourceProvider);
17 CCScopedTexture::~CCScopedTexture()
19 free();
22 bool CCScopedTexture::allocate(int pool, const IntSize& size, GC3Denum format, CCResourceProvider::TextureUsageHint hint)
24 ASSERT(!id());
25 ASSERT(!size.isEmpty());
27 setDimensions(size, format);
28 setId(m_resourceProvider->createResource(pool, size, format, hint));
30 #if !ASSERT_DISABLED
31 m_allocateThreadIdentifier = base::PlatformThread::CurrentId();
32 #endif
34 return id();
37 void CCScopedTexture::free()
39 if (id()) {
40 ASSERT(m_allocateThreadIdentifier == base::PlatformThread::CurrentId());
41 m_resourceProvider->deleteResource(id());
43 setId(0);
46 void CCScopedTexture::leak()
48 setId(0);