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