| 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 "cc/thread_proxy.h" | 5 #include "cc/thread_proxy.h" | 
| 6 | 6 | 
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" | 
| 8 #include "base/bind.h" | 8 #include "base/bind.h" | 
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" | 
| 10 #include "cc/delay_based_time_source.h" | 10 #include "cc/delay_based_time_source.h" | 
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 293     if (m_commitRequestSentToImplThread) | 293     if (m_commitRequestSentToImplThread) | 
| 294         return; | 294         return; | 
| 295     m_commitRequestSentToImplThread = true; | 295     m_commitRequestSentToImplThread = true; | 
| 296     Proxy::implThread()->postTask(base::Bind(&ThreadProxy::setNeedsCommitOnImplT
      hread, m_implThreadWeakPtr)); | 296     Proxy::implThread()->postTask(base::Bind(&ThreadProxy::setNeedsCommitOnImplT
      hread, m_implThreadWeakPtr)); | 
| 297 } | 297 } | 
| 298 | 298 | 
| 299 void ThreadProxy::didLoseOutputSurfaceOnImplThread() | 299 void ThreadProxy::didLoseOutputSurfaceOnImplThread() | 
| 300 { | 300 { | 
| 301     DCHECK(isImplThread()); | 301     DCHECK(isImplThread()); | 
| 302     TRACE_EVENT0("cc", "ThreadProxy::didLoseOutputSurfaceOnImplThread"); | 302     TRACE_EVENT0("cc", "ThreadProxy::didLoseOutputSurfaceOnImplThread"); | 
|  | 303     Proxy::implThread()->postTask(base::Bind(&ThreadProxy::checkOutputSurfaceSta
      tusOnImplThread, m_implThreadWeakPtr)); | 
|  | 304 } | 
|  | 305 | 
|  | 306 void ThreadProxy::checkOutputSurfaceStatusOnImplThread() | 
|  | 307 { | 
|  | 308     DCHECK(isImplThread()); | 
|  | 309     TRACE_EVENT0("cc", "ThreadProxy::checkOutputSurfaceStatusOnImplThread"); | 
|  | 310     if (!m_layerTreeHostImpl->isContextLost()) | 
|  | 311         return; | 
| 303     m_schedulerOnImplThread->didLoseOutputSurface(); | 312     m_schedulerOnImplThread->didLoseOutputSurface(); | 
| 304 } | 313 } | 
| 305 | 314 | 
| 306 void ThreadProxy::onSwapBuffersCompleteOnImplThread() | 315 void ThreadProxy::onSwapBuffersCompleteOnImplThread() | 
| 307 { | 316 { | 
| 308     DCHECK(isImplThread()); | 317     DCHECK(isImplThread()); | 
| 309     TRACE_EVENT0("cc", "ThreadProxy::onSwapBuffersCompleteOnImplThread"); | 318     TRACE_EVENT0("cc", "ThreadProxy::onSwapBuffersCompleteOnImplThread"); | 
| 310     m_schedulerOnImplThread->didSwapBuffersComplete(); | 319     m_schedulerOnImplThread->didSwapBuffersComplete(); | 
| 311     Proxy::mainThread()->postTask(base::Bind(&ThreadProxy::didCompleteSwapBuffer
      s, m_mainThreadWeakPtr)); | 320     Proxy::mainThread()->postTask(base::Bind(&ThreadProxy::didCompleteSwapBuffer
      s, m_mainThreadWeakPtr)); | 
| 312 } | 321 } | 
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 835         m_readbackRequestOnImplThread = 0; | 844         m_readbackRequestOnImplThread = 0; | 
| 836     } else if (drawFrame) | 845     } else if (drawFrame) | 
| 837         result.didSwap = m_layerTreeHostImpl->swapBuffers(); | 846         result.didSwap = m_layerTreeHostImpl->swapBuffers(); | 
| 838 | 847 | 
| 839     // Tell the main thread that the the newly-commited frame was drawn. | 848     // Tell the main thread that the the newly-commited frame was drawn. | 
| 840     if (m_nextFrameIsNewlyCommittedFrameOnImplThread) { | 849     if (m_nextFrameIsNewlyCommittedFrameOnImplThread) { | 
| 841         m_nextFrameIsNewlyCommittedFrameOnImplThread = false; | 850         m_nextFrameIsNewlyCommittedFrameOnImplThread = false; | 
| 842         Proxy::mainThread()->postTask(base::Bind(&ThreadProxy::didCommitAndDrawF
      rame, m_mainThreadWeakPtr)); | 851         Proxy::mainThread()->postTask(base::Bind(&ThreadProxy::didCommitAndDrawF
      rame, m_mainThreadWeakPtr)); | 
| 843     } | 852     } | 
| 844 | 853 | 
|  | 854     if (drawFrame) | 
|  | 855         checkOutputSurfaceStatusOnImplThread(); | 
|  | 856 | 
| 845     return result; | 857     return result; | 
| 846 } | 858 } | 
| 847 | 859 | 
| 848 void ThreadProxy::acquireLayerTextures() | 860 void ThreadProxy::acquireLayerTextures() | 
| 849 { | 861 { | 
| 850     // Called when the main thread needs to modify a layer texture that is used | 862     // Called when the main thread needs to modify a layer texture that is used | 
| 851     // directly by the compositor. | 863     // directly by the compositor. | 
| 852     // This method will block until the next compositor draw if there is a | 864     // This method will block until the next compositor draw if there is a | 
| 853     // previously committed frame that is still undrawn. This is necessary to | 865     // previously committed frame that is still undrawn. This is necessary to | 
| 854     // ensure that the main thread does not monopolize access to the textures. | 866     // ensure that the main thread does not monopolize access to the textures. | 
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1094 } | 1106 } | 
| 1095 | 1107 | 
| 1096 void ThreadProxy::capturePictureOnImplThread(CompletionEvent* completion, skia::
      RefPtr<SkPicture>* picture) | 1108 void ThreadProxy::capturePictureOnImplThread(CompletionEvent* completion, skia::
      RefPtr<SkPicture>* picture) | 
| 1097 { | 1109 { | 
| 1098     DCHECK(isImplThread()); | 1110     DCHECK(isImplThread()); | 
| 1099     *picture = m_layerTreeHostImpl->capturePicture(); | 1111     *picture = m_layerTreeHostImpl->capturePicture(); | 
| 1100     completion->signal(); | 1112     completion->signal(); | 
| 1101 } | 1113 } | 
| 1102 | 1114 | 
| 1103 }  // namespace cc | 1115 }  // namespace cc | 
| OLD | NEW | 
|---|