| Index: Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp
 | 
| ===================================================================
 | 
| --- Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp	(revision 125598)
 | 
| +++ Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp	(working copy)
 | 
| @@ -80,6 +80,7 @@
 | 
|      , m_readbackRequestOnImplThread(0)
 | 
|      , m_commitCompletionEventOnImplThread(0)
 | 
|      , m_textureAcquisitionCompletionEventOnImplThread(0)
 | 
| +    , m_resetContentsTexturesPurgedAfterCommitOnImplThread(false)
 | 
|      , m_nextFrameIsNewlyCommittedFrameOnImplThread(false)
 | 
|      , m_renderVSyncEnabled(layerTreeHost->settings().renderVSyncEnabled)
 | 
|  {
 | 
| @@ -445,7 +446,7 @@
 | 
|      m_pendingBeginFrameRequest = adoptPtr(new BeginFrameAndCommitState());
 | 
|      m_pendingBeginFrameRequest->monotonicFrameBeginTime = monotonicallyIncreasingTime();
 | 
|      m_pendingBeginFrameRequest->scrollInfo = m_layerTreeHostImpl->processScrollDeltas();
 | 
| -    m_pendingBeginFrameRequest->contentsTexturesWereDeleted = m_layerTreeHostImpl->contentsTexturesWerePurgedSinceLastCommit();
 | 
| +    m_pendingBeginFrameRequest->contentsTexturesWereDeleted = m_layerTreeHostImpl->contentsTexturesPurged();
 | 
|      m_pendingBeginFrameRequest->memoryAllocationLimitBytes = m_layerTreeHostImpl->memoryAllocationLimitBytes();
 | 
|  
 | 
|      m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrame));
 | 
| @@ -538,7 +539,7 @@
 | 
|          DebugScopedSetMainThreadBlocked mainThreadBlocked;
 | 
|  
 | 
|          CCCompletionEvent completion;
 | 
| -        CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrameCompleteOnImplThread, &completion, queue.release()));
 | 
| +        CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrameCompleteOnImplThread, &completion, queue.release(), request->contentsTexturesWereDeleted));
 | 
|          completion.wait();
 | 
|      }
 | 
|  
 | 
| @@ -546,7 +547,7 @@
 | 
|      m_layerTreeHost->didBeginFrame();
 | 
|  }
 | 
|  
 | 
| -void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion, PassOwnPtr<CCTextureUpdateQueue> queue)
 | 
| +void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion, PassOwnPtr<CCTextureUpdateQueue> queue, bool contentsTexturesWereDeleted)
 | 
|  {
 | 
|      TRACE_EVENT0("cc", "CCThreadProxy::beginFrameCompleteOnImplThread");
 | 
|      ASSERT(!m_commitCompletionEventOnImplThread);
 | 
| @@ -559,6 +560,16 @@
 | 
|          return;
 | 
|      }
 | 
|  
 | 
| +    if (!contentsTexturesWereDeleted && m_layerTreeHostImpl->contentsTexturesPurged()) {
 | 
| +        // We purged the content textures on the impl thread between the time we
 | 
| +        // posted the beginFrame task and now, meaning we have a bunch of
 | 
| +        // uploads that are now invalid. Clear the uploads (they all go to
 | 
| +        // content textures), and kick another commit to fill them again.
 | 
| +        queue->clearUploads();
 | 
| +        setNeedsCommitOnImplThread();
 | 
| +    } else
 | 
| +        m_resetContentsTexturesPurgedAfterCommitOnImplThread = true;
 | 
| +
 | 
|      m_currentTextureUpdateControllerOnImplThread = CCTextureUpdateController::create(queue, m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->layerRenderer()->textureCopier(), m_layerTreeHostImpl->layerRenderer()->textureUploader());
 | 
|      m_commitCompletionEventOnImplThread = completion;
 | 
|  
 | 
| @@ -612,6 +623,11 @@
 | 
|      m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get());
 | 
|      m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get());
 | 
|  
 | 
| +    if (m_resetContentsTexturesPurgedAfterCommitOnImplThread) {
 | 
| +        m_resetContentsTexturesPurgedAfterCommitOnImplThread = false;
 | 
| +        m_layerTreeHostImpl->resetContentsTexturesPurged();
 | 
| +    }
 | 
| +
 | 
|      m_layerTreeHostImpl->commitComplete();
 | 
|  
 | 
|      m_nextFrameIsNewlyCommittedFrameOnImplThread = true;
 | 
| @@ -846,7 +862,7 @@
 | 
|  {
 | 
|      TRACE_EVENT0("cc", "CCThreadProxy::layerTreeHostClosedOnImplThread");
 | 
|      ASSERT(isImplThread());
 | 
| -    if (!m_layerTreeHostImpl->contentsTexturesWerePurgedSinceLastCommit())
 | 
| +    if (!m_layerTreeHostImpl->contentsTexturesPurged())
 | 
|          m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider());
 | 
|      m_inputHandlerOnImplThread.clear();
 | 
|      m_layerTreeHostImpl.clear();
 | 
| 
 |