| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 173 |
| 174 // Leak the context pointer so we can transfer ownership of it to the other
side... | 174 // Leak the context pointer so we can transfer ownership of it to the other
side... |
| 175 GraphicsContext3D* contextPtr = context.release().leakRef(); | 175 GraphicsContext3D* contextPtr = context.release().leakRef(); |
| 176 ASSERT(contextPtr->hasOneRef()); | 176 ASSERT(contextPtr->hasOneRef()); |
| 177 | 177 |
| 178 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::ini
tializeContextOnImplThread, | 178 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::ini
tializeContextOnImplThread, |
| 179 AllowCrossThreadAccess(co
ntextPtr))); | 179 AllowCrossThreadAccess(co
ntextPtr))); |
| 180 return true; | 180 return true; |
| 181 } | 181 } |
| 182 | 182 |
| 183 void CCThreadProxy::setSurfaceReady() |
| 184 { |
| 185 TRACE_EVENT0("cc", "CCThreadProxy::setSurfaceReady"); |
| 186 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::set
SurfaceReadyOnImplThread)); |
| 187 } |
| 188 |
| 189 void CCThreadProxy::setSurfaceReadyOnImplThread() |
| 190 { |
| 191 TRACE_EVENT0("cc", "CCThreadProxy::setSurfaceReadyOnImplThread"); |
| 192 m_schedulerOnImplThread->setCanBeginFrame(true); |
| 193 } |
| 194 |
| 183 bool CCThreadProxy::initializeLayerRenderer() | 195 bool CCThreadProxy::initializeLayerRenderer() |
| 184 { | 196 { |
| 185 TRACE_EVENT("CCThreadProxy::initializeLayerRenderer", this, 0); | 197 TRACE_EVENT("CCThreadProxy::initializeLayerRenderer", this, 0); |
| 186 // Make a blocking call to initializeLayerRendererOnImplThread. The results
of that call | 198 // Make a blocking call to initializeLayerRendererOnImplThread. The results
of that call |
| 187 // are pushed into the initializeSucceeded and capabilities local variables. | 199 // are pushed into the initializeSucceeded and capabilities local variables. |
| 188 CCCompletionEvent completion; | 200 CCCompletionEvent completion; |
| 189 bool initializeSucceeded = false; | 201 bool initializeSucceeded = false; |
| 190 LayerRendererCapabilities capabilities; | 202 LayerRendererCapabilities capabilities; |
| 191 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::ini
tializeLayerRendererOnImplThread, | 203 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::ini
tializeLayerRendererOnImplThread, |
| 192 AllowCrossThreadAccess(&c
ompletion), | 204 AllowCrossThreadAccess(&c
ompletion), |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 } | 717 } |
| 706 | 718 |
| 707 void CCThreadProxy::initializeImplOnImplThread(CCCompletionEvent* completion) | 719 void CCThreadProxy::initializeImplOnImplThread(CCCompletionEvent* completion) |
| 708 { | 720 { |
| 709 TRACE_EVENT("CCThreadProxy::initializeImplOnImplThread", this, 0); | 721 TRACE_EVENT("CCThreadProxy::initializeImplOnImplThread", this, 0); |
| 710 ASSERT(isImplThread()); | 722 ASSERT(isImplThread()); |
| 711 m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this); | 723 m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this); |
| 712 const double displayRefreshInterval = 1.0 / 60.0; | 724 const double displayRefreshInterval = 1.0 / 60.0; |
| 713 OwnPtr<CCFrameRateController> frameRateController = adoptPtr(new CCFrameRate
Controller(CCDelayBasedTimeSource::create(displayRefreshInterval, CCProxy::implT
hread()))); | 725 OwnPtr<CCFrameRateController> frameRateController = adoptPtr(new CCFrameRate
Controller(CCDelayBasedTimeSource::create(displayRefreshInterval, CCProxy::implT
hread()))); |
| 714 m_schedulerOnImplThread = CCScheduler::create(this, frameRateController.rele
ase()); | 726 m_schedulerOnImplThread = CCScheduler::create(this, frameRateController.rele
ase()); |
| 715 m_schedulerOnImplThread->setCanBeginFrame(true); // FIXME: Set this when we
actually can begin a frame. | |
| 716 m_schedulerOnImplThread->setVisible(m_layerTreeHostImpl->visible()); | 727 m_schedulerOnImplThread->setVisible(m_layerTreeHostImpl->visible()); |
| 717 | 728 |
| 718 m_inputHandlerOnImplThread = CCInputHandler::create(m_layerTreeHostImpl.get(
)); | 729 m_inputHandlerOnImplThread = CCInputHandler::create(m_layerTreeHostImpl.get(
)); |
| 719 m_compositorIdentifier = m_inputHandlerOnImplThread->identifier(); | 730 m_compositorIdentifier = m_inputHandlerOnImplThread->identifier(); |
| 720 | 731 |
| 721 completion->signal(); | 732 completion->signal(); |
| 722 } | 733 } |
| 723 | 734 |
| 724 void CCThreadProxy::initializeContextOnImplThread(GraphicsContext3D* context) | 735 void CCThreadProxy::initializeContextOnImplThread(GraphicsContext3D* context) |
| 725 { | 736 { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->con
tentsTextureAllocator()); | 783 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->con
tentsTextureAllocator()); |
| 773 *recreateSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(adoptRef(c
ontextPtr)); | 784 *recreateSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(adoptRef(c
ontextPtr)); |
| 774 if (*recreateSucceeded) { | 785 if (*recreateSucceeded) { |
| 775 *capabilities = m_layerTreeHostImpl->layerRendererCapabilities(); | 786 *capabilities = m_layerTreeHostImpl->layerRendererCapabilities(); |
| 776 m_schedulerOnImplThread->didRecreateContext(); | 787 m_schedulerOnImplThread->didRecreateContext(); |
| 777 } | 788 } |
| 778 completion->signal(); | 789 completion->signal(); |
| 779 } | 790 } |
| 780 | 791 |
| 781 } // namespace WebCore | 792 } // namespace WebCore |
| OLD | NEW |