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_PRIORITIZED_TEXTURE_H_ | 5 #ifndef CC_PRIORITIZED_TEXTURE_H_ |
6 #define CC_PRIORITIZED_TEXTURE_H_ | 6 #define CC_PRIORITIZED_TEXTURE_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" |
11 #include "cc/cc_export.h" | 11 #include "cc/cc_export.h" |
12 #include "cc/priority_calculator.h" | 12 #include "cc/priority_calculator.h" |
13 #include "cc/resource_provider.h" | 13 #include "cc/resource_provider.h" |
14 #include "cc/texture.h" | 14 #include "cc/texture.h" |
15 #include "ui/gfx/rect.h" | 15 #include "ui/gfx/rect.h" |
16 #include "ui/gfx/size.h" | 16 #include "ui/gfx/size.h" |
17 #include "ui/gfx/vector2d.h" | 17 #include "ui/gfx/vector2d.h" |
18 #include "third_party/khronos/GLES2/gl2.h" | 18 #include "third_party/khronos/GLES2/gl2.h" |
19 | 19 |
20 namespace cc { | 20 namespace cc { |
21 | 21 |
22 class PrioritizedTextureManager; | 22 class PrioritizedTextureManager; |
23 class Proxy; | |
24 | 23 |
25 class CC_EXPORT PrioritizedTexture { | 24 class CC_EXPORT PrioritizedTexture { |
26 public: | 25 public: |
27 static scoped_ptr<PrioritizedTexture> create(PrioritizedTextureManager* mana
ger, gfx::Size size, GLenum format) | 26 static scoped_ptr<PrioritizedTexture> create(PrioritizedTextureManager* mana
ger, gfx::Size size, GLenum format) |
28 { | 27 { |
29 return make_scoped_ptr(new PrioritizedTexture(manager, size, format)); | 28 return make_scoped_ptr(new PrioritizedTexture(manager, size, format)); |
30 } | 29 } |
31 static scoped_ptr<PrioritizedTexture> create(PrioritizedTextureManager* mana
ger) | 30 static scoped_ptr<PrioritizedTexture> create(PrioritizedTextureManager* mana
ger) |
32 { | 31 { |
33 return make_scoped_ptr(new PrioritizedTexture(manager, gfx::Size(), 0)); | 32 return make_scoped_ptr(new PrioritizedTexture(manager, gfx::Size(), 0)); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 PrioritizedTexture* owner() { return m_owner; } | 101 PrioritizedTexture* owner() { return m_owner; } |
103 bool canBeRecycled() const; | 102 bool canBeRecycled() const; |
104 int requestPriorityAtLastPriorityUpdate() const { return m_priorityAtLas
tPriorityUpdate; } | 103 int requestPriorityAtLastPriorityUpdate() const { return m_priorityAtLas
tPriorityUpdate; } |
105 bool wasAbovePriorityCutoffAtLastPriorityUpdate() const { return m_wasAb
ovePriorityCutoffAtLastPriorityUpdate; } | 104 bool wasAbovePriorityCutoffAtLastPriorityUpdate() const { return m_wasAb
ovePriorityCutoffAtLastPriorityUpdate; } |
106 bool inDrawingImplTree() const { return m_inDrawingImplTree; } | 105 bool inDrawingImplTree() const { return m_inDrawingImplTree; } |
107 | 106 |
108 void deleteResource(ResourceProvider*); | 107 void deleteResource(ResourceProvider*); |
109 bool resourceHasBeenDeleted() const; | 108 bool resourceHasBeenDeleted() const; |
110 | 109 |
111 private: | 110 private: |
112 const Proxy* proxy() const; | |
113 | |
114 friend class PrioritizedTexture; | 111 friend class PrioritizedTexture; |
115 PrioritizedTexture* m_owner; | 112 PrioritizedTexture* m_owner; |
116 int m_priorityAtLastPriorityUpdate; | 113 int m_priorityAtLastPriorityUpdate; |
117 bool m_wasAbovePriorityCutoffAtLastPriorityUpdate; | 114 bool m_wasAbovePriorityCutoffAtLastPriorityUpdate; |
118 | 115 |
119 // Set if this is currently-drawing impl tree. | 116 // Set if this is currently-drawing impl tree. |
120 bool m_inDrawingImplTree; | 117 bool m_inDrawingImplTree; |
121 | 118 |
122 bool m_resourceHasBeenDeleted; | 119 bool m_resourceHasBeenDeleted; |
123 #ifndef NDEBUG | 120 #ifndef NDEBUG |
124 ResourceProvider* m_resourceProvider; | 121 ResourceProvider* m_resourceProvider; |
125 #endif | 122 #endif |
| 123 |
126 DISALLOW_COPY_AND_ASSIGN(Backing); | 124 DISALLOW_COPY_AND_ASSIGN(Backing); |
127 }; | 125 }; |
128 | 126 |
129 PrioritizedTexture(PrioritizedTextureManager*, gfx::Size, GLenum format); | 127 PrioritizedTexture(PrioritizedTextureManager*, gfx::Size, GLenum format); |
130 | 128 |
131 bool isAbovePriorityCutoff() { return m_isAbovePriorityCutoff; } | 129 bool isAbovePriorityCutoff() { return m_isAbovePriorityCutoff; } |
132 void setAbovePriorityCutoff(bool isAbovePriorityCutoff) { m_isAbovePriorityC
utoff = isAbovePriorityCutoff; } | 130 void setAbovePriorityCutoff(bool isAbovePriorityCutoff) { m_isAbovePriorityC
utoff = isAbovePriorityCutoff; } |
133 void setManagerInternal(PrioritizedTextureManager* manager) { m_manager = ma
nager; } | 131 void setManagerInternal(PrioritizedTextureManager* manager) { m_manager = ma
nager; } |
134 | 132 |
135 Backing* backing() const { return m_backing; } | 133 Backing* backing() const { return m_backing; } |
(...skipping 11 matching lines...) Expand all Loading... |
147 | 145 |
148 Backing* m_backing; | 146 Backing* m_backing; |
149 PrioritizedTextureManager* m_manager; | 147 PrioritizedTextureManager* m_manager; |
150 | 148 |
151 DISALLOW_COPY_AND_ASSIGN(PrioritizedTexture); | 149 DISALLOW_COPY_AND_ASSIGN(PrioritizedTexture); |
152 }; | 150 }; |
153 | 151 |
154 } // namespace cc | 152 } // namespace cc |
155 | 153 |
156 #endif // CC_PRIORITIZED_TEXTURE_H_ | 154 #endif // CC_PRIORITIZED_TEXTURE_H_ |
OLD | NEW |