| 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 #include "config.h" | 5 #include "config.h" | 
| 6 | 6 | 
| 7 #include "CCPrioritizedTexture.h" | 7 #include "CCPrioritizedTexture.h" | 
| 8 | 8 | 
| 9 #include "CCPrioritizedTextureManager.h" | 9 #include "CCPrioritizedTextureManager.h" | 
| 10 #include "CCPriorityCalculator.h" | 10 #include "CCPriorityCalculator.h" | 
|  | 11 #include "CCProxy.h" | 
| 11 #include <algorithm> | 12 #include <algorithm> | 
| 12 | 13 | 
| 13 using namespace std; | 14 using namespace std; | 
| 14 | 15 | 
| 15 namespace cc { | 16 namespace cc { | 
| 16 | 17 | 
| 17 CCPrioritizedTexture::CCPrioritizedTexture(CCPrioritizedTextureManager* manager,
      IntSize size, GC3Denum format) | 18 CCPrioritizedTexture::CCPrioritizedTexture(CCPrioritizedTextureManager* manager,
      IntSize size, GC3Denum format) | 
| 18     : m_size(size) | 19     : m_size(size) | 
| 19     , m_format(format) | 20     , m_format(format) | 
| 20     , m_bytes(0) | 21     , m_bytes(0) | 
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 112     m_backing = 0; | 113     m_backing = 0; | 
| 113 } | 114 } | 
| 114 | 115 | 
| 115 void CCPrioritizedTexture::setToSelfManagedMemoryPlaceholder(size_t bytes) | 116 void CCPrioritizedTexture::setToSelfManagedMemoryPlaceholder(size_t bytes) | 
| 116 { | 117 { | 
| 117     setDimensions(IntSize(), GraphicsContext3D::RGBA); | 118     setDimensions(IntSize(), GraphicsContext3D::RGBA); | 
| 118     setIsSelfManaged(true); | 119     setIsSelfManaged(true); | 
| 119     m_bytes = bytes; | 120     m_bytes = bytes; | 
| 120 } | 121 } | 
| 121 | 122 | 
|  | 123 CCPrioritizedTexture::Backing::Backing(unsigned id, IntSize size, GC3Denum forma
     t) | 
|  | 124     : CCTexture(id, size, format) | 
|  | 125     , m_owner(0) | 
|  | 126     , m_priorityAtLastPriorityUpdate(CCPriorityCalculator::lowestPriority()) | 
|  | 127     , m_ownerExistedAtLastPriorityUpdate(false) | 
|  | 128     , m_wasAbovePriorityCutoffAtLastPriorityUpdate(false) | 
|  | 129 { | 
|  | 130 } | 
|  | 131 | 
|  | 132 CCPrioritizedTexture::Backing::~Backing() | 
|  | 133 { | 
|  | 134     ASSERT(!m_owner); | 
|  | 135 } | 
|  | 136 | 
|  | 137 void CCPrioritizedTexture::Backing::updatePriority() | 
|  | 138 { | 
|  | 139     ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); | 
|  | 140     if (m_owner) { | 
|  | 141         m_ownerExistedAtLastPriorityUpdate = true; | 
|  | 142         m_priorityAtLastPriorityUpdate = m_owner->requestPriority(); | 
|  | 143         m_wasAbovePriorityCutoffAtLastPriorityUpdate = m_owner->isAbovePriorityC
     utoff(); | 
|  | 144     } else { | 
|  | 145         m_ownerExistedAtLastPriorityUpdate = false; | 
|  | 146         m_priorityAtLastPriorityUpdate = CCPriorityCalculator::lowestPriority(); | 
|  | 147         m_wasAbovePriorityCutoffAtLastPriorityUpdate = false; | 
|  | 148     } | 
|  | 149 } | 
|  | 150 | 
| 122 } // namespace cc | 151 } // namespace cc | 
| OLD | NEW | 
|---|