| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "CCSingleThreadProxy.h" | 7 #include "CCSingleThreadProxy.h" |
| 8 | 8 |
| 9 #include "CCDrawQuad.h" | 9 #include "CCDrawQuad.h" |
| 10 #include "CCGraphicsContext.h" | 10 #include "CCGraphicsContext.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 } | 24 } |
| 25 | 25 |
| 26 CCSingleThreadProxy::CCSingleThreadProxy(CCLayerTreeHost* layerTreeHost) | 26 CCSingleThreadProxy::CCSingleThreadProxy(CCLayerTreeHost* layerTreeHost) |
| 27 : m_layerTreeHost(layerTreeHost) | 27 : m_layerTreeHost(layerTreeHost) |
| 28 , m_contextLost(false) | 28 , m_contextLost(false) |
| 29 , m_rendererInitialized(false) | 29 , m_rendererInitialized(false) |
| 30 , m_nextFrameIsNewlyCommittedFrame(false) | 30 , m_nextFrameIsNewlyCommittedFrame(false) |
| 31 , m_totalCommitCount(0) | 31 , m_totalCommitCount(0) |
| 32 { | 32 { |
| 33 TRACE_EVENT0("cc", "CCSingleThreadProxy::CCSingleThreadProxy"); | 33 TRACE_EVENT0("cc", "CCSingleThreadProxy::CCSingleThreadProxy"); |
| 34 ASSERT(CCProxy::isMainThread()); | 34 CC_DCHECK(CCProxy::isMainThread()); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void CCSingleThreadProxy::start() | 37 void CCSingleThreadProxy::start() |
| 38 { | 38 { |
| 39 DebugScopedSetImplThread impl; | 39 DebugScopedSetImplThread impl; |
| 40 m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this); | 40 m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this); |
| 41 } | 41 } |
| 42 | 42 |
| 43 CCSingleThreadProxy::~CCSingleThreadProxy() | 43 CCSingleThreadProxy::~CCSingleThreadProxy() |
| 44 { | 44 { |
| 45 TRACE_EVENT0("cc", "CCSingleThreadProxy::~CCSingleThreadProxy"); | 45 TRACE_EVENT0("cc", "CCSingleThreadProxy::~CCSingleThreadProxy"); |
| 46 ASSERT(CCProxy::isMainThread()); | 46 CC_DCHECK(CCProxy::isMainThread()); |
| 47 ASSERT(!m_layerTreeHostImpl.get() && !m_layerTreeHost); // make sure stop()
got called. | 47 CC_DCHECK(!m_layerTreeHostImpl.get() && !m_layerTreeHost); // make sure stop
() got called. |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool CCSingleThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect
) | 50 bool CCSingleThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect
) |
| 51 { | 51 { |
| 52 TRACE_EVENT0("cc", "CCSingleThreadProxy::compositeAndReadback"); | 52 TRACE_EVENT0("cc", "CCSingleThreadProxy::compositeAndReadback"); |
| 53 ASSERT(CCProxy::isMainThread()); | 53 CC_DCHECK(CCProxy::isMainThread()); |
| 54 | 54 |
| 55 if (!commitAndComposite()) | 55 if (!commitAndComposite()) |
| 56 return false; | 56 return false; |
| 57 | 57 |
| 58 m_layerTreeHostImpl->readback(pixels, rect); | 58 m_layerTreeHostImpl->readback(pixels, rect); |
| 59 | 59 |
| 60 if (m_layerTreeHostImpl->isContextLost()) | 60 if (m_layerTreeHostImpl->isContextLost()) |
| 61 return false; | 61 return false; |
| 62 | 62 |
| 63 m_layerTreeHostImpl->swapBuffers(); | 63 m_layerTreeHostImpl->swapBuffers(); |
| 64 didSwapFrame(); | 64 didSwapFrame(); |
| 65 | 65 |
| 66 return true; | 66 return true; |
| 67 } | 67 } |
| 68 | 68 |
| 69 void CCSingleThreadProxy::startPageScaleAnimation(const IntSize& targetPosition,
bool useAnchor, float scale, double duration) | 69 void CCSingleThreadProxy::startPageScaleAnimation(const IntSize& targetPosition,
bool useAnchor, float scale, double duration) |
| 70 { | 70 { |
| 71 m_layerTreeHostImpl->startPageScaleAnimation(targetPosition, useAnchor, scal
e, monotonicallyIncreasingTime(), duration); | 71 m_layerTreeHostImpl->startPageScaleAnimation(targetPosition, useAnchor, scal
e, monotonicallyIncreasingTime(), duration); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void CCSingleThreadProxy::finishAllRendering() | 74 void CCSingleThreadProxy::finishAllRendering() |
| 75 { | 75 { |
| 76 ASSERT(CCProxy::isMainThread()); | 76 CC_DCHECK(CCProxy::isMainThread()); |
| 77 { | 77 { |
| 78 DebugScopedSetImplThread impl; | 78 DebugScopedSetImplThread impl; |
| 79 m_layerTreeHostImpl->finishAllRendering(); | 79 m_layerTreeHostImpl->finishAllRendering(); |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 | 82 |
| 83 bool CCSingleThreadProxy::isStarted() const | 83 bool CCSingleThreadProxy::isStarted() const |
| 84 { | 84 { |
| 85 ASSERT(CCProxy::isMainThread()); | 85 CC_DCHECK(CCProxy::isMainThread()); |
| 86 return m_layerTreeHostImpl.get(); | 86 return m_layerTreeHostImpl.get(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 bool CCSingleThreadProxy::initializeContext() | 89 bool CCSingleThreadProxy::initializeContext() |
| 90 { | 90 { |
| 91 ASSERT(CCProxy::isMainThread()); | 91 CC_DCHECK(CCProxy::isMainThread()); |
| 92 scoped_ptr<CCGraphicsContext> context = m_layerTreeHost->createContext(); | 92 scoped_ptr<CCGraphicsContext> context = m_layerTreeHost->createContext(); |
| 93 if (!context.get()) | 93 if (!context.get()) |
| 94 return false; | 94 return false; |
| 95 m_contextBeforeInitialization = context.Pass(); | 95 m_contextBeforeInitialization = context.Pass(); |
| 96 return true; | 96 return true; |
| 97 } | 97 } |
| 98 | 98 |
| 99 void CCSingleThreadProxy::setSurfaceReady() | 99 void CCSingleThreadProxy::setSurfaceReady() |
| 100 { | 100 { |
| 101 // Scheduling is controlled by the embedder in the single thread case, so no
thing to do. | 101 // Scheduling is controlled by the embedder in the single thread case, so no
thing to do. |
| 102 } | 102 } |
| 103 | 103 |
| 104 void CCSingleThreadProxy::setVisible(bool visible) | 104 void CCSingleThreadProxy::setVisible(bool visible) |
| 105 { | 105 { |
| 106 DebugScopedSetImplThread impl; | 106 DebugScopedSetImplThread impl; |
| 107 m_layerTreeHostImpl->setVisible(visible); | 107 m_layerTreeHostImpl->setVisible(visible); |
| 108 } | 108 } |
| 109 | 109 |
| 110 bool CCSingleThreadProxy::initializeRenderer() | 110 bool CCSingleThreadProxy::initializeRenderer() |
| 111 { | 111 { |
| 112 ASSERT(CCProxy::isMainThread()); | 112 CC_DCHECK(CCProxy::isMainThread()); |
| 113 ASSERT(m_contextBeforeInitialization.get()); | 113 CC_DCHECK(m_contextBeforeInitialization.get()); |
| 114 { | 114 { |
| 115 DebugScopedSetImplThread impl; | 115 DebugScopedSetImplThread impl; |
| 116 bool ok = m_layerTreeHostImpl->initializeRenderer(m_contextBeforeInitial
ization.Pass()); | 116 bool ok = m_layerTreeHostImpl->initializeRenderer(m_contextBeforeInitial
ization.Pass()); |
| 117 if (ok) { | 117 if (ok) { |
| 118 m_rendererInitialized = true; | 118 m_rendererInitialized = true; |
| 119 m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererC
apabilities(); | 119 m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererC
apabilities(); |
| 120 } | 120 } |
| 121 | 121 |
| 122 return ok; | 122 return ok; |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 | 125 |
| 126 bool CCSingleThreadProxy::recreateContext() | 126 bool CCSingleThreadProxy::recreateContext() |
| 127 { | 127 { |
| 128 TRACE_EVENT0("cc", "CCSingleThreadProxy::recreateContext"); | 128 TRACE_EVENT0("cc", "CCSingleThreadProxy::recreateContext"); |
| 129 ASSERT(CCProxy::isMainThread()); | 129 CC_DCHECK(CCProxy::isMainThread()); |
| 130 ASSERT(m_contextLost); | 130 CC_DCHECK(m_contextLost); |
| 131 | 131 |
| 132 scoped_ptr<CCGraphicsContext> context = m_layerTreeHost->createContext(); | 132 scoped_ptr<CCGraphicsContext> context = m_layerTreeHost->createContext(); |
| 133 if (!context.get()) | 133 if (!context.get()) |
| 134 return false; | 134 return false; |
| 135 | 135 |
| 136 bool initialized; | 136 bool initialized; |
| 137 { | 137 { |
| 138 DebugScopedSetMainThreadBlocked mainThreadBlocked; | 138 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
| 139 DebugScopedSetImplThread impl; | 139 DebugScopedSetImplThread impl; |
| 140 if (!m_layerTreeHostImpl->contentsTexturesPurged()) | 140 if (!m_layerTreeHostImpl->contentsTexturesPurged()) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 153 | 153 |
| 154 void CCSingleThreadProxy::renderingStats(CCRenderingStats* stats) | 154 void CCSingleThreadProxy::renderingStats(CCRenderingStats* stats) |
| 155 { | 155 { |
| 156 stats->totalCommitTimeInSeconds = m_totalCommitTime.InSecondsF(); | 156 stats->totalCommitTimeInSeconds = m_totalCommitTime.InSecondsF(); |
| 157 stats->totalCommitCount = m_totalCommitCount; | 157 stats->totalCommitCount = m_totalCommitCount; |
| 158 m_layerTreeHostImpl->renderingStats(stats); | 158 m_layerTreeHostImpl->renderingStats(stats); |
| 159 } | 159 } |
| 160 | 160 |
| 161 const RendererCapabilities& CCSingleThreadProxy::rendererCapabilities() const | 161 const RendererCapabilities& CCSingleThreadProxy::rendererCapabilities() const |
| 162 { | 162 { |
| 163 ASSERT(m_rendererInitialized); | 163 CC_DCHECK(m_rendererInitialized); |
| 164 // Note: this gets called during the commit by the "impl" thread | 164 // Note: this gets called during the commit by the "impl" thread |
| 165 return m_RendererCapabilitiesForMainThread; | 165 return m_RendererCapabilitiesForMainThread; |
| 166 } | 166 } |
| 167 | 167 |
| 168 void CCSingleThreadProxy::loseContext() | 168 void CCSingleThreadProxy::loseContext() |
| 169 { | 169 { |
| 170 ASSERT(CCProxy::isMainThread()); | 170 CC_DCHECK(CCProxy::isMainThread()); |
| 171 m_layerTreeHost->didLoseContext(); | 171 m_layerTreeHost->didLoseContext(); |
| 172 m_contextLost = true; | 172 m_contextLost = true; |
| 173 } | 173 } |
| 174 | 174 |
| 175 void CCSingleThreadProxy::setNeedsAnimate() | 175 void CCSingleThreadProxy::setNeedsAnimate() |
| 176 { | 176 { |
| 177 // CCThread-only feature | 177 // CCThread-only feature |
| 178 ASSERT_NOT_REACHED(); | 178 NOTREACHED(); |
| 179 } | 179 } |
| 180 | 180 |
| 181 void CCSingleThreadProxy::doCommit(scoped_ptr<CCTextureUpdateQueue> queue) | 181 void CCSingleThreadProxy::doCommit(scoped_ptr<CCTextureUpdateQueue> queue) |
| 182 { | 182 { |
| 183 ASSERT(CCProxy::isMainThread()); | 183 CC_DCHECK(CCProxy::isMainThread()); |
| 184 // Commit immediately | 184 // Commit immediately |
| 185 { | 185 { |
| 186 DebugScopedSetMainThreadBlocked mainThreadBlocked; | 186 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
| 187 DebugScopedSetImplThread impl; | 187 DebugScopedSetImplThread impl; |
| 188 | 188 |
| 189 base::TimeTicks startTime = base::TimeTicks::HighResNow(); | 189 base::TimeTicks startTime = base::TimeTicks::HighResNow(); |
| 190 m_layerTreeHostImpl->beginCommit(); | 190 m_layerTreeHostImpl->beginCommit(); |
| 191 | 191 |
| 192 m_layerTreeHost->contentsTextureManager()->pushTexturePrioritiesToBackin
gs(); | 192 m_layerTreeHost->contentsTextureManager()->pushTexturePrioritiesToBackin
gs(); |
| 193 m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get()); | 193 m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get()); |
| 194 | 194 |
| 195 scoped_ptr<CCTextureUpdateController> updateController = | 195 scoped_ptr<CCTextureUpdateController> updateController = |
| 196 CCTextureUpdateController::create( | 196 CCTextureUpdateController::create( |
| 197 NULL, | 197 NULL, |
| 198 CCProxy::mainThread(), | 198 CCProxy::mainThread(), |
| 199 queue.Pass(), | 199 queue.Pass(), |
| 200 m_layerTreeHostImpl->resourceProvider(), | 200 m_layerTreeHostImpl->resourceProvider(), |
| 201 m_layerTreeHostImpl->resourceProvider()->textureUploader()); | 201 m_layerTreeHostImpl->resourceProvider()->textureUploader()); |
| 202 updateController->finalize(); | 202 updateController->finalize(); |
| 203 | 203 |
| 204 m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); | 204 m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); |
| 205 | 205 |
| 206 m_layerTreeHostImpl->commitComplete(); | 206 m_layerTreeHostImpl->commitComplete(); |
| 207 | 207 |
| 208 #if !ASSERT_DISABLED | 208 #if CC_DCHECK_ENABLED |
| 209 // In the single-threaded case, the scroll deltas should never be | 209 // In the single-threaded case, the scroll deltas should never be |
| 210 // touched on the impl layer tree. | 210 // touched on the impl layer tree. |
| 211 scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_layerTreeHostImpl->proces
sScrollDeltas(); | 211 scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_layerTreeHostImpl->proces
sScrollDeltas(); |
| 212 ASSERT(!scrollInfo->scrolls.size()); | 212 CC_DCHECK(!scrollInfo->scrolls.size()); |
| 213 #endif | 213 #endif |
| 214 | 214 |
| 215 base::TimeTicks endTime = base::TimeTicks::HighResNow(); | 215 base::TimeTicks endTime = base::TimeTicks::HighResNow(); |
| 216 m_totalCommitTime += endTime - startTime; | 216 m_totalCommitTime += endTime - startTime; |
| 217 m_totalCommitCount++; | 217 m_totalCommitCount++; |
| 218 } | 218 } |
| 219 m_layerTreeHost->commitComplete(); | 219 m_layerTreeHost->commitComplete(); |
| 220 m_nextFrameIsNewlyCommittedFrame = true; | 220 m_nextFrameIsNewlyCommittedFrame = true; |
| 221 } | 221 } |
| 222 | 222 |
| 223 void CCSingleThreadProxy::setNeedsCommit() | 223 void CCSingleThreadProxy::setNeedsCommit() |
| 224 { | 224 { |
| 225 ASSERT(CCProxy::isMainThread()); | 225 CC_DCHECK(CCProxy::isMainThread()); |
| 226 m_layerTreeHost->scheduleComposite(); | 226 m_layerTreeHost->scheduleComposite(); |
| 227 } | 227 } |
| 228 | 228 |
| 229 void CCSingleThreadProxy::setNeedsRedraw() | 229 void CCSingleThreadProxy::setNeedsRedraw() |
| 230 { | 230 { |
| 231 // FIXME: Once we move render_widget scheduling into this class, we can | 231 // FIXME: Once we move render_widget scheduling into this class, we can |
| 232 // treat redraw requests more efficiently than commitAndRedraw requests. | 232 // treat redraw requests more efficiently than commitAndRedraw requests. |
| 233 m_layerTreeHostImpl->setFullRootLayerDamage(); | 233 m_layerTreeHostImpl->setFullRootLayerDamage(); |
| 234 setNeedsCommit(); | 234 setNeedsCommit(); |
| 235 } | 235 } |
| 236 | 236 |
| 237 bool CCSingleThreadProxy::commitRequested() const | 237 bool CCSingleThreadProxy::commitRequested() const |
| 238 { | 238 { |
| 239 return false; | 239 return false; |
| 240 } | 240 } |
| 241 | 241 |
| 242 void CCSingleThreadProxy::didAddAnimation() | 242 void CCSingleThreadProxy::didAddAnimation() |
| 243 { | 243 { |
| 244 } | 244 } |
| 245 | 245 |
| 246 size_t CCSingleThreadProxy::maxPartialTextureUpdates() const | 246 size_t CCSingleThreadProxy::maxPartialTextureUpdates() const |
| 247 { | 247 { |
| 248 return std::numeric_limits<size_t>::max(); | 248 return std::numeric_limits<size_t>::max(); |
| 249 } | 249 } |
| 250 | 250 |
| 251 void CCSingleThreadProxy::stop() | 251 void CCSingleThreadProxy::stop() |
| 252 { | 252 { |
| 253 TRACE_EVENT0("cc", "CCSingleThreadProxy::stop"); | 253 TRACE_EVENT0("cc", "CCSingleThreadProxy::stop"); |
| 254 ASSERT(CCProxy::isMainThread()); | 254 CC_DCHECK(CCProxy::isMainThread()); |
| 255 { | 255 { |
| 256 DebugScopedSetMainThreadBlocked mainThreadBlocked; | 256 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
| 257 DebugScopedSetImplThread impl; | 257 DebugScopedSetImplThread impl; |
| 258 | 258 |
| 259 if (!m_layerTreeHostImpl->contentsTexturesPurged()) | 259 if (!m_layerTreeHostImpl->contentsTexturesPurged()) |
| 260 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostI
mpl->resourceProvider()); | 260 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostI
mpl->resourceProvider()); |
| 261 m_layerTreeHostImpl.reset(); | 261 m_layerTreeHostImpl.reset(); |
| 262 } | 262 } |
| 263 m_layerTreeHost = 0; | 263 m_layerTreeHost = 0; |
| 264 } | 264 } |
| 265 | 265 |
| 266 void CCSingleThreadProxy::setNeedsRedrawOnImplThread() | 266 void CCSingleThreadProxy::setNeedsRedrawOnImplThread() |
| 267 { | 267 { |
| 268 m_layerTreeHost->scheduleComposite(); | 268 m_layerTreeHost->scheduleComposite(); |
| 269 } | 269 } |
| 270 | 270 |
| 271 void CCSingleThreadProxy::setNeedsCommitOnImplThread() | 271 void CCSingleThreadProxy::setNeedsCommitOnImplThread() |
| 272 { | 272 { |
| 273 m_layerTreeHost->scheduleComposite(); | 273 m_layerTreeHost->scheduleComposite(); |
| 274 } | 274 } |
| 275 | 275 |
| 276 void CCSingleThreadProxy::postAnimationEventsToMainThreadOnImplThread(scoped_ptr
<CCAnimationEventsVector> events, double wallClockTime) | 276 void CCSingleThreadProxy::postAnimationEventsToMainThreadOnImplThread(scoped_ptr
<CCAnimationEventsVector> events, double wallClockTime) |
| 277 { | 277 { |
| 278 ASSERT(CCProxy::isImplThread()); | 278 CC_DCHECK(CCProxy::isImplThread()); |
| 279 DebugScopedSetMainThread main; | 279 DebugScopedSetMainThread main; |
| 280 m_layerTreeHost->setAnimationEvents(events.Pass(), wallClockTime); | 280 m_layerTreeHost->setAnimationEvents(events.Pass(), wallClockTime); |
| 281 } | 281 } |
| 282 | 282 |
| 283 void CCSingleThreadProxy::releaseContentsTexturesOnImplThread() | 283 void CCSingleThreadProxy::releaseContentsTexturesOnImplThread() |
| 284 { | 284 { |
| 285 ASSERT(isImplThread()); | 285 CC_DCHECK(isImplThread()); |
| 286 if (m_layerTreeHost->contentsTextureManager()) | 286 if (m_layerTreeHost->contentsTextureManager()) |
| 287 m_layerTreeHost->contentsTextureManager()->reduceMemoryOnImplThread(0, m
_layerTreeHostImpl->resourceProvider()); | 287 m_layerTreeHost->contentsTextureManager()->reduceMemoryOnImplThread(0, m
_layerTreeHostImpl->resourceProvider()); |
| 288 } | 288 } |
| 289 | 289 |
| 290 // Called by the legacy scheduling path (e.g. where render_widget does the sched
uling) | 290 // Called by the legacy scheduling path (e.g. where render_widget does the sched
uling) |
| 291 void CCSingleThreadProxy::compositeImmediately() | 291 void CCSingleThreadProxy::compositeImmediately() |
| 292 { | 292 { |
| 293 if (commitAndComposite()) { | 293 if (commitAndComposite()) { |
| 294 m_layerTreeHostImpl->swapBuffers(); | 294 m_layerTreeHostImpl->swapBuffers(); |
| 295 didSwapFrame(); | 295 didSwapFrame(); |
| 296 } | 296 } |
| 297 } | 297 } |
| 298 | 298 |
| 299 void CCSingleThreadProxy::forceSerializeOnSwapBuffers() | 299 void CCSingleThreadProxy::forceSerializeOnSwapBuffers() |
| 300 { | 300 { |
| 301 { | 301 { |
| 302 DebugScopedSetImplThread impl; | 302 DebugScopedSetImplThread impl; |
| 303 if (m_rendererInitialized) | 303 if (m_rendererInitialized) |
| 304 m_layerTreeHostImpl->renderer()->doNoOp(); | 304 m_layerTreeHostImpl->renderer()->doNoOp(); |
| 305 } | 305 } |
| 306 } | 306 } |
| 307 | 307 |
| 308 void CCSingleThreadProxy::onSwapBuffersCompleteOnImplThread() | 308 void CCSingleThreadProxy::onSwapBuffersCompleteOnImplThread() |
| 309 { | 309 { |
| 310 ASSERT_NOT_REACHED(); | 310 NOTREACHED(); |
| 311 } | 311 } |
| 312 | 312 |
| 313 bool CCSingleThreadProxy::commitAndComposite() | 313 bool CCSingleThreadProxy::commitAndComposite() |
| 314 { | 314 { |
| 315 ASSERT(CCProxy::isMainThread()); | 315 CC_DCHECK(CCProxy::isMainThread()); |
| 316 | 316 |
| 317 if (!m_layerTreeHost->initializeRendererIfNeeded()) | 317 if (!m_layerTreeHost->initializeRendererIfNeeded()) |
| 318 return false; | 318 return false; |
| 319 | 319 |
| 320 // Unlink any texture backings that were deleted | 320 // Unlink any texture backings that were deleted |
| 321 CCPrioritizedTextureManager::BackingVector evictedContentsTexturesBackings; | 321 CCPrioritizedTextureManager::BackingVector evictedContentsTexturesBackings; |
| 322 { | 322 { |
| 323 DebugScopedSetImplThread implThread; | 323 DebugScopedSetImplThread implThread; |
| 324 m_layerTreeHost->contentsTextureManager()->getEvictedBackings(evictedCon
tentsTexturesBackings); | 324 m_layerTreeHost->contentsTextureManager()->getEvictedBackings(evictedCon
tentsTexturesBackings); |
| 325 } | 325 } |
| 326 m_layerTreeHost->contentsTextureManager()->unlinkEvictedBackings(evictedCont
entsTexturesBackings); | 326 m_layerTreeHost->contentsTextureManager()->unlinkEvictedBackings(evictedCont
entsTexturesBackings); |
| 327 | 327 |
| 328 scoped_ptr<CCTextureUpdateQueue> queue = make_scoped_ptr(new CCTextureUpdate
Queue); | 328 scoped_ptr<CCTextureUpdateQueue> queue = make_scoped_ptr(new CCTextureUpdate
Queue); |
| 329 m_layerTreeHost->updateLayers(*(queue.get()), m_layerTreeHostImpl->memoryAll
ocationLimitBytes()); | 329 m_layerTreeHost->updateLayers(*(queue.get()), m_layerTreeHostImpl->memoryAll
ocationLimitBytes()); |
| 330 | 330 |
| 331 if (m_layerTreeHostImpl->contentsTexturesPurged()) | 331 if (m_layerTreeHostImpl->contentsTexturesPurged()) |
| 332 m_layerTreeHostImpl->resetContentsTexturesPurged(); | 332 m_layerTreeHostImpl->resetContentsTexturesPurged(); |
| 333 | 333 |
| 334 m_layerTreeHost->willCommit(); | 334 m_layerTreeHost->willCommit(); |
| 335 doCommit(queue.Pass()); | 335 doCommit(queue.Pass()); |
| 336 bool result = doComposite(); | 336 bool result = doComposite(); |
| 337 m_layerTreeHost->didBeginFrame(); | 337 m_layerTreeHost->didBeginFrame(); |
| 338 return result; | 338 return result; |
| 339 } | 339 } |
| 340 | 340 |
| 341 bool CCSingleThreadProxy::doComposite() | 341 bool CCSingleThreadProxy::doComposite() |
| 342 { | 342 { |
| 343 ASSERT(!m_contextLost); | 343 CC_DCHECK(!m_contextLost); |
| 344 { | 344 { |
| 345 DebugScopedSetImplThread impl; | 345 DebugScopedSetImplThread impl; |
| 346 | 346 |
| 347 if (!m_layerTreeHostImpl->visible()) | 347 if (!m_layerTreeHostImpl->visible()) |
| 348 return false; | 348 return false; |
| 349 | 349 |
| 350 double monotonicTime = monotonicallyIncreasingTime(); | 350 double monotonicTime = monotonicallyIncreasingTime(); |
| 351 double wallClockTime = currentTime(); | 351 double wallClockTime = currentTime(); |
| 352 m_layerTreeHostImpl->animate(monotonicTime, wallClockTime); | 352 m_layerTreeHostImpl->animate(monotonicTime, wallClockTime); |
| 353 | 353 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 374 | 374 |
| 375 void CCSingleThreadProxy::didSwapFrame() | 375 void CCSingleThreadProxy::didSwapFrame() |
| 376 { | 376 { |
| 377 if (m_nextFrameIsNewlyCommittedFrame) { | 377 if (m_nextFrameIsNewlyCommittedFrame) { |
| 378 m_nextFrameIsNewlyCommittedFrame = false; | 378 m_nextFrameIsNewlyCommittedFrame = false; |
| 379 m_layerTreeHost->didCommitAndDrawFrame(); | 379 m_layerTreeHost->didCommitAndDrawFrame(); |
| 380 } | 380 } |
| 381 } | 381 } |
| 382 | 382 |
| 383 } | 383 } |
| OLD | NEW |