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