Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Side by Side Diff: cc/CCPrioritizedTexture.h

Issue 10947017: Enable removing uploads to evicted textures from texture upload queues. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporate review feedback Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/CCLayerTreeHost.cpp ('k') | cc/CCPrioritizedTexture.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "CCPriorityCalculator.h" 8 #include "CCPriorityCalculator.h"
9 #include "CCResourceProvider.h" 9 #include "CCResourceProvider.h"
10 #include "CCTexture.h" 10 #include "CCTexture.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // After CCPrioritizedTexture::prioritizeTextures() is called, this returns 45 // After CCPrioritizedTexture::prioritizeTextures() is called, this returns
46 // if the the request succeeded and this texture can be acquired for use. 46 // if the the request succeeded and this texture can be acquired for use.
47 bool canAcquireBackingTexture() const { return m_isAbovePriorityCutoff; } 47 bool canAcquireBackingTexture() const { return m_isAbovePriorityCutoff; }
48 48
49 // This returns whether we still have a backing texture. This can continue 49 // This returns whether we still have a backing texture. This can continue
50 // to be true even after canAcquireBackingTexture() becomes false. In this 50 // to be true even after canAcquireBackingTexture() becomes false. In this
51 // case the texture can be used but shouldn't be updated since it will get 51 // case the texture can be used but shouldn't be updated since it will get
52 // taken away "soon". 52 // taken away "soon".
53 bool haveBackingTexture() const { return !!backing(); } 53 bool haveBackingTexture() const { return !!backing(); }
54 54
55 bool backingResourceWasEvicted() const;
56
55 // If canAcquireBackingTexture() is true acquireBackingTexture() will acquir e 57 // If canAcquireBackingTexture() is true acquireBackingTexture() will acquir e
56 // a backing texture for use. Call this whenever the texture is actually nee ded. 58 // a backing texture for use. Call this whenever the texture is actually nee ded.
57 void acquireBackingTexture(CCResourceProvider*); 59 void acquireBackingTexture(CCResourceProvider*);
58 60
59 // FIXME: Request late is really a hack for when we are totally out of memor y 61 // FIXME: Request late is really a hack for when we are totally out of memor y
60 // (all textures are visible) but we can still squeeze into the limit 62 // (all textures are visible) but we can still squeeze into the limit
61 // by not painting occluded textures. In this case the manager 63 // by not painting occluded textures. In this case the manager
62 // refuses all visible textures and requestLate() will enable 64 // refuses all visible textures and requestLate() will enable
63 // canAcquireBackingTexture() on a call-order basis. We might want to 65 // canAcquireBackingTexture() on a call-order basis. We might want to
64 // just remove this in the future (carefully) and just make sure we d on't 66 // just remove this in the future (carefully) and just make sure we d on't
(...skipping 13 matching lines...) Expand all
78 bool isSelfManaged() { return m_isSelfManaged; } 80 bool isSelfManaged() { return m_isSelfManaged; }
79 void setToSelfManagedMemoryPlaceholder(size_t bytes); 81 void setToSelfManagedMemoryPlaceholder(size_t bytes);
80 82
81 private: 83 private:
82 friend class CCPrioritizedTextureManager; 84 friend class CCPrioritizedTextureManager;
83 friend class CCPrioritizedTextureTest; 85 friend class CCPrioritizedTextureTest;
84 86
85 class Backing : public CCTexture { 87 class Backing : public CCTexture {
86 WTF_MAKE_NONCOPYABLE(Backing); 88 WTF_MAKE_NONCOPYABLE(Backing);
87 public: 89 public:
88 Backing(unsigned id, IntSize, GC3Denum format); 90 Backing(unsigned id, CCResourceProvider*, IntSize, GC3Denum format);
89 ~Backing(); 91 ~Backing();
90 void updatePriority(); 92 void updatePriority();
91 93
92 CCPrioritizedTexture* owner() { return m_owner; } 94 CCPrioritizedTexture* owner() { return m_owner; }
93 bool hadOwnerAtLastPriorityUpdate() const { return m_ownerExistedAtLastP riorityUpdate; } 95 bool hadOwnerAtLastPriorityUpdate() const { return m_ownerExistedAtLastP riorityUpdate; }
94 bool requestPriorityAtLastPriorityUpdate() const { return m_priorityAtLa stPriorityUpdate; } 96 bool requestPriorityAtLastPriorityUpdate() const { return m_priorityAtLa stPriorityUpdate; }
95 bool wasAbovePriorityCutoffAtLastPriorityUpdate() const { return m_wasAb ovePriorityCutoffAtLastPriorityUpdate; } 97 bool wasAbovePriorityCutoffAtLastPriorityUpdate() const { return m_wasAb ovePriorityCutoffAtLastPriorityUpdate; }
96 98
99 void deleteResource(CCResourceProvider*);
100 bool resourceHasBeenDeleted() const;
101
97 private: 102 private:
98 friend class CCPrioritizedTexture; 103 friend class CCPrioritizedTexture;
99 CCPrioritizedTexture* m_owner; 104 CCPrioritizedTexture* m_owner;
100 int m_priorityAtLastPriorityUpdate; 105 int m_priorityAtLastPriorityUpdate;
101 bool m_ownerExistedAtLastPriorityUpdate; 106 bool m_ownerExistedAtLastPriorityUpdate;
102 bool m_wasAbovePriorityCutoffAtLastPriorityUpdate; 107 bool m_wasAbovePriorityCutoffAtLastPriorityUpdate;
108 bool m_resourceHasBeenDeleted;
109 #ifndef NDEBUG
110 CCResourceProvider* m_resourceProvider;
111 #endif
103 }; 112 };
104 113
105 CCPrioritizedTexture(CCPrioritizedTextureManager*, IntSize, GC3Denum format) ; 114 CCPrioritizedTexture(CCPrioritizedTextureManager*, IntSize, GC3Denum format) ;
106 115
107 bool isAbovePriorityCutoff() { return m_isAbovePriorityCutoff; } 116 bool isAbovePriorityCutoff() { return m_isAbovePriorityCutoff; }
108 void setAbovePriorityCutoff(bool isAbovePriorityCutoff) { m_isAbovePriorityC utoff = isAbovePriorityCutoff; } 117 void setAbovePriorityCutoff(bool isAbovePriorityCutoff) { m_isAbovePriorityC utoff = isAbovePriorityCutoff; }
109 void setManagerInternal(CCPrioritizedTextureManager* manager) { m_manager = manager; } 118 void setManagerInternal(CCPrioritizedTextureManager* manager) { m_manager = manager; }
110 119
111 Backing* backing() const { return m_backing; } 120 Backing* backing() const { return m_backing; }
112 void link(Backing*); 121 void link(Backing*);
113 void unlink(); 122 void unlink();
114 123
115 IntSize m_size; 124 IntSize m_size;
116 GC3Denum m_format; 125 GC3Denum m_format;
117 size_t m_bytes; 126 size_t m_bytes;
118 127
119 int m_priority; 128 int m_priority;
120 bool m_isAbovePriorityCutoff; 129 bool m_isAbovePriorityCutoff;
121 bool m_isSelfManaged; 130 bool m_isSelfManaged;
122 131
123 Backing* m_backing; 132 Backing* m_backing;
124 CCPrioritizedTextureManager* m_manager; 133 CCPrioritizedTextureManager* m_manager;
125 }; 134 };
126 135
127 } // namespace cc 136 } // namespace cc
128 137
129 #endif 138 #endif
OLDNEW
« no previous file with comments | « cc/CCLayerTreeHost.cpp ('k') | cc/CCPrioritizedTexture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698