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