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