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_PRIORITIZED_RESOURCE_H_ | 5 #ifndef CC_RESOURCES_PRIORITIZED_RESOURCE_H_ |
6 #define CC_RESOURCES_PRIORITIZED_RESOURCE_H_ | 6 #define CC_RESOURCES_PRIORITIZED_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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 bool RequestLate(); | 75 bool RequestLate(); |
76 | 76 |
77 // Update pixels of backing resource from image. This functions will aquire | 77 // Update pixels of backing resource from image. This functions will aquire |
78 // the backing if needed. | 78 // the backing if needed. |
79 void SetPixels(ResourceProvider* resource_provider, | 79 void SetPixels(ResourceProvider* resource_provider, |
80 const uint8_t* image, | 80 const uint8_t* image, |
81 const gfx::Rect& image_rect, | 81 const gfx::Rect& image_rect, |
82 const gfx::Rect& source_rect, | 82 const gfx::Rect& source_rect, |
83 const gfx::Vector2d& dest_offset); | 83 const gfx::Vector2d& dest_offset); |
84 | 84 |
85 ResourceProvider::ResourceId resource_id() const { | 85 ResourceId resource_id() const { return backing_ ? backing_->id() : 0; } |
86 return backing_ ? backing_->id() : 0; | |
87 } | |
88 | 86 |
89 // Self-managed textures are accounted for when prioritizing other textures, | 87 // Self-managed textures are accounted for when prioritizing other textures, |
90 // but they are not allocated/recycled/deleted, so this needs to be done | 88 // but they are not allocated/recycled/deleted, so this needs to be done |
91 // externally. CanAcquireBackingTexture() indicates if the texture would have | 89 // externally. CanAcquireBackingTexture() indicates if the texture would have |
92 // been allowed given its priority. | 90 // been allowed given its priority. |
93 void set_is_self_managed(bool is_self_managed) { | 91 void set_is_self_managed(bool is_self_managed) { |
94 is_self_managed_ = is_self_managed; | 92 is_self_managed_ = is_self_managed; |
95 } | 93 } |
96 bool is_self_managed() { return is_self_managed_; } | 94 bool is_self_managed() { return is_self_managed_; } |
97 void SetToSelfManagedMemoryPlaceholder(size_t bytes); | 95 void SetToSelfManagedMemoryPlaceholder(size_t bytes); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 173 |
176 Backing* backing_; | 174 Backing* backing_; |
177 PrioritizedResourceManager* manager_; | 175 PrioritizedResourceManager* manager_; |
178 | 176 |
179 DISALLOW_COPY_AND_ASSIGN(PrioritizedResource); | 177 DISALLOW_COPY_AND_ASSIGN(PrioritizedResource); |
180 }; | 178 }; |
181 | 179 |
182 } // namespace cc | 180 } // namespace cc |
183 | 181 |
184 #endif // CC_RESOURCES_PRIORITIZED_RESOURCE_H_ | 182 #endif // CC_RESOURCES_PRIORITIZED_RESOURCE_H_ |
OLD | NEW |