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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 PrioritizedTexture* owner() { return m_owner; } | 100 PrioritizedTexture* owner() { return m_owner; } |
100 bool canBeRecycled() const; | 101 bool canBeRecycled() const; |
101 int requestPriorityAtLastPriorityUpdate() const { return m_priorityAtLas
tPriorityUpdate; } | 102 int requestPriorityAtLastPriorityUpdate() const { return m_priorityAtLas
tPriorityUpdate; } |
102 bool wasAbovePriorityCutoffAtLastPriorityUpdate() const { return m_wasAb
ovePriorityCutoffAtLastPriorityUpdate; } | 103 bool wasAbovePriorityCutoffAtLastPriorityUpdate() const { return m_wasAb
ovePriorityCutoffAtLastPriorityUpdate; } |
103 bool inDrawingImplTree() const { return m_inDrawingImplTree; } | 104 bool inDrawingImplTree() const { return m_inDrawingImplTree; } |
104 | 105 |
105 void deleteResource(ResourceProvider*); | 106 void deleteResource(ResourceProvider*); |
106 bool resourceHasBeenDeleted() const; | 107 bool resourceHasBeenDeleted() const; |
107 | 108 |
108 private: | 109 private: |
| 110 const Proxy* proxy() const; |
| 111 |
109 friend class PrioritizedTexture; | 112 friend class PrioritizedTexture; |
110 PrioritizedTexture* m_owner; | 113 PrioritizedTexture* m_owner; |
111 int m_priorityAtLastPriorityUpdate; | 114 int m_priorityAtLastPriorityUpdate; |
112 bool m_wasAbovePriorityCutoffAtLastPriorityUpdate; | 115 bool m_wasAbovePriorityCutoffAtLastPriorityUpdate; |
113 | 116 |
114 // Set if this is currently-drawing impl tree. | 117 // Set if this is currently-drawing impl tree. |
115 bool m_inDrawingImplTree; | 118 bool m_inDrawingImplTree; |
116 | 119 |
117 bool m_resourceHasBeenDeleted; | 120 bool m_resourceHasBeenDeleted; |
118 #ifndef NDEBUG | 121 #ifndef NDEBUG |
119 ResourceProvider* m_resourceProvider; | 122 ResourceProvider* m_resourceProvider; |
120 #endif | 123 #endif |
121 | |
122 DISALLOW_COPY_AND_ASSIGN(Backing); | 124 DISALLOW_COPY_AND_ASSIGN(Backing); |
123 }; | 125 }; |
124 | 126 |
125 PrioritizedTexture(PrioritizedTextureManager*, IntSize, GLenum format); | 127 PrioritizedTexture(PrioritizedTextureManager*, IntSize, GLenum format); |
126 | 128 |
127 bool isAbovePriorityCutoff() { return m_isAbovePriorityCutoff; } | 129 bool isAbovePriorityCutoff() { return m_isAbovePriorityCutoff; } |
128 void setAbovePriorityCutoff(bool isAbovePriorityCutoff) { m_isAbovePriorityC
utoff = isAbovePriorityCutoff; } | 130 void setAbovePriorityCutoff(bool isAbovePriorityCutoff) { m_isAbovePriorityC
utoff = isAbovePriorityCutoff; } |
129 void setManagerInternal(PrioritizedTextureManager* manager) { m_manager = ma
nager; } | 131 void setManagerInternal(PrioritizedTextureManager* manager) { m_manager = ma
nager; } |
130 | 132 |
131 Backing* backing() const { return m_backing; } | 133 Backing* backing() const { return m_backing; } |
(...skipping 11 matching lines...) Expand all Loading... |
143 | 145 |
144 Backing* m_backing; | 146 Backing* m_backing; |
145 PrioritizedTextureManager* m_manager; | 147 PrioritizedTextureManager* m_manager; |
146 | 148 |
147 DISALLOW_COPY_AND_ASSIGN(PrioritizedTexture); | 149 DISALLOW_COPY_AND_ASSIGN(PrioritizedTexture); |
148 }; | 150 }; |
149 | 151 |
150 } // namespace cc | 152 } // namespace cc |
151 | 153 |
152 #endif | 154 #endif |
OLD | NEW |