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 <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 class CC_EXPORT ScopedResource : public Resource { | 22 class CC_EXPORT ScopedResource : public Resource { |
23 public: | 23 public: |
24 static std::unique_ptr<ScopedResource> Create( | 24 static std::unique_ptr<ScopedResource> Create( |
25 ResourceProvider* resource_provider) { | 25 ResourceProvider* resource_provider) { |
26 return base::WrapUnique(new ScopedResource(resource_provider)); | 26 return base::WrapUnique(new ScopedResource(resource_provider)); |
27 } | 27 } |
28 virtual ~ScopedResource(); | 28 virtual ~ScopedResource(); |
29 | 29 |
30 void Allocate(const gfx::Size& size, | 30 void Allocate(const gfx::Size& size, |
31 ResourceProvider::TextureHint hint, | 31 ResourceProvider::TextureHint hint, |
32 ResourceFormat format); | 32 ResourceFormat format, |
| 33 const gfx::ColorSpace& color_space); |
33 void AllocateWithGpuMemoryBuffer(const gfx::Size& size, | 34 void AllocateWithGpuMemoryBuffer(const gfx::Size& size, |
34 ResourceFormat format, | 35 ResourceFormat format, |
35 gfx::BufferUsage usage); | 36 gfx::BufferUsage usage, |
| 37 const gfx::ColorSpace& color_space); |
36 void Free(); | 38 void Free(); |
37 | 39 |
38 protected: | 40 protected: |
39 explicit ScopedResource(ResourceProvider* provider); | 41 explicit ScopedResource(ResourceProvider* provider); |
40 | 42 |
41 private: | 43 private: |
42 ResourceProvider* resource_provider_; | 44 ResourceProvider* resource_provider_; |
43 | 45 |
44 #if DCHECK_IS_ON() | 46 #if DCHECK_IS_ON() |
45 base::PlatformThreadId allocate_thread_id_; | 47 base::PlatformThreadId allocate_thread_id_; |
46 #endif | 48 #endif |
47 | 49 |
48 DISALLOW_COPY_AND_ASSIGN(ScopedResource); | 50 DISALLOW_COPY_AND_ASSIGN(ScopedResource); |
49 }; | 51 }; |
50 | 52 |
51 } // namespace cc | 53 } // namespace cc |
52 | 54 |
53 #endif // CC_RESOURCES_SCOPED_RESOURCE_H_ | 55 #endif // CC_RESOURCES_SCOPED_RESOURCE_H_ |
OLD | NEW |