• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ AllowCrossThreadAccess函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中AllowCrossThreadAccess函数的典型用法代码示例。如果您正苦于以下问题:C++ AllowCrossThreadAccess函数的具体用法?C++ AllowCrossThreadAccess怎么用?C++ AllowCrossThreadAccess使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了AllowCrossThreadAccess函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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));
}
开发者ID:ragner,项目名称:webkit,代码行数:7,代码来源:WorkerFileSystemCallbacksBridge.cpp


示例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));
}
开发者ID:3163504123,项目名称:phantomjs,代码行数:8,代码来源:AsyncFileStream.cpp


示例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();
}
开发者ID:howardroark2018,项目名称:chromium,代码行数:8,代码来源:DataConsumerHandleTestUtil.cpp


示例4: ASSERT

void WorkerFileSystemCallbacksBridge::postCreateSnapshotFileToMainThread(WebFileSystem* fileSystem, const KURL& path, const String& mode)
{
    ASSERT(fileSystem);
    dispatchTaskToMainThread(
        createCallbackTask(&createSnapshotFileOnMainThread,
                           AllowCrossThreadAccess(fileSystem),
                           path, this, mode));
}
开发者ID:ragner,项目名称:webkit,代码行数:8,代码来源:WorkerFileSystemCallbacksBridge.cpp


示例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)));
}
开发者ID:KDE,项目名称:android-qtwebkit,代码行数:8,代码来源:WebWorkerClientImpl.cpp


示例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)));
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:9,代码来源:WorkerThreadableLoader.cpp


示例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);
}
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:10,代码来源:HTMLParserThread.cpp


示例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));
}
开发者ID:sysrqb,项目名称:chromium-src,代码行数:11,代码来源:WebWorkerBase.cpp


示例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));
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:11,代码来源:WorkerThreadableLoader.cpp


示例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();
}
开发者ID:chenbk85,项目名称:webkit2-wincairo,代码行数:12,代码来源:WorkerThreadableWebSocketChannel.cpp


示例11: createCallbackTask

void WebWorkerClientImpl::terminateWorkerContext()
{
    if (m_askedToTerminate)
        return;
    m_askedToTerminate = true;
    if (!isMainThread()) {
        WebWorkerBase::dispatchTaskToMainThread(
            createCallbackTask(&terminateWorkerContextTask, AllowCrossThreadAccess(this)));
        return;
    }
    m_webWorker->terminateWorkerContext();
}
开发者ID:KDE,项目名称:android-qtwebkit,代码行数:12,代码来源:WebWorkerClientImpl.cpp


示例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();
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:14,代码来源:WorkerThreadableLoader.cpp


示例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;
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:24,代码来源:CCThreadProxy.cpp


示例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;
}
开发者ID:xiaolu31,项目名称:webkit-node,代码行数:36,代码来源:CCThreadProxy.cpp


示例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));
}
开发者ID:335969568,项目名称:Blink-1,代码行数:17,代码来源:WorkerThreadableLoader.cpp


示例16: MessagePortChannelArray

void WebWorkerImpl::postMessageToWorkerContext(const WebString& message,
                                               const WebMessagePortChannelArray& webChannels)
{
    OwnPtr<MessagePortChannelArray> channels;
    if (webChannels.size()) {
        channels = new MessagePortChannelArray(webChannels.size());
        for (size_t i = 0; i < webChannels.size(); ++i) {
            RefPtr<PlatformMessagePortChannel> platform_channel =
                PlatformMessagePortChannel::create(webChannels[i]);
            webChannels[i]->setClient(platform_channel.get());
            (*channels)[i] = MessagePortChannel::create(platform_channel);
        }
    }

    workerThread()->runLoop().postTask(
        createCallbackTask(&postMessageToWorkerContextTask,
                           AllowCrossThreadAccess(this), String(message), channels.release()));
}
开发者ID:KDE,项目名称:android-qtwebkit,代码行数:18,代码来源:WebWorkerImpl.cpp


示例17: TEST_F

TEST_F(ImageFrameGeneratorTest, incompleteDecodeBecomesCompleteMultiThreaded)
{
    setFrameStatus(ImageFrame::FramePartial);

    char buffer[100 * 100 * 4];
    m_generator->decodeAndScale(imageInfo(), 0, buffer, 100 * 4);
    EXPECT_EQ(1, m_decodeRequestCount);
    EXPECT_EQ(0, m_decodersDestroyed);

    // LocalFrame can now be decoded completely.
    setFrameStatus(ImageFrame::FrameComplete);
    addNewData();
    OwnPtr<WebThread> thread = adoptPtr(Platform::current()->createThread("DecodeThread"));
    thread->postTask(FROM_HERE, new Task(threadSafeBind(&decodeThreadMain, AllowCrossThreadAccess(m_generator.get()))));
    thread.clear();
    EXPECT_EQ(2, m_decodeRequestCount);
    EXPECT_EQ(1, m_decodersDestroyed);

    // Decoder created again.
    m_generator->decodeAndScale(imageInfo(), 0, buffer, 100 * 4);
    EXPECT_EQ(3, m_decodeRequestCount);
}
开发者ID:smishenk,项目名称:chromium-crosswalk,代码行数:22,代码来源:ImageFrameGeneratorTest.cpp



注:本文中的AllowCrossThreadAccess函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ AlphaBlend函数代码示例发布时间:2022-05-30
下一篇:
C++ Allocator_free函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap