| 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 "CCPriorityCalculator.h" |    8 #include "CCPriorityCalculator.h" | 
|    9 #include "CCResourceProvider.h" |    9 #include "CCResourceProvider.h" | 
|   10 #include "CCTexture.h" |   10 #include "CCTexture.h" | 
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   73     // Self-managed textures are accounted for when prioritizing other textures, |   73     // Self-managed textures are accounted for when prioritizing other textures, | 
|   74     // but they are not allocated/recycled/deleted, so this needs to be done |   74     // but they are not allocated/recycled/deleted, so this needs to be done | 
|   75     // externally. canAcquireBackingTexture() indicates if the texture would hav
     e |   75     // externally. canAcquireBackingTexture() indicates if the texture would hav
     e | 
|   76     // been allowed given its priority. |   76     // been allowed given its priority. | 
|   77     void setIsSelfManaged(bool isSelfManaged) { m_isSelfManaged = isSelfManaged;
      } |   77     void setIsSelfManaged(bool isSelfManaged) { m_isSelfManaged = isSelfManaged;
      } | 
|   78     bool isSelfManaged() { return m_isSelfManaged; } |   78     bool isSelfManaged() { return m_isSelfManaged; } | 
|   79     void setToSelfManagedMemoryPlaceholder(size_t bytes); |   79     void setToSelfManagedMemoryPlaceholder(size_t bytes); | 
|   80  |   80  | 
|   81 private: |   81 private: | 
|   82     friend class CCPrioritizedTextureManager; |   82     friend class CCPrioritizedTextureManager; | 
 |   83     friend class CCPrioritizedTextureTest; | 
|   83  |   84  | 
|   84     class Backing : public CCTexture { |   85     class Backing : public CCTexture { | 
|   85         WTF_MAKE_NONCOPYABLE(Backing); |   86         WTF_MAKE_NONCOPYABLE(Backing); | 
|   86     public: |   87     public: | 
|   87         Backing(unsigned id, IntSize size, GC3Denum format) |   88         Backing(unsigned id, IntSize, GC3Denum format); | 
|   88             : CCTexture(id, size, format), m_owner(0) { } |   89         ~Backing(); | 
|   89         ~Backing() { ASSERT(!m_owner); } |   90         void updatePriority(); | 
|   90  |   91  | 
|   91         CCPrioritizedTexture* owner() { return m_owner; } |   92         CCPrioritizedTexture* owner() { return m_owner; } | 
 |   93         bool hadOwnerAtLastPriorityUpdate() const { return m_ownerExistedAtLastP
     riorityUpdate; } | 
 |   94         bool requestPriorityAtLastPriorityUpdate() const { return m_priorityAtLa
     stPriorityUpdate; } | 
 |   95         bool wasAbovePriorityCutoffAtLastPriorityUpdate() const { return m_wasAb
     ovePriorityCutoffAtLastPriorityUpdate; } | 
 |   96  | 
|   92     private: |   97     private: | 
|   93         friend class CCPrioritizedTexture; |   98         friend class CCPrioritizedTexture; | 
|   94         CCPrioritizedTexture* m_owner; |   99         CCPrioritizedTexture* m_owner; | 
 |  100         int m_priorityAtLastPriorityUpdate; | 
 |  101         bool m_ownerExistedAtLastPriorityUpdate; | 
 |  102         bool m_wasAbovePriorityCutoffAtLastPriorityUpdate; | 
|   95     }; |  103     }; | 
|   96  |  104  | 
|   97     CCPrioritizedTexture(CCPrioritizedTextureManager*, IntSize, GC3Denum format)
     ; |  105     CCPrioritizedTexture(CCPrioritizedTextureManager*, IntSize, GC3Denum format)
     ; | 
|   98  |  106  | 
|   99     bool isAbovePriorityCutoff() { return m_isAbovePriorityCutoff; } |  107     bool isAbovePriorityCutoff() { return m_isAbovePriorityCutoff; } | 
|  100     void setAbovePriorityCutoff(bool isAbovePriorityCutoff) { m_isAbovePriorityC
     utoff = isAbovePriorityCutoff; } |  108     void setAbovePriorityCutoff(bool isAbovePriorityCutoff) { m_isAbovePriorityC
     utoff = isAbovePriorityCutoff; } | 
|  101     void setManagerInternal(CCPrioritizedTextureManager* manager) { m_manager = 
     manager; } |  109     void setManagerInternal(CCPrioritizedTextureManager* manager) { m_manager = 
     manager; } | 
|  102  |  110  | 
|  103     Backing* backing() const { return m_backing; } |  111     Backing* backing() const { return m_backing; } | 
|  104     void link(Backing*); |  112     void link(Backing*); | 
|  105     void unlink(); |  113     void unlink(); | 
|  106  |  114  | 
|  107     IntSize m_size; |  115     IntSize m_size; | 
|  108     GC3Denum m_format; |  116     GC3Denum m_format; | 
|  109     size_t m_bytes; |  117     size_t m_bytes; | 
|  110  |  118  | 
|  111     int m_priority; |  119     int m_priority; | 
|  112     bool m_isAbovePriorityCutoff; |  120     bool m_isAbovePriorityCutoff; | 
|  113     bool m_isSelfManaged; |  121     bool m_isSelfManaged; | 
|  114  |  122  | 
|  115     Backing* m_backing; |  123     Backing* m_backing; | 
|  116     CCPrioritizedTextureManager* m_manager; |  124     CCPrioritizedTextureManager* m_manager; | 
|  117 }; |  125 }; | 
|  118  |  126  | 
|  119 } // namespace cc |  127 } // namespace cc | 
|  120  |  128  | 
|  121 #endif |  129 #endif | 
| OLD | NEW |