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 CCPrioritizedTexture_h | 5 #ifndef CCPrioritizedTexture_h |
6 #define CCPrioritizedTexture_h | 6 #define CCPrioritizedTexture_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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 // FIXME: Request late is really a hack for when we are totally out of memor
y | 65 // FIXME: Request late is really a hack for when we are totally out of memor
y |
66 // (all textures are visible) but we can still squeeze into the limit | 66 // (all textures are visible) but we can still squeeze into the limit |
67 // by not painting occluded textures. In this case the manager | 67 // by not painting occluded textures. In this case the manager |
68 // refuses all visible textures and requestLate() will enable | 68 // refuses all visible textures and requestLate() will enable |
69 // canAcquireBackingTexture() on a call-order basis. We might want to | 69 // canAcquireBackingTexture() on a call-order basis. We might want to |
70 // just remove this in the future (carefully) and just make sure we d
on't | 70 // just remove this in the future (carefully) and just make sure we d
on't |
71 // regress OOMs situations. | 71 // regress OOMs situations. |
72 bool requestLate(); | 72 bool requestLate(); |
73 | 73 |
74 // Uploads pixels into the backing resource. This functions will aquire the
backing if needed. | 74 // Update pixels of backing resource from image. This functions will aquire
the backing if needed. |
75 void upload(ResourceProvider*, const uint8_t* image, const gfx::Rect& imageR
ect, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset); | 75 void setPixels(ResourceProvider*, const uint8_t* image, const gfx::Rect& ima
geRect, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset); |
76 | 76 |
77 ResourceProvider::ResourceId resourceId() const; | 77 ResourceProvider::ResourceId resourceId() const; |
78 | 78 |
79 // Self-managed textures are accounted for when prioritizing other textures, | 79 // Self-managed textures are accounted for when prioritizing other textures, |
80 // but they are not allocated/recycled/deleted, so this needs to be done | 80 // but they are not allocated/recycled/deleted, so this needs to be done |
81 // externally. canAcquireBackingTexture() indicates if the texture would hav
e | 81 // externally. canAcquireBackingTexture() indicates if the texture would hav
e |
82 // been allowed given its priority. | 82 // been allowed given its priority. |
83 void setIsSelfManaged(bool isSelfManaged) { m_isSelfManaged = isSelfManaged;
} | 83 void setIsSelfManaged(bool isSelfManaged) { m_isSelfManaged = isSelfManaged;
} |
84 bool isSelfManaged() { return m_isSelfManaged; } | 84 bool isSelfManaged() { return m_isSelfManaged; } |
85 void setToSelfManagedMemoryPlaceholder(size_t bytes); | 85 void setToSelfManagedMemoryPlaceholder(size_t bytes); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 144 |
145 Backing* m_backing; | 145 Backing* m_backing; |
146 PrioritizedTextureManager* m_manager; | 146 PrioritizedTextureManager* m_manager; |
147 | 147 |
148 DISALLOW_COPY_AND_ASSIGN(PrioritizedTexture); | 148 DISALLOW_COPY_AND_ASSIGN(PrioritizedTexture); |
149 }; | 149 }; |
150 | 150 |
151 } // namespace cc | 151 } // namespace cc |
152 | 152 |
153 #endif | 153 #endif |
OLD | NEW |