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