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.h" |
13 #include "cc/resource_provider.h" | 14 #include "cc/resource_provider.h" |
14 #include "cc/texture.h" | 15 #include "third_party/khronos/GLES2/gl2.h" |
15 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.h" |
16 #include "ui/gfx/size.h" | 17 #include "ui/gfx/size.h" |
17 #include "ui/gfx/vector2d.h" | 18 #include "ui/gfx/vector2d.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 class Proxy; |
24 | 24 |
25 class CC_EXPORT PrioritizedResource { | 25 class CC_EXPORT PrioritizedResource { |
26 public: | 26 public: |
27 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) |
28 { | 28 { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 void setIsSelfManaged(bool isSelfManaged) { m_isSelfManaged = isSelfManaged;
} | 85 void setIsSelfManaged(bool isSelfManaged) { m_isSelfManaged = isSelfManaged;
} |
86 bool isSelfManaged() { return m_isSelfManaged; } | 86 bool isSelfManaged() { return m_isSelfManaged; } |
87 void setToSelfManagedMemoryPlaceholder(size_t bytes); | 87 void setToSelfManagedMemoryPlaceholder(size_t bytes); |
88 | 88 |
89 void returnBackingTexture(); | 89 void returnBackingTexture(); |
90 | 90 |
91 private: | 91 private: |
92 friend class PrioritizedResourceManager; | 92 friend class PrioritizedResourceManager; |
93 friend class PrioritizedResourceTest; | 93 friend class PrioritizedResourceTest; |
94 | 94 |
95 class Backing : public Texture { | 95 class Backing : public Resource { |
96 public: | 96 public: |
97 Backing(unsigned id, ResourceProvider*, gfx::Size, GLenum format); | 97 Backing(unsigned id, ResourceProvider*, gfx::Size, GLenum format); |
98 ~Backing(); | 98 ~Backing(); |
99 void updatePriority(); | 99 void updatePriority(); |
100 void updateInDrawingImplTree(); | 100 void updateInDrawingImplTree(); |
101 | 101 |
102 PrioritizedResource* owner() { return m_owner; } | 102 PrioritizedResource* owner() { return m_owner; } |
103 bool canBeRecycled() const; | 103 bool canBeRecycled() const; |
104 int requestPriorityAtLastPriorityUpdate() const { return m_priorityAtLas
tPriorityUpdate; } | 104 int requestPriorityAtLastPriorityUpdate() const { return m_priorityAtLas
tPriorityUpdate; } |
105 bool wasAbovePriorityCutoffAtLastPriorityUpdate() const { return m_wasAb
ovePriorityCutoffAtLastPriorityUpdate; } | 105 bool wasAbovePriorityCutoffAtLastPriorityUpdate() const { return m_wasAb
ovePriorityCutoffAtLastPriorityUpdate; } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 147 |
148 Backing* m_backing; | 148 Backing* m_backing; |
149 PrioritizedResourceManager* m_manager; | 149 PrioritizedResourceManager* m_manager; |
150 | 150 |
151 DISALLOW_COPY_AND_ASSIGN(PrioritizedResource); | 151 DISALLOW_COPY_AND_ASSIGN(PrioritizedResource); |
152 }; | 152 }; |
153 | 153 |
154 } // namespace cc | 154 } // namespace cc |
155 | 155 |
156 #endif // CC_PRIORITIZED_RESOURCE_H_ | 156 #endif // CC_PRIORITIZED_RESOURCE_H_ |
OLD | NEW |