| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 ASSERT(isMainThread()); | 96 ASSERT(isMainThread()); |
| 97 ASSERT(!m_started); | 97 ASSERT(!m_started); |
| 98 } | 98 } |
| 99 | 99 |
| 100 bool CCThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect) | 100 bool CCThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect) |
| 101 { | 101 { |
| 102 TRACE_EVENT("CCThreadPRoxy::compositeAndReadback", this, 0); | 102 TRACE_EVENT("CCThreadPRoxy::compositeAndReadback", this, 0); |
| 103 ASSERT(isMainThread()); | 103 ASSERT(isMainThread()); |
| 104 ASSERT(m_layerTreeHost); | 104 ASSERT(m_layerTreeHost); |
| 105 | 105 |
| 106 if (!m_layerRendererInitialized) { | 106 if (!m_layerTreeHost->initializeLayerRendererIfNeeded()) { |
| 107 TRACE_EVENT("compositeAndReadback_EarlyOut_LR_Uninitialized", this, 0); | 107 TRACE_EVENT("compositeAndReadback_EarlyOut_LR_Uninitialized", this, 0); |
| 108 return false; | 108 return false; |
| 109 } | 109 } |
| 110 | 110 |
| 111 | 111 |
| 112 // Perform a synchronous commit. | 112 // Perform a synchronous commit. |
| 113 CCCompletionEvent beginFrameCompletion; | 113 CCCompletionEvent beginFrameCompletion; |
| 114 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::for
ceBeginFrameOnImplThread, AllowCrossThreadAccess(&beginFrameCompletion))); | 114 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::for
ceBeginFrameOnImplThread, AllowCrossThreadAccess(&beginFrameCompletion))); |
| 115 beginFrameCompletion.wait(); | 115 beginFrameCompletion.wait(); |
| 116 beginFrame(); | 116 beginFrame(); |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 // FIXME: recreate the context if it was requested by the impl thread. | 502 // FIXME: recreate the context if it was requested by the impl thread. |
| 503 m_layerTreeHost->updateAnimations(request->monotonicFrameBeginTime); | 503 m_layerTreeHost->updateAnimations(request->monotonicFrameBeginTime); |
| 504 m_layerTreeHost->layout(); | 504 m_layerTreeHost->layout(); |
| 505 | 505 |
| 506 // Clear the commit flag after updating animations and layout here --- objec
ts that only | 506 // Clear the commit flag after updating animations and layout here --- objec
ts that only |
| 507 // layout when painted will trigger another setNeedsCommit inside | 507 // layout when painted will trigger another setNeedsCommit inside |
| 508 // updateLayers. | 508 // updateLayers. |
| 509 m_commitRequested = false; | 509 m_commitRequested = false; |
| 510 m_forcedCommitRequested = false; | 510 m_forcedCommitRequested = false; |
| 511 | 511 |
| 512 if (!m_layerTreeHost->updateLayers(*request->updater)) | 512 if (!m_layerTreeHost->initializeLayerRendererIfNeeded()) |
| 513 return; | 513 return; |
| 514 | 514 |
| 515 m_layerTreeHost->updateLayers(*request->updater); |
| 516 |
| 515 // Once single buffered layers are committed, they cannot be modified until | 517 // Once single buffered layers are committed, they cannot be modified until |
| 516 // they are drawn by the impl thread. | 518 // they are drawn by the impl thread. |
| 517 m_texturesAcquired = false; | 519 m_texturesAcquired = false; |
| 518 | 520 |
| 519 m_layerTreeHost->willCommit(); | 521 m_layerTreeHost->willCommit(); |
| 520 // Before applying scrolls and calling animate, we set m_animateRequested to
false. | 522 // Before applying scrolls and calling animate, we set m_animateRequested to
false. |
| 521 // If it is true now, it means setNeedAnimate was called again. Call setNeed
sCommit | 523 // If it is true now, it means setNeedAnimate was called again. Call setNeed
sCommit |
| 522 // now so that we get begin frame when this one is done. | 524 // now so that we get begin frame when this one is done. |
| 523 if (m_animateRequested) | 525 if (m_animateRequested) |
| 524 setNeedsCommit(); | 526 setNeedsCommit(); |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->con
tentsTextureAllocator()); | 873 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->con
tentsTextureAllocator()); |
| 872 *recreateSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(adoptRef(c
ontextPtr), textureUploader); | 874 *recreateSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(adoptRef(c
ontextPtr), textureUploader); |
| 873 if (*recreateSucceeded) { | 875 if (*recreateSucceeded) { |
| 874 *capabilities = m_layerTreeHostImpl->layerRendererCapabilities(); | 876 *capabilities = m_layerTreeHostImpl->layerRendererCapabilities(); |
| 875 m_schedulerOnImplThread->didRecreateContext(); | 877 m_schedulerOnImplThread->didRecreateContext(); |
| 876 } | 878 } |
| 877 completion->signal(); | 879 completion->signal(); |
| 878 } | 880 } |
| 879 | 881 |
| 880 } // namespace WebCore | 882 } // namespace WebCore |
| OLD | NEW |