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