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