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

Side by Side Diff: cc/prioritized_texture.h

Issue 11150025: Patch from https://codereview.chromium.org/11111005/ without actual file deletes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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/platform_color.h ('k') | cc/prioritized_texture.cc » ('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 "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "CCPriorityCalculator.h" 10 #include "CCPriorityCalculator.h"
11 #include "CCResourceProvider.h" 11 #include "CCResourceProvider.h"
12 #include "CCTexture.h" 12 #include "CCTexture.h"
13 #include "GraphicsContext3D.h"
14 #include "IntRect.h" 13 #include "IntRect.h"
15 #include "IntSize.h" 14 #include "IntSize.h"
16 15
17 namespace cc { 16 namespace cc {
18 17
19 class CCPrioritizedTextureManager; 18 class CCPrioritizedTextureManager;
20 19
21 class CCPrioritizedTexture { 20 class CCPrioritizedTexture {
22 public: 21 public:
23 static scoped_ptr<CCPrioritizedTexture> create(CCPrioritizedTextureManager* manager, IntSize size, GC3Denum format) 22 static scoped_ptr<CCPrioritizedTexture> create(CCPrioritizedTextureManager* manager, IntSize size, GLenum format)
24 { 23 {
25 return make_scoped_ptr(new CCPrioritizedTexture(manager, size, format)); 24 return make_scoped_ptr(new CCPrioritizedTexture(manager, size, format));
26 } 25 }
27 static scoped_ptr<CCPrioritizedTexture> create(CCPrioritizedTextureManager* manager) 26 static scoped_ptr<CCPrioritizedTexture> create(CCPrioritizedTextureManager* manager)
28 { 27 {
29 return make_scoped_ptr(new CCPrioritizedTexture(manager, IntSize(), 0)); 28 return make_scoped_ptr(new CCPrioritizedTexture(manager, IntSize(), 0));
30 } 29 }
31 ~CCPrioritizedTexture(); 30 ~CCPrioritizedTexture();
32 31
33 // Texture properties. Changing these causes the backing texture to be lost. 32 // Texture properties. Changing these causes the backing texture to be lost.
34 // Setting these to the same value is a no-op. 33 // Setting these to the same value is a no-op.
35 void setTextureManager(CCPrioritizedTextureManager*); 34 void setTextureManager(CCPrioritizedTextureManager*);
36 CCPrioritizedTextureManager* textureManager() { return m_manager; } 35 CCPrioritizedTextureManager* textureManager() { return m_manager; }
37 void setDimensions(IntSize, GC3Denum format); 36 void setDimensions(IntSize, GLenum format);
38 GC3Denum format() const { return m_format; } 37 GLenum format() const { return m_format; }
39 IntSize size() const { return m_size; } 38 IntSize size() const { return m_size; }
40 size_t bytes() const { return m_bytes; } 39 size_t bytes() const { return m_bytes; }
41 40
42 // Set priority for the requested texture. 41 // Set priority for the requested texture.
43 void setRequestPriority(int priority) { m_priority = priority; } 42 void setRequestPriority(int priority) { m_priority = priority; }
44 int requestPriority() const { return m_priority; } 43 int requestPriority() const { return m_priority; }
45 44
46 // After CCPrioritizedTexture::prioritizeTextures() is called, this returns 45 // After CCPrioritizedTexture::prioritizeTextures() is called, this returns
47 // 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.
48 bool canAcquireBackingTexture() const { return m_isAbovePriorityCutoff; } 47 bool canAcquireBackingTexture() const { return m_isAbovePriorityCutoff; }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 void setIsSelfManaged(bool isSelfManaged) { m_isSelfManaged = isSelfManaged; } 79 void setIsSelfManaged(bool isSelfManaged) { m_isSelfManaged = isSelfManaged; }
81 bool isSelfManaged() { return m_isSelfManaged; } 80 bool isSelfManaged() { return m_isSelfManaged; }
82 void setToSelfManagedMemoryPlaceholder(size_t bytes); 81 void setToSelfManagedMemoryPlaceholder(size_t bytes);
83 82
84 private: 83 private:
85 friend class CCPrioritizedTextureManager; 84 friend class CCPrioritizedTextureManager;
86 friend class CCPrioritizedTextureTest; 85 friend class CCPrioritizedTextureTest;
87 86
88 class Backing : public CCTexture { 87 class Backing : public CCTexture {
89 public: 88 public:
90 Backing(unsigned id, CCResourceProvider*, IntSize, GC3Denum format); 89 Backing(unsigned id, CCResourceProvider*, IntSize, GLenum format);
91 ~Backing(); 90 ~Backing();
92 void updatePriority(); 91 void updatePriority();
93 void updateInDrawingImplTree(); 92 void updateInDrawingImplTree();
94 93
95 CCPrioritizedTexture* owner() { return m_owner; } 94 CCPrioritizedTexture* owner() { return m_owner; }
96 bool canBeRecycled() const; 95 bool canBeRecycled() const;
97 int requestPriorityAtLastPriorityUpdate() const { return m_priorityAtLas tPriorityUpdate; } 96 int requestPriorityAtLastPriorityUpdate() const { return m_priorityAtLas tPriorityUpdate; }
98 bool wasAbovePriorityCutoffAtLastPriorityUpdate() const { return m_wasAb ovePriorityCutoffAtLastPriorityUpdate; } 97 bool wasAbovePriorityCutoffAtLastPriorityUpdate() const { return m_wasAb ovePriorityCutoffAtLastPriorityUpdate; }
99 bool inDrawingImplTree() const { return m_inDrawingImplTree; } 98 bool inDrawingImplTree() const { return m_inDrawingImplTree; }
100 99
(...skipping 10 matching lines...) Expand all
111 bool m_inDrawingImplTree; 110 bool m_inDrawingImplTree;
112 111
113 bool m_resourceHasBeenDeleted; 112 bool m_resourceHasBeenDeleted;
114 #ifndef NDEBUG 113 #ifndef NDEBUG
115 CCResourceProvider* m_resourceProvider; 114 CCResourceProvider* m_resourceProvider;
116 #endif 115 #endif
117 116
118 DISALLOW_COPY_AND_ASSIGN(Backing); 117 DISALLOW_COPY_AND_ASSIGN(Backing);
119 }; 118 };
120 119
121 CCPrioritizedTexture(CCPrioritizedTextureManager*, IntSize, GC3Denum format) ; 120 CCPrioritizedTexture(CCPrioritizedTextureManager*, IntSize, GLenum format);
122 121
123 bool isAbovePriorityCutoff() { return m_isAbovePriorityCutoff; } 122 bool isAbovePriorityCutoff() { return m_isAbovePriorityCutoff; }
124 void setAbovePriorityCutoff(bool isAbovePriorityCutoff) { m_isAbovePriorityC utoff = isAbovePriorityCutoff; } 123 void setAbovePriorityCutoff(bool isAbovePriorityCutoff) { m_isAbovePriorityC utoff = isAbovePriorityCutoff; }
125 void setManagerInternal(CCPrioritizedTextureManager* manager) { m_manager = manager; } 124 void setManagerInternal(CCPrioritizedTextureManager* manager) { m_manager = manager; }
126 125
127 Backing* backing() const { return m_backing; } 126 Backing* backing() const { return m_backing; }
128 void link(Backing*); 127 void link(Backing*);
129 void unlink(); 128 void unlink();
130 129
131 IntSize m_size; 130 IntSize m_size;
132 GC3Denum m_format; 131 GLenum m_format;
133 size_t m_bytes; 132 size_t m_bytes;
134 133
135 int m_priority; 134 int m_priority;
136 bool m_isAbovePriorityCutoff; 135 bool m_isAbovePriorityCutoff;
137 bool m_isSelfManaged; 136 bool m_isSelfManaged;
138 137
139 Backing* m_backing; 138 Backing* m_backing;
140 CCPrioritizedTextureManager* m_manager; 139 CCPrioritizedTextureManager* m_manager;
141 140
142 DISALLOW_COPY_AND_ASSIGN(CCPrioritizedTexture); 141 DISALLOW_COPY_AND_ASSIGN(CCPrioritizedTexture);
143 }; 142 };
144 143
145 } // namespace cc 144 } // namespace cc
146 145
147 #endif 146 #endif
OLDNEW
« no previous file with comments | « cc/platform_color.h ('k') | cc/prioritized_texture.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698