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