| 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 11 matching lines...) Expand all Loading... |
| 22 } | 22 } |
| 23 | 23 |
| 24 CCSingleThreadProxy::CCSingleThreadProxy(CCLayerTreeHost* layerTreeHost) | 24 CCSingleThreadProxy::CCSingleThreadProxy(CCLayerTreeHost* layerTreeHost) |
| 25 : m_layerTreeHost(layerTreeHost) | 25 : m_layerTreeHost(layerTreeHost) |
| 26 , m_contextLost(false) | 26 , m_contextLost(false) |
| 27 , m_rendererInitialized(false) | 27 , m_rendererInitialized(false) |
| 28 , m_nextFrameIsNewlyCommittedFrame(false) | 28 , m_nextFrameIsNewlyCommittedFrame(false) |
| 29 , m_totalCommitCount(0) | 29 , m_totalCommitCount(0) |
| 30 { | 30 { |
| 31 TRACE_EVENT0("cc", "CCSingleThreadProxy::CCSingleThreadProxy"); | 31 TRACE_EVENT0("cc", "CCSingleThreadProxy::CCSingleThreadProxy"); |
| 32 ASSERT(CCProxy::isMainThread()); | 32 DCHECK(CCProxy::isMainThread()); |
| 33 } | 33 } |
| 34 | 34 |
| 35 void CCSingleThreadProxy::start() | 35 void CCSingleThreadProxy::start() |
| 36 { | 36 { |
| 37 DebugScopedSetImplThread impl; | 37 DebugScopedSetImplThread impl; |
| 38 m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this); | 38 m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this); |
| 39 } | 39 } |
| 40 | 40 |
| 41 CCSingleThreadProxy::~CCSingleThreadProxy() | 41 CCSingleThreadProxy::~CCSingleThreadProxy() |
| 42 { | 42 { |
| 43 TRACE_EVENT0("cc", "CCSingleThreadProxy::~CCSingleThreadProxy"); | 43 TRACE_EVENT0("cc", "CCSingleThreadProxy::~CCSingleThreadProxy"); |
| 44 ASSERT(CCProxy::isMainThread()); | 44 DCHECK(CCProxy::isMainThread()); |
| 45 ASSERT(!m_layerTreeHostImpl.get() && !m_layerTreeHost); // make sure stop()
got called. | 45 DCHECK(!m_layerTreeHostImpl.get() && !m_layerTreeHost); // make sure stop()
got called. |
| 46 } | 46 } |
| 47 | 47 |
| 48 bool CCSingleThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect
) | 48 bool CCSingleThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect
) |
| 49 { | 49 { |
| 50 TRACE_EVENT0("cc", "CCSingleThreadProxy::compositeAndReadback"); | 50 TRACE_EVENT0("cc", "CCSingleThreadProxy::compositeAndReadback"); |
| 51 ASSERT(CCProxy::isMainThread()); | 51 DCHECK(CCProxy::isMainThread()); |
| 52 | 52 |
| 53 if (!commitAndComposite()) | 53 if (!commitAndComposite()) |
| 54 return false; | 54 return false; |
| 55 | 55 |
| 56 m_layerTreeHostImpl->readback(pixels, rect); | 56 m_layerTreeHostImpl->readback(pixels, rect); |
| 57 | 57 |
| 58 if (m_layerTreeHostImpl->isContextLost()) | 58 if (m_layerTreeHostImpl->isContextLost()) |
| 59 return false; | 59 return false; |
| 60 | 60 |
| 61 m_layerTreeHostImpl->swapBuffers(); | 61 m_layerTreeHostImpl->swapBuffers(); |
| 62 didSwapFrame(); | 62 didSwapFrame(); |
| 63 | 63 |
| 64 return true; | 64 return true; |
| 65 } | 65 } |
| 66 | 66 |
| 67 void CCSingleThreadProxy::startPageScaleAnimation(const IntSize& targetPosition,
bool useAnchor, float scale, double duration) | 67 void CCSingleThreadProxy::startPageScaleAnimation(const IntSize& targetPosition,
bool useAnchor, float scale, double duration) |
| 68 { | 68 { |
| 69 m_layerTreeHostImpl->startPageScaleAnimation(targetPosition, useAnchor, scal
e, monotonicallyIncreasingTime(), duration); | 69 m_layerTreeHostImpl->startPageScaleAnimation(targetPosition, useAnchor, scal
e, monotonicallyIncreasingTime(), duration); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void CCSingleThreadProxy::finishAllRendering() | 72 void CCSingleThreadProxy::finishAllRendering() |
| 73 { | 73 { |
| 74 ASSERT(CCProxy::isMainThread()); | 74 DCHECK(CCProxy::isMainThread()); |
| 75 { | 75 { |
| 76 DebugScopedSetImplThread impl; | 76 DebugScopedSetImplThread impl; |
| 77 m_layerTreeHostImpl->finishAllRendering(); | 77 m_layerTreeHostImpl->finishAllRendering(); |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 | 80 |
| 81 bool CCSingleThreadProxy::isStarted() const | 81 bool CCSingleThreadProxy::isStarted() const |
| 82 { | 82 { |
| 83 ASSERT(CCProxy::isMainThread()); | 83 DCHECK(CCProxy::isMainThread()); |
| 84 return m_layerTreeHostImpl.get(); | 84 return m_layerTreeHostImpl.get(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 bool CCSingleThreadProxy::initializeContext() | 87 bool CCSingleThreadProxy::initializeContext() |
| 88 { | 88 { |
| 89 ASSERT(CCProxy::isMainThread()); | 89 DCHECK(CCProxy::isMainThread()); |
| 90 scoped_ptr<CCGraphicsContext> context = m_layerTreeHost->createContext(); | 90 scoped_ptr<CCGraphicsContext> context = m_layerTreeHost->createContext(); |
| 91 if (!context.get()) | 91 if (!context.get()) |
| 92 return false; | 92 return false; |
| 93 m_contextBeforeInitialization = context.Pass(); | 93 m_contextBeforeInitialization = context.Pass(); |
| 94 return true; | 94 return true; |
| 95 } | 95 } |
| 96 | 96 |
| 97 void CCSingleThreadProxy::setSurfaceReady() | 97 void CCSingleThreadProxy::setSurfaceReady() |
| 98 { | 98 { |
| 99 // Scheduling is controlled by the embedder in the single thread case, so no
thing to do. | 99 // Scheduling is controlled by the embedder in the single thread case, so no
thing to do. |
| 100 } | 100 } |
| 101 | 101 |
| 102 void CCSingleThreadProxy::setVisible(bool visible) | 102 void CCSingleThreadProxy::setVisible(bool visible) |
| 103 { | 103 { |
| 104 DebugScopedSetImplThread impl; | 104 DebugScopedSetImplThread impl; |
| 105 m_layerTreeHostImpl->setVisible(visible); | 105 m_layerTreeHostImpl->setVisible(visible); |
| 106 } | 106 } |
| 107 | 107 |
| 108 bool CCSingleThreadProxy::initializeRenderer() | 108 bool CCSingleThreadProxy::initializeRenderer() |
| 109 { | 109 { |
| 110 ASSERT(CCProxy::isMainThread()); | 110 DCHECK(CCProxy::isMainThread()); |
| 111 ASSERT(m_contextBeforeInitialization.get()); | 111 DCHECK(m_contextBeforeInitialization.get()); |
| 112 { | 112 { |
| 113 DebugScopedSetImplThread impl; | 113 DebugScopedSetImplThread impl; |
| 114 bool ok = m_layerTreeHostImpl->initializeRenderer(m_contextBeforeInitial
ization.Pass()); | 114 bool ok = m_layerTreeHostImpl->initializeRenderer(m_contextBeforeInitial
ization.Pass()); |
| 115 if (ok) { | 115 if (ok) { |
| 116 m_rendererInitialized = true; | 116 m_rendererInitialized = true; |
| 117 m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererC
apabilities(); | 117 m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererC
apabilities(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 return ok; | 120 return ok; |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 | 123 |
| 124 bool CCSingleThreadProxy::recreateContext() | 124 bool CCSingleThreadProxy::recreateContext() |
| 125 { | 125 { |
| 126 TRACE_EVENT0("cc", "CCSingleThreadProxy::recreateContext"); | 126 TRACE_EVENT0("cc", "CCSingleThreadProxy::recreateContext"); |
| 127 ASSERT(CCProxy::isMainThread()); | 127 DCHECK(CCProxy::isMainThread()); |
| 128 ASSERT(m_contextLost); | 128 DCHECK(m_contextLost); |
| 129 | 129 |
| 130 scoped_ptr<CCGraphicsContext> context = m_layerTreeHost->createContext(); | 130 scoped_ptr<CCGraphicsContext> context = m_layerTreeHost->createContext(); |
| 131 if (!context.get()) | 131 if (!context.get()) |
| 132 return false; | 132 return false; |
| 133 | 133 |
| 134 bool initialized; | 134 bool initialized; |
| 135 { | 135 { |
| 136 DebugScopedSetMainThreadBlocked mainThreadBlocked; | 136 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
| 137 DebugScopedSetImplThread impl; | 137 DebugScopedSetImplThread impl; |
| 138 if (!m_layerTreeHostImpl->contentsTexturesPurged()) | 138 if (!m_layerTreeHostImpl->contentsTexturesPurged()) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 151 | 151 |
| 152 void CCSingleThreadProxy::renderingStats(CCRenderingStats* stats) | 152 void CCSingleThreadProxy::renderingStats(CCRenderingStats* stats) |
| 153 { | 153 { |
| 154 stats->totalCommitTimeInSeconds = m_totalCommitTime.InSecondsF(); | 154 stats->totalCommitTimeInSeconds = m_totalCommitTime.InSecondsF(); |
| 155 stats->totalCommitCount = m_totalCommitCount; | 155 stats->totalCommitCount = m_totalCommitCount; |
| 156 m_layerTreeHostImpl->renderingStats(stats); | 156 m_layerTreeHostImpl->renderingStats(stats); |
| 157 } | 157 } |
| 158 | 158 |
| 159 const RendererCapabilities& CCSingleThreadProxy::rendererCapabilities() const | 159 const RendererCapabilities& CCSingleThreadProxy::rendererCapabilities() const |
| 160 { | 160 { |
| 161 ASSERT(m_rendererInitialized); | 161 DCHECK(m_rendererInitialized); |
| 162 // Note: this gets called during the commit by the "impl" thread | 162 // Note: this gets called during the commit by the "impl" thread |
| 163 return m_RendererCapabilitiesForMainThread; | 163 return m_RendererCapabilitiesForMainThread; |
| 164 } | 164 } |
| 165 | 165 |
| 166 void CCSingleThreadProxy::loseContext() | 166 void CCSingleThreadProxy::loseContext() |
| 167 { | 167 { |
| 168 ASSERT(CCProxy::isMainThread()); | 168 DCHECK(CCProxy::isMainThread()); |
| 169 m_layerTreeHost->didLoseContext(); | 169 m_layerTreeHost->didLoseContext(); |
| 170 m_contextLost = true; | 170 m_contextLost = true; |
| 171 } | 171 } |
| 172 | 172 |
| 173 void CCSingleThreadProxy::setNeedsAnimate() | 173 void CCSingleThreadProxy::setNeedsAnimate() |
| 174 { | 174 { |
| 175 // CCThread-only feature | 175 // CCThread-only feature |
| 176 ASSERT_NOT_REACHED(); | 176 NOTREACHED(); |
| 177 } | 177 } |
| 178 | 178 |
| 179 void CCSingleThreadProxy::doCommit(scoped_ptr<CCTextureUpdateQueue> queue) | 179 void CCSingleThreadProxy::doCommit(scoped_ptr<CCTextureUpdateQueue> queue) |
| 180 { | 180 { |
| 181 ASSERT(CCProxy::isMainThread()); | 181 DCHECK(CCProxy::isMainThread()); |
| 182 // Commit immediately | 182 // Commit immediately |
| 183 { | 183 { |
| 184 DebugScopedSetMainThreadBlocked mainThreadBlocked; | 184 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
| 185 DebugScopedSetImplThread impl; | 185 DebugScopedSetImplThread impl; |
| 186 | 186 |
| 187 base::TimeTicks startTime = base::TimeTicks::HighResNow(); | 187 base::TimeTicks startTime = base::TimeTicks::HighResNow(); |
| 188 m_layerTreeHostImpl->beginCommit(); | 188 m_layerTreeHostImpl->beginCommit(); |
| 189 | 189 |
| 190 m_layerTreeHost->contentsTextureManager()->pushTexturePrioritiesToBackin
gs(); | 190 m_layerTreeHost->contentsTextureManager()->pushTexturePrioritiesToBackin
gs(); |
| 191 m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get()); | 191 m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get()); |
| 192 | 192 |
| 193 scoped_ptr<CCTextureUpdateController> updateController = | 193 scoped_ptr<CCTextureUpdateController> updateController = |
| 194 CCTextureUpdateController::create( | 194 CCTextureUpdateController::create( |
| 195 NULL, | 195 NULL, |
| 196 CCProxy::mainThread(), | 196 CCProxy::mainThread(), |
| 197 queue.Pass(), | 197 queue.Pass(), |
| 198 m_layerTreeHostImpl->resourceProvider(), | 198 m_layerTreeHostImpl->resourceProvider(), |
| 199 m_layerTreeHostImpl->resourceProvider()->textureUploader()); | 199 m_layerTreeHostImpl->resourceProvider()->textureUploader()); |
| 200 updateController->finalize(); | 200 updateController->finalize(); |
| 201 | 201 |
| 202 m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); | 202 m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); |
| 203 | 203 |
| 204 m_layerTreeHostImpl->commitComplete(); | 204 m_layerTreeHostImpl->commitComplete(); |
| 205 | 205 |
| 206 #if !ASSERT_DISABLED | 206 #ifndef NDEBUG |
| 207 // In the single-threaded case, the scroll deltas should never be | 207 // In the single-threaded case, the scroll deltas should never be |
| 208 // touched on the impl layer tree. | 208 // touched on the impl layer tree. |
| 209 scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_layerTreeHostImpl->proces
sScrollDeltas(); | 209 scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_layerTreeHostImpl->proces
sScrollDeltas(); |
| 210 ASSERT(!scrollInfo->scrolls.size()); | 210 DCHECK(!scrollInfo->scrolls.size()); |
| 211 #endif | 211 #endif |
| 212 | 212 |
| 213 base::TimeTicks endTime = base::TimeTicks::HighResNow(); | 213 base::TimeTicks endTime = base::TimeTicks::HighResNow(); |
| 214 m_totalCommitTime += endTime - startTime; | 214 m_totalCommitTime += endTime - startTime; |
| 215 m_totalCommitCount++; | 215 m_totalCommitCount++; |
| 216 } | 216 } |
| 217 m_layerTreeHost->commitComplete(); | 217 m_layerTreeHost->commitComplete(); |
| 218 m_nextFrameIsNewlyCommittedFrame = true; | 218 m_nextFrameIsNewlyCommittedFrame = true; |
| 219 } | 219 } |
| 220 | 220 |
| 221 void CCSingleThreadProxy::setNeedsCommit() | 221 void CCSingleThreadProxy::setNeedsCommit() |
| 222 { | 222 { |
| 223 ASSERT(CCProxy::isMainThread()); | 223 DCHECK(CCProxy::isMainThread()); |
| 224 m_layerTreeHost->scheduleComposite(); | 224 m_layerTreeHost->scheduleComposite(); |
| 225 } | 225 } |
| 226 | 226 |
| 227 void CCSingleThreadProxy::setNeedsRedraw() | 227 void CCSingleThreadProxy::setNeedsRedraw() |
| 228 { | 228 { |
| 229 // FIXME: Once we move render_widget scheduling into this class, we can | 229 // FIXME: Once we move render_widget scheduling into this class, we can |
| 230 // treat redraw requests more efficiently than commitAndRedraw requests. | 230 // treat redraw requests more efficiently than commitAndRedraw requests. |
| 231 m_layerTreeHostImpl->setFullRootLayerDamage(); | 231 m_layerTreeHostImpl->setFullRootLayerDamage(); |
| 232 setNeedsCommit(); | 232 setNeedsCommit(); |
| 233 } | 233 } |
| 234 | 234 |
| 235 bool CCSingleThreadProxy::commitRequested() const | 235 bool CCSingleThreadProxy::commitRequested() const |
| 236 { | 236 { |
| 237 return false; | 237 return false; |
| 238 } | 238 } |
| 239 | 239 |
| 240 void CCSingleThreadProxy::didAddAnimation() | 240 void CCSingleThreadProxy::didAddAnimation() |
| 241 { | 241 { |
| 242 } | 242 } |
| 243 | 243 |
| 244 size_t CCSingleThreadProxy::maxPartialTextureUpdates() const | 244 size_t CCSingleThreadProxy::maxPartialTextureUpdates() const |
| 245 { | 245 { |
| 246 return std::numeric_limits<size_t>::max(); | 246 return std::numeric_limits<size_t>::max(); |
| 247 } | 247 } |
| 248 | 248 |
| 249 void CCSingleThreadProxy::stop() | 249 void CCSingleThreadProxy::stop() |
| 250 { | 250 { |
| 251 TRACE_EVENT0("cc", "CCSingleThreadProxy::stop"); | 251 TRACE_EVENT0("cc", "CCSingleThreadProxy::stop"); |
| 252 ASSERT(CCProxy::isMainThread()); | 252 DCHECK(CCProxy::isMainThread()); |
| 253 { | 253 { |
| 254 DebugScopedSetMainThreadBlocked mainThreadBlocked; | 254 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
| 255 DebugScopedSetImplThread impl; | 255 DebugScopedSetImplThread impl; |
| 256 | 256 |
| 257 if (!m_layerTreeHostImpl->contentsTexturesPurged()) | 257 if (!m_layerTreeHostImpl->contentsTexturesPurged()) |
| 258 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostI
mpl->resourceProvider()); | 258 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostI
mpl->resourceProvider()); |
| 259 m_layerTreeHostImpl.reset(); | 259 m_layerTreeHostImpl.reset(); |
| 260 } | 260 } |
| 261 m_layerTreeHost = 0; | 261 m_layerTreeHost = 0; |
| 262 } | 262 } |
| 263 | 263 |
| 264 void CCSingleThreadProxy::setNeedsRedrawOnImplThread() | 264 void CCSingleThreadProxy::setNeedsRedrawOnImplThread() |
| 265 { | 265 { |
| 266 m_layerTreeHost->scheduleComposite(); | 266 m_layerTreeHost->scheduleComposite(); |
| 267 } | 267 } |
| 268 | 268 |
| 269 void CCSingleThreadProxy::setNeedsCommitOnImplThread() | 269 void CCSingleThreadProxy::setNeedsCommitOnImplThread() |
| 270 { | 270 { |
| 271 m_layerTreeHost->scheduleComposite(); | 271 m_layerTreeHost->scheduleComposite(); |
| 272 } | 272 } |
| 273 | 273 |
| 274 void CCSingleThreadProxy::postAnimationEventsToMainThreadOnImplThread(scoped_ptr
<CCAnimationEventsVector> events, double wallClockTime) | 274 void CCSingleThreadProxy::postAnimationEventsToMainThreadOnImplThread(scoped_ptr
<CCAnimationEventsVector> events, double wallClockTime) |
| 275 { | 275 { |
| 276 ASSERT(CCProxy::isImplThread()); | 276 DCHECK(CCProxy::isImplThread()); |
| 277 DebugScopedSetMainThread main; | 277 DebugScopedSetMainThread main; |
| 278 m_layerTreeHost->setAnimationEvents(events.Pass(), wallClockTime); | 278 m_layerTreeHost->setAnimationEvents(events.Pass(), wallClockTime); |
| 279 } | 279 } |
| 280 | 280 |
| 281 bool CCSingleThreadProxy::reduceContentsTextureMemoryOnImplThread(size_t limitBy
tes) | 281 bool CCSingleThreadProxy::reduceContentsTextureMemoryOnImplThread(size_t limitBy
tes) |
| 282 { | 282 { |
| 283 ASSERT(isImplThread()); | 283 DCHECK(isImplThread()); |
| 284 if (!m_layerTreeHost->contentsTextureManager()) | 284 if (!m_layerTreeHost->contentsTextureManager()) |
| 285 return false; | 285 return false; |
| 286 | 286 |
| 287 return m_layerTreeHost->contentsTextureManager()->reduceMemoryOnImplThread(l
imitBytes, m_layerTreeHostImpl->resourceProvider()); | 287 return m_layerTreeHost->contentsTextureManager()->reduceMemoryOnImplThread(l
imitBytes, 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 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::BackingList evictedContentsTexturesBackings; | 321 CCPrioritizedTextureManager::BackingList 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 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 |