本文整理匯總了C++中AllowCrossThreadAccess函數的典型用法代碼示例。如果您正苦於以下問題:C++ AllowCrossThreadAccess函數的具體用法?C++ AllowCrossThreadAccess怎麽用?C++ AllowCrossThreadAccess使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了AllowCrossThreadAccess函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: dispatchTaskToMainThread
void WorkerFileSystemCallbacksBridge::postCreateFileToMainThread(WebFileSystem* fileSystem, const KURL& path, bool exclusive, const String& mode)
{
dispatchTaskToMainThread(
createCallbackTask(&createFileOnMainThread,
AllowCrossThreadAccess(fileSystem), path, exclusive,
this, mode));
}
示例2: callOnMainThread
void AsyncFileStream::startOnFileThread()
{
// FIXME: It is not correct to check m_client from a secondary thread - stop() could be racing with this check.
if (!m_client)
return;
m_stream->start();
callOnMainThread(didStart, AllowCrossThreadAccess(this));
}
示例3: m_thread
DataConsumerHandleTestUtil::Thread::Thread(const char* name, InitializationPolicy initializationPolicy)
: m_thread(WebThreadSupportingGC::create(name))
, m_initializationPolicy(initializationPolicy)
, m_waitableEvent(adoptPtr(Platform::current()->createWaitableEvent()))
{
m_thread->postTask(BLINK_FROM_HERE, new Task(threadSafeBind(&Thread::initialize, AllowCrossThreadAccess(this))));
m_waitableEvent->wait();
}
示例4: ASSERT
void WorkerFileSystemCallbacksBridge::postCreateSnapshotFileToMainThread(WebFileSystem* fileSystem, const KURL& path, const String& mode)
{
ASSERT(fileSystem);
dispatchTaskToMainThread(
createCallbackTask(&createSnapshotFileOnMainThread,
AllowCrossThreadAccess(fileSystem),
path, this, mode));
}
示例5: AllowCrossThreadAccess
void WebWorkerClientImpl::confirmMessageFromWorkerObject(bool hasPendingActivity)
{
// unconfirmed_message_count_ can only be updated on the thread where it's
// accessed. Otherwise there are race conditions with v8's garbage
// collection.
m_scriptExecutionContext->postTask(createCallbackTask(&confirmMessageFromWorkerObjectTask,
AllowCrossThreadAccess(this)));
}
示例6: clearClientWrapper
void WorkerThreadableLoader::MainThreadBridge::destroy()
{
// Ensure that no more client callbacks are done in the worker context's thread.
clearClientWrapper();
// "delete this" and m_mainThreadLoader::deref() on the worker object's thread.
m_loaderProxy.postTaskToLoader(
createCallbackTask(&MainThreadBridge::mainThreadDestroy, AllowCrossThreadAccess(this)));
}
示例7: ASSERT
void HTMLParserThread::postTask(PassOwnPtr<CrossThreadClosure> closure)
{
ASSERT(isMainThread());
if (!m_thread) {
m_thread = WebThreadSupportingGC::create("HTMLParserThread");
postTask(threadSafeBind(&HTMLParserThread::setupHTMLParserThread, AllowCrossThreadAccess(this)));
}
m_thread->postTask(BLINK_FROM_HERE, closure);
}
示例8: dispatchTaskToMainThread
void WebWorkerBase::postConsoleMessageToWorkerObject(MessageSource source,
MessageType type,
MessageLevel level,
const String& message,
int lineNumber,
const String& sourceURL)
{
dispatchTaskToMainThread(createCallbackTask(&postConsoleMessageTask, AllowCrossThreadAccess(this),
source, type, level,
message, lineNumber, sourceURL));
}
示例9: m_workerClientWrapper
WorkerThreadableLoader::MainThreadBridge::MainThreadBridge(PassRefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, WorkerLoaderProxy& loaderProxy, const String& taskMode,
const ResourceRequest& request, const ThreadableLoaderOptions& options, const String& outgoingReferrer)
: m_workerClientWrapper(workerClientWrapper)
, m_loaderProxy(loaderProxy)
, m_taskMode(taskMode.isolatedCopy())
{
ASSERT(m_workerClientWrapper.get());
m_loaderProxy.postTaskToLoader(
createCallbackTask(&MainThreadBridge::mainThreadCreateLoader,
AllowCrossThreadAccess(this), request, options, outgoingReferrer));
}
示例10: ASSERT
void WorkerThreadableWebSocketChannel::Bridge::initialize()
{
ASSERT(!m_peer);
setMethodNotCompleted();
Ref<Bridge> protect(*this);
m_loaderProxy.postTaskToLoader(CrossThreadTask(&Bridge::mainThreadInitialize, AllowCrossThreadAccess(&m_loaderProxy), m_workerClientWrapper, m_taskMode));
waitForMethodCompletion();
// m_peer may be null when the nested runloop exited before a peer has created.
m_peer = m_workerClientWrapper->peer();
if (!m_peer)
m_workerClientWrapper->setFailedWebSocketChannelCreation();
}
示例11: createCallbackTask
void WebWorkerClientImpl::terminateWorkerContext()
{
if (m_askedToTerminate)
return;
m_askedToTerminate = true;
if (!isMainThread()) {
WebWorkerBase::dispatchTaskToMainThread(
createCallbackTask(&terminateWorkerContextTask, AllowCrossThreadAccess(this)));
return;
}
m_webWorker->terminateWorkerContext();
}
示例12: createCallbackTask
void WorkerThreadableLoader::MainThreadBridge::cancel()
{
m_loaderProxy.postTaskToLoader(
createCallbackTask(&MainThreadBridge::mainThreadCancel, AllowCrossThreadAccess(this)));
ThreadableLoaderClientWrapper* clientWrapper = m_workerClientWrapper.get();
if (!clientWrapper->done()) {
// If the client hasn't reached a termination state, then transition it by sending a cancellation error.
// Note: no more client callbacks will be done after this method -- the clearClientWrapper() call ensures that.
ResourceError error(String(), 0, String(), String());
error.setIsCancellation(true);
clientWrapper->didFail(error);
}
clearClientWrapper();
}
示例13: ASSERT
bool CCThreadProxy::initializeLayerRenderer()
{
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 initializeLayerRendererOnCCThread. The results of that call
// are pushed into the initializeSucceeded and capabilities local variables.
CCCompletionEvent completion;
bool initializeSucceeded;
LayerRendererCapabilities capabilities;
ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::initializeLayerRendererOnCCThread,
AllowCrossThreadAccess(contextPtr), AllowCrossThreadAccess(&completion), AllowCrossThreadAccess(&initializeSucceeded), AllowCrossThreadAccess(&capabilities)));
completion.wait();
if (initializeSucceeded)
m_layerRendererCapabilitiesMainThreadCopy = capabilities;
return initializeSucceeded;
}
示例14: TRACE_EVENT0
bool CCThreadProxy::recreateContext()
{
TRACE_EVENT0("cc", "CCThreadProxy::recreateContext");
ASSERT(isMainThread());
// Try to create the context.
RefPtr<GraphicsContext3D> context = m_layerTreeHost->createContext();
if (!context)
return false;
if (CCLayerTreeHost::needsFilterContext())
if (!SharedGraphicsContext3D::createForImplThread())
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 recreateContextOnImplThread. The results of that
// call are pushed into the recreateSucceeded and capabilities local
// variables.
CCCompletionEvent completion;
bool recreateSucceeded = false;
LayerRendererCapabilities capabilities;
CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::recreateContextOnImplThread,
AllowCrossThreadAccess(&completion),
AllowCrossThreadAccess(contextPtr),
AllowCrossThreadAccess(&recreateSucceeded),
AllowCrossThreadAccess(&capabilities)));
completion.wait();
if (recreateSucceeded)
m_layerRendererCapabilitiesMainThreadCopy = capabilities;
return recreateSucceeded;
}
示例15: m_clientBridge
WorkerThreadableLoader::MainThreadBridge::MainThreadBridge(
PassRefPtr<ThreadableLoaderClientWrapper> workerClientWrapper,
PassOwnPtr<ThreadableLoaderClient> clientBridge,
WorkerLoaderProxy& loaderProxy,
const ResourceRequest& request,
const ThreadableLoaderOptions& options,
const ResourceLoaderOptions& resourceLoaderOptions,
const String& outgoingReferrer)
: m_clientBridge(clientBridge)
, m_workerClientWrapper(workerClientWrapper)
, m_loaderProxy(loaderProxy)
{
ASSERT(m_workerClientWrapper.get());
ASSERT(m_clientBridge.get());
m_loaderProxy.postTaskToLoader(
createCrossThreadTask(&MainThreadBridge::mainThreadCreateLoader, AllowCrossThreadAccess(this), request, options, resourceLoaderOptions, outgoingReferrer));
}