本文整理汇总了C++中CCCompletionEvent::wait方法的典型用法代码示例。如果您正苦于以下问题:C++ CCCompletionEvent::wait方法的具体用法?C++ CCCompletionEvent::wait怎么用?C++ CCCompletionEvent::wait使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCCompletionEvent
的用法示例。
在下文中一共展示了CCCompletionEvent::wait方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compositeAndReadback
bool CCThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect)
{
TRACE_EVENT("CCThreadPRoxy::compositeAndReadback", this, 0);
ASSERT(isMainThread());
ASSERT(m_layerTreeHost);
// If a commit is pending, perform the commit first.
if (m_commitRequested) {
// This bit of code is uglier than it should be because returning
// pointers via the CCThread task model is really messy. Effectively, we
// are making a blocking call to createBeginFrameAndCommitTaskOnImplThread,
// and trying to get the CCMainThread::Task it returns so we can run it.
OwnPtr<CCMainThread::Task> beginFrameAndCommitTask;
{
CCMainThread::Task* taskPtr = 0;
CCCompletionEvent completion;
s_ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::obtainBeginFrameAndCommitTaskFromCCThread, AllowCrossThreadAccess(&completion), AllowCrossThreadAccess(&taskPtr)));
completion.wait();
beginFrameAndCommitTask = adoptPtr(taskPtr);
}
beginFrameAndCommitTask->performTask();
}
// Draw using the new tree and read back the results.
bool success = false;
CCCompletionEvent completion;
s_ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::drawLayersAndReadbackOnImplThread, AllowCrossThreadAccess(&completion), AllowCrossThreadAccess(&success), AllowCrossThreadAccess(pixels), rect));
completion.wait();
return success;
}
示例2: start
void CCThreadProxy::start()
{
// Create LayerTreeHostImpl.
CCCompletionEvent completion;
ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::initializeImplOnCCThread, AllowCrossThreadAccess(&completion)));
completion.wait();
}
示例3: initializeLayerRenderer
bool CCThreadProxy::initializeLayerRenderer()
{
TRACE_EVENT("CCThreadProxy::initializeLayerRenderer", this, 0);
RefPtr<GraphicsContext3D> context = m_layerTreeHost->createLayerTreeHostContext3D();
if (!context)
return false;
ASSERT(context->hasOneRef());
// Leak the context pointer so we can transfer ownership of it to the other side...
GraphicsContext3D* contextPtr = context.release().leakRef();
ASSERT(contextPtr->hasOneRef());
// Make a blocking call to initializeLayerRendererOnImplThread. The results of that call
// are pushed into the initializeSucceeded and capabilities local variables.
CCCompletionEvent completion;
bool initializeSucceeded = false;
LayerRendererCapabilities capabilities;
s_ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::initializeLayerRendererOnImplThread,
AllowCrossThreadAccess(contextPtr), AllowCrossThreadAccess(&completion),
AllowCrossThreadAccess(&initializeSucceeded), AllowCrossThreadAccess(&capabilities),
AllowCrossThreadAccess(&m_compositorIdentifier)));
completion.wait();
if (initializeSucceeded)
m_layerRendererCapabilitiesMainThreadCopy = capabilities;
return initializeSucceeded;
}
示例4: forceSerializeOnSwapBuffers
void CCThreadProxy::forceSerializeOnSwapBuffers()
{
DebugScopedSetMainThreadBlocked mainThreadBlocked;
CCCompletionEvent completion;
CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::forceSerializeOnSwapBuffersOnImplThread, &completion));
completion.wait();
}
示例5: recreateContext
bool CCThreadProxy::recreateContext()
{
TRACE_EVENT0("cc", "CCThreadProxy::recreateContext");
ASSERT(isMainThread());
// Try to create the context.
OwnPtr<CCGraphicsContext> context = m_layerTreeHost->createContext();
if (!context)
return false;
if (m_layerTreeHost->needsSharedContext())
if (!WebSharedGraphicsContext3D::createCompositorThreadContext())
return false;
// Make a blocking call to recreateContextOnImplThread. The results of that
// call are pushed into the recreateSucceeded and capabilities local
// variables.
CCCompletionEvent completion;
bool recreateSucceeded = false;
RendererCapabilities capabilities;
DebugScopedSetMainThreadBlocked mainThreadBlocked;
CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::recreateContextOnImplThread,
&completion,
context.leakPtr(),
&recreateSucceeded,
&capabilities));
completion.wait();
if (recreateSucceeded)
m_RendererCapabilitiesMainThreadCopy = capabilities;
return recreateSucceeded;
}
示例6: finishAllRendering
void CCThreadProxy::finishAllRendering()
{
ASSERT(CCProxy::isMainThread());
// Make sure all GL drawing is finished on the impl thread.
CCCompletionEvent completion;
s_ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::finishAllRenderingOnImplThread, AllowCrossThreadAccess(&completion)));
completion.wait();
}
示例7: finishAllRendering
void CCThreadProxy::finishAllRendering()
{
ASSERT(CCProxy::isMainThread());
// Make sure all GL drawing is finished on the impl thread.
DebugScopedSetMainThreadBlocked mainThreadBlocked;
CCCompletionEvent completion;
CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::finishAllRenderingOnImplThread, &completion));
completion.wait();
}
示例8: currentThread
CCThreadImpl::CCThreadImpl(WebThread* thread)
: m_thread(thread)
{
// Get the threadId for the newly-created thread by running a task
// on that thread, blocking on the result.
m_threadID = currentThread();
CCCompletionEvent completion;
m_thread->postTask(new GetThreadIDTask(&m_threadID, &completion));
completion.wait();
}
示例9: start
void CCThreadProxy::start()
{
ASSERT(isMainThread());
ASSERT(s_ccThread);
// Create LayerTreeHostImpl.
CCCompletionEvent completion;
s_ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::initializeImplOnImplThread, AllowCrossThreadAccess(&completion)));
completion.wait();
m_started = true;
}
示例10: stop
void CCThreadProxy::stop()
{
TRACE_EVENT("CCThreadProxy::stop", this, 0);
ASSERT(isMainThread());
// Synchronously deletes the impl.
CCCompletionEvent completion;
ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::layerTreeHostClosedOnCCThread, AllowCrossThreadAccess(&completion)));
completion.wait();
ASSERT(!m_layerTreeHostImpl); // verify that the impl deleted.
m_layerTreeHost = 0;
}
示例11: beginFrameAndCommit
void CCThreadProxy::beginFrameAndCommit(int sequenceNumber, double frameBeginTime, PassOwnPtr<CCScrollUpdateSet> scrollInfo)
{
TRACE_EVENT("CCThreadProxy::beginFrameAndCommit", this, 0);
ASSERT(isMainThread());
if (!m_layerTreeHost)
return;
// Scroll deltas need to be applied even if the commit will be dropped.
m_layerTreeHost->applyScrollDeltas(*scrollInfo.get());
// Drop beginFrameAndCommit calls that occur out of sequence. See createBeginFrameAndCommitTaskOnImplThread for
// an explanation of how out-of-sequence beginFrameAndCommit tasks can occur.
if (sequenceNumber < m_lastExecutedBeginFrameAndCommitSequenceNumber) {
TRACE_EVENT("EarlyOut_StaleBeginFrameAndCommit", this, 0);
return;
}
m_lastExecutedBeginFrameAndCommitSequenceNumber = sequenceNumber;
// FIXME: recreate the context if it was requested by the impl thread
{
TRACE_EVENT("CCLayerTreeHost::animateAndLayout", this, 0);
m_layerTreeHost->animateAndLayout(frameBeginTime);
}
ASSERT(m_lastExecutedBeginFrameAndCommitSequenceNumber == sequenceNumber);
// Clear the commit flag after animateAndLayout here --- objects that only
// layout when painted will trigger another setNeedsCommit inside
// updateLayers.
m_commitRequested = false;
m_layerTreeHost->updateLayers();
{
// Blocking call to CCThreadProxy::commitOnImplThread
TRACE_EVENT("commit", this, 0);
CCCompletionEvent completion;
s_ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::commitOnImplThread, AllowCrossThreadAccess(&completion)));
completion.wait();
}
m_layerTreeHost->commitComplete();
if (m_redrawAfterCommit)
setNeedsRedraw();
m_redrawAfterCommit = false;
ASSERT(m_lastExecutedBeginFrameAndCommitSequenceNumber == sequenceNumber);
}
示例12: stop
void CCThreadProxy::stop()
{
TRACE_EVENT("CCThreadProxy::stop", this, 0);
ASSERT(isMainThread());
ASSERT(m_started);
// Synchronously deletes the impl.
CCCompletionEvent completion;
s_ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::layerTreeHostClosedOnImplThread, AllowCrossThreadAccess(&completion)));
completion.wait();
m_mainThreadProxy->shutdown(); // Stop running tasks posted to us.
ASSERT(!m_layerTreeHostImpl); // verify that the impl deleted.
m_layerTreeHost = 0;
m_started = false;
}
示例13: beginFrameAndCommit
void CCThreadProxy::beginFrameAndCommit(double frameBeginTime)
{
ASSERT(isMainThread());
if (!m_layerTreeHost)
return;
TRACE_EVENT("CCThreadProxy::requestFrameAndCommit", this, 0);
{
TRACE_EVENT("CCLayerTreeHost::animateAndLayout", this, 0);
m_layerTreeHost->animateAndLayout(frameBeginTime);
}
m_commitPending = false;
// Blocking call to CCThreadProxy::performCommit
CCCompletionEvent completion;
ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::commitOnCCThread, AllowCrossThreadAccess(&completion)));
completion.wait();
}
示例14: stop
void CCThreadProxy::stop()
{
TRACE_EVENT0("cc", "CCThreadProxy::stop");
ASSERT(isMainThread());
ASSERT(m_started);
// Synchronously deletes the impl.
{
DebugScopedSetMainThreadBlocked mainThreadBlocked;
CCCompletionEvent completion;
CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::layerTreeHostClosedOnImplThread, &completion));
completion.wait();
}
m_mainThreadProxy->shutdown(); // Stop running tasks posted to us.
ASSERT(!m_layerTreeHostImpl); // verify that the impl deleted.
m_layerTreeHost = 0;
m_started = false;
}
示例15: initializeRenderer
bool CCThreadProxy::initializeRenderer()
{
TRACE_EVENT0("cc", "CCThreadProxy::initializeRenderer");
// Make a blocking call to initializeRendererOnImplThread. The results of that call
// are pushed into the initializeSucceeded and capabilities local variables.
CCCompletionEvent completion;
bool initializeSucceeded = false;
RendererCapabilities capabilities;
DebugScopedSetMainThreadBlocked mainThreadBlocked;
CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::initializeRendererOnImplThread,
&completion,
&initializeSucceeded,
&capabilities));
completion.wait();
if (initializeSucceeded) {
m_rendererInitialized = true;
m_RendererCapabilitiesMainThreadCopy = capabilities;
}
return initializeSucceeded;
}