| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CCScopedTexture_h | 5 #ifndef CCScopedTexture_h |
| 6 #define CCScopedTexture_h | 6 #define CCScopedTexture_h |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "CCTexture.h" | 10 #include "CCTexture.h" |
| 11 | 11 |
| 12 #if !ASSERT_DISABLED | 12 #if CC_DCHECK_ENABLED() |
| 13 #include "base/threading/platform_thread.h" | 13 #include "base/threading/platform_thread.h" |
| 14 #endif | 14 #endif |
| 15 | 15 |
| 16 namespace cc { | 16 namespace cc { |
| 17 | 17 |
| 18 class CCScopedTexture : protected CCTexture { | 18 class CCScopedTexture : protected CCTexture { |
| 19 public: | 19 public: |
| 20 static scoped_ptr<CCScopedTexture> create(CCResourceProvider* resourceProvid
er) { return make_scoped_ptr(new CCScopedTexture(resourceProvider)); } | 20 static scoped_ptr<CCScopedTexture> create(CCResourceProvider* resourceProvid
er) { return make_scoped_ptr(new CCScopedTexture(resourceProvider)); } |
| 21 virtual ~CCScopedTexture(); | 21 virtual ~CCScopedTexture(); |
| 22 | 22 |
| 23 using CCTexture::id; | 23 using CCTexture::id; |
| 24 using CCTexture::size; | 24 using CCTexture::size; |
| 25 using CCTexture::format; | 25 using CCTexture::format; |
| 26 using CCTexture::bytes; | 26 using CCTexture::bytes; |
| 27 | 27 |
| 28 bool allocate(int pool, const IntSize&, GC3Denum format, CCResourceProvider:
:TextureUsageHint); | 28 bool allocate(int pool, const IntSize&, GC3Denum format, CCResourceProvider:
:TextureUsageHint); |
| 29 void free(); | 29 void free(); |
| 30 void leak(); | 30 void leak(); |
| 31 | 31 |
| 32 protected: | 32 protected: |
| 33 explicit CCScopedTexture(CCResourceProvider*); | 33 explicit CCScopedTexture(CCResourceProvider*); |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 CCResourceProvider* m_resourceProvider; | 36 CCResourceProvider* m_resourceProvider; |
| 37 | 37 |
| 38 #if !ASSERT_DISABLED | 38 #if CC_DCHECK_ENABLED() |
| 39 base::PlatformThreadId m_allocateThreadIdentifier; | 39 base::PlatformThreadId m_allocateThreadIdentifier; |
| 40 #endif | 40 #endif |
| 41 | 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(CCScopedTexture); | 42 DISALLOW_COPY_AND_ASSIGN(CCScopedTexture); |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 } | 45 } |
| 46 | 46 |
| 47 #endif | 47 #endif |
| OLD | NEW |