| 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 CC_RESOURCES_SCOPED_RESOURCE_H_ | 5 #ifndef CC_RESOURCES_SCOPED_RESOURCE_H_ |
| 6 #define CC_RESOURCES_SCOPED_RESOURCE_H_ | 6 #define CC_RESOURCES_SCOPED_RESOURCE_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" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 return make_scoped_ptr(new ScopedResource(resource_provider)); | 24 return make_scoped_ptr(new ScopedResource(resource_provider)); |
| 25 } | 25 } |
| 26 virtual ~ScopedResource(); | 26 virtual ~ScopedResource(); |
| 27 | 27 |
| 28 bool Allocate(const gfx::Size&, GLenum format, | 28 bool Allocate(const gfx::Size&, GLenum format, |
| 29 ResourceProvider::TextureUsageHint); | 29 ResourceProvider::TextureUsageHint); |
| 30 void Free(); | 30 void Free(); |
| 31 void Leak(); | 31 void Leak(); |
| 32 | 32 |
| 33 protected: | 33 protected: |
| 34 explicit ScopedResource(ResourceProvider*); | 34 explicit ScopedResource(ResourceProvider* provider); |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 ResourceProvider* resource_provider_; | 37 ResourceProvider* resource_provider_; |
| 38 | 38 |
| 39 #ifndef NDEBUG | 39 #ifndef NDEBUG |
| 40 base::PlatformThreadId allocate_thread_id_; | 40 base::PlatformThreadId allocate_thread_id_; |
| 41 #endif | 41 #endif |
| 42 | 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(ScopedResource); | 43 DISALLOW_COPY_AND_ASSIGN(ScopedResource); |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 } | 46 } // namespace cc |
| 47 | 47 |
| 48 #endif // CC_RESOURCES_SCOPED_RESOURCE_H_ | 48 #endif // CC_RESOURCES_SCOPED_RESOURCE_H_ |
| OLD | NEW |