当前位置: 首页>>代码示例>>C++>>正文


C++ WorkerContext::thread方法代码示例

本文整理汇总了C++中WorkerContext::thread方法的典型用法代码示例。如果您正苦于以下问题:C++ WorkerContext::thread方法的具体用法?C++ WorkerContext::thread怎么用?C++ WorkerContext::thread使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WorkerContext的用法示例。


在下文中一共展示了WorkerContext::thread方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: allowIndexedDB

bool IDBFactoryBackendProxy::allowIndexedDB(ScriptExecutionContext* context, const String& name, const WebSecurityOrigin& origin, PassRefPtr<IDBCallbacks> callbacks)
{
    bool allowed;
    ASSERT(context->isDocument() || context->isWorkerContext());
    if (context->isDocument()) {
        Document* document = static_cast<Document*>(context);
        WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame());
        WebViewImpl* webView = webFrame->viewImpl();
        // FIXME: webView->permissionClient() returns 0 in test_shell and content_shell http://crbug.com/137269
        allowed = !webView->permissionClient() || webView->permissionClient()->allowIndexedDB(webFrame, name, origin);
    } else {
        WorkerContext* workerContext = static_cast<WorkerContext*>(context);
        WebWorkerBase* webWorkerBase = static_cast<WebWorkerBase*>(&workerContext->thread()->workerLoaderProxy());
        WorkerRunLoop& runLoop = workerContext->thread()->runLoop();

        String mode = allowIndexedDBMode;
        mode.append(String::number(runLoop.createUniqueId()));
        RefPtr<AllowIndexedDBMainThreadBridge> bridge = AllowIndexedDBMainThreadBridge::create(webWorkerBase, mode, name);

        // Either the bridge returns, or the queue gets terminated.
        if (runLoop.runInMode(workerContext, mode) == MessageQueueTerminated) {
            bridge->cancel();
            allowed = false;
        } else
            allowed = bridge->result();
    }

    if (!allowed)
        callbacks->onError(WebIDBDatabaseError(IDBDatabaseException::UNKNOWN_ERR, "The user denied permission to access the database."));

    return allowed;
}
开发者ID:dog-god,项目名称:iptv,代码行数:32,代码来源:IDBFactoryBackendProxy.cpp

示例2: performTask

 virtual void performTask(ScriptExecutionContext *context)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(context->isWorkerContext());
     WorkerContext* workerContext = static_cast<WorkerContext*>(context);
     // Notify parent that this context is closed. Parent is responsible for calling WorkerThread::stop().
     workerContext->thread()->workerReportingProxy().workerContextClosed();
 }
开发者ID:,项目名称:,代码行数:7,代码来源:

示例3: canEstablishDatabase

bool DatabaseObserver::canEstablishDatabase(ScriptExecutionContext* scriptExecutionContext, const String& name, const String& displayName, unsigned long estimatedSize)
{
    ASSERT(scriptExecutionContext->isContextThread());
    ASSERT(scriptExecutionContext->isDocument() || scriptExecutionContext->isWorkerContext());
    if (scriptExecutionContext->isDocument()) {
        Document* document = static_cast<Document*>(scriptExecutionContext);
        WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame());
        if (!webFrame)
            return false;
        WebViewImpl* webView = webFrame->viewImpl();
        if (!webView)
            return false;
        if (webView->permissionClient())
            return webView->permissionClient()->allowDatabase(webFrame, name, displayName, estimatedSize);
    } else {
#if ENABLE(WORKERS)
        WorkerContext* workerContext = static_cast<WorkerContext*>(scriptExecutionContext);
        WorkerLoaderProxy* workerLoaderProxy = &workerContext->thread()->workerLoaderProxy();
        NewWebWorkerBase* webWorker = static_cast<NewWebWorkerBase*>(workerLoaderProxy);
        return allowDatabaseForWorker(webWorker->newCommonClient(), webWorker->view()->mainFrame(), name, displayName, estimatedSize);
#else
        ASSERT_NOT_REACHED();
#endif
    }

    return true;
}
开发者ID:jparound30,项目名称:webkit,代码行数:27,代码来源:DatabaseObserver.cpp

示例4: performTask

 virtual void performTask(ScriptExecutionContext *context)
 {
     ASSERT(context->isWorkerContext());
     WorkerContext* workerContext = static_cast<WorkerContext*>(context);
     // It's not safe to call clearScript until all the cleanup tasks posted by functions initiated by WorkerThreadShutdownStartTask have completed.
     workerContext->clearScript();
     workerContext->thread()->runLoop().terminate();
 }
开发者ID:azrul2202,项目名称:WebKit-Smartphone,代码行数:8,代码来源:WorkerThread.cpp

示例5: waitForOperationToComplete

bool WorkerFileWriterCallbacksBridge::waitForOperationToComplete()
{
    while (m_operationInProgress) {
        WorkerContext* context = static_cast<WorkerContext*>(m_workerContext);
        if (context->thread()->runLoop().runInMode(context, m_mode) == MessageQueueTerminated)
            return false;
    }
    return true;
}
开发者ID:Channely,项目名称:know-your-chrome,代码行数:9,代码来源:WorkerFileWriterCallbacksBridge.cpp

示例6: removeRequestFromCache

void MemoryCache::removeRequestFromCache(ScriptExecutionContext* context, const ResourceRequest& request)
{
#if ENABLE(WORKERS)
    if (context->isWorkerContext()) {
        WorkerContext* workerContext = static_cast<WorkerContext*>(context);
        workerContext->thread()->workerLoaderProxy().postTaskToLoader(createCallbackTask(&crossThreadRemoveRequestFromCache, request));
        return;
    }
#endif

    removeRequestFromCacheImpl(context, request);
}
开发者ID:jbat100,项目名称:webkit,代码行数:12,代码来源:MemoryCache.cpp

示例7: openFileSystem

static void openFileSystem(ScriptExecutionContext* context, const String& basePath, FileSystemType type, long long size, bool create, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, FileSystemSynchronousType synchronousType)
{
    ASSERT(context);
    ASSERT(type != FileSystemTypeIsolated);
    if (type == FileSystemTypeIsolated)
        return;

    KURL url = context->url();
    if (url.hasFragmentIdentifier())
        url.removeFragmentIdentifier();
    url.setQuery(String());
    url.setPath("/");
    StringBuilder builder;
    builder.append("filesystem:");
    builder.append(url.string());
    builder.append(fileSystemTypeString(type));
    KURL rootURL = context->completeURL(builder.toString());
    ASSERT(rootURL.isValid());

    // TODO: Ask user for file system permission.

    if (context->isDocument()) {
        int playerId = 0;
        Page* page = static_cast<Document*>(context)->page();
        if (page)
            playerId = page->chrome().client()->platformPageClient()->playerID();
        AsyncFileSystemBlackBerry::openFileSystem(rootURL, basePath, context->securityOrigin()->databaseIdentifier(), type, size, create, playerId, callbacks);
    } else {
#if ENABLE(WORKERS)
        WorkerContext* workerContext = static_cast<WorkerContext*>(context);
        String mode = openFileSystemMode;
        mode.append(String::number(workerContext->thread()->runLoop().createUniqueId()));
        WorkerAsyncFileSystemBlackBerry::openFileSystem(workerContext, rootURL, mode, basePath, context->securityOrigin()->databaseIdentifier(), type, size, create, callbacks);
        if (synchronousType == SynchronousFileSystem)
            workerContext->thread()->runLoop().runInMode(workerContext, mode);
#else
        ASSERT_NOT_REACHED();
#endif
    }
}
开发者ID:Zangalot,项目名称:phantomjs-webkit,代码行数:40,代码来源:LocalFileSystemBlackBerry.cpp

示例8: create

PassRefPtr<ThreadableWebSocketChannel> ThreadableWebSocketChannel::create(ScriptExecutionContext* context, WebSocketChannelClient* client)
{
    ASSERT(context);
    ASSERT(client);

#if ENABLE(WORKERS)
    if (context->isWorkerContext()) {
        WorkerContext* workerContext = static_cast<WorkerContext*>(context);
        WorkerRunLoop& runLoop = workerContext->thread()->runLoop();
        String mode = webSocketChannelMode;
        mode.append(String::number(runLoop.createUniqueId()));
        return WorkerThreadableWebSocketChannel::create(workerContext, client, mode);
    }
#endif // ENABLE(WORKERS)

    return WebSocketChannel::create(toDocument(context), client);
}
开发者ID:Anthony-Biget,项目名称:openjfx,代码行数:17,代码来源:ThreadableWebSocketChannel.cpp

示例9: runMessageLoopOnPause

void WorkerScriptDebugServer::runMessageLoopOnPause(v8::Handle<v8::Context> context)
{
    WorkerContext* workerContext = retrieveWorkerContext(context);
    WorkerThread* workerThread = workerContext->thread();

    m_pausedWorkerContext = workerContext;

    MessageQueueWaitResult result;
    do {
        result = workerThread->runLoop().runInMode(workerContext, debuggerTaskMode);
    // Keep waiting until execution is resumed.
    } while (result == MessageQueueMessageReceived && isPaused());
    m_pausedWorkerContext = 0;
    
    // The listener may have been removed in the nested loop.
    if (ScriptDebugListener* listener = m_listenersMap.get(workerContext))
        listener->didContinue();
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:18,代码来源:WorkerScriptDebugServer.cpp

示例10: create

PassRefPtr<WebSocketChannel> WebSocketChannel::create(ScriptExecutionContext* context, WebSocketChannelClient* client)
{
    ASSERT(context);
    ASSERT(client);

    if (context->isWorkerContext()) {
        WorkerContext* workerContext = static_cast<WorkerContext*>(context);
        WorkerRunLoop& runLoop = workerContext->thread()->runLoop();
        String mode = webSocketChannelMode;
        mode.append(String::number(runLoop.createUniqueId()));
        return WorkerThreadableWebSocketChannel::create(workerContext, client, mode);
    }

    if (RuntimeEnabledFeatures::experimentalWebSocketEnabled()) {
        // FIXME: Create and return an "experimental" WebSocketChannel instead of a MainThreadWebSocketChannel.
        return MainThreadWebSocketChannel::create(toDocument(context), client);
    }
    return MainThreadWebSocketChannel::create(toDocument(context), client);
}
开发者ID:Channely,项目名称:know-your-chrome,代码行数:19,代码来源:WebSocketChannel.cpp

示例11: performTask

    virtual void performTask(ScriptExecutionContext* scriptContext)
    {
        ASSERT(scriptContext->isWorkerContext());
        WorkerContext* context = static_cast<WorkerContext*>(scriptContext);

        RefPtr<Event> evt = MessageEvent::create(m_message, "", "", 0, 0);

        if (context->onmessage()) {
            evt->setTarget(context);
            evt->setCurrentTarget(context);
            context->onmessage()->handleEvent(evt.get(), false);
        }

        ExceptionCode ec = 0;
        context->dispatchEvent(evt.release(), ec);
        ASSERT(!ec);

        context->thread()->messagingProxy()->confirmWorkerThreadMessage(context->hasPendingActivity());
    }
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:19,代码来源:WorkerMessagingProxy.cpp

示例12: deleteFileSystem

void LocalFileSystem::deleteFileSystem(ScriptExecutionContext* context, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
    ASSERT(context);
    ASSERT(type != FileSystemTypeIsolated);
    if (type == FileSystemTypeIsolated)
        return;

    // TODO: Ask user for file system permission.

    if (context->isDocument())
        AsyncFileSystemBlackBerry::deleteFileSystem(fileSystemBasePath(), context->securityOrigin()->databaseIdentifier(), type, callbacks);
    else {
#if ENABLE(WORKERS)
        WorkerContext* workerContext = static_cast<WorkerContext*>(context);
        String mode = deleteFileSystemMode;
        mode.append(String::number(workerContext->thread()->runLoop().createUniqueId()));
        WorkerAsyncFileSystemBlackBerry::deleteFileSystem(workerContext, mode, fileSystemBasePath(), context->securityOrigin()->databaseIdentifier(), type, callbacks);
#else
        ASSERT_NOT_REACHED();
#endif
    }
}
开发者ID:Zangalot,项目名称:phantomjs-webkit,代码行数:22,代码来源:LocalFileSystemBlackBerry.cpp

示例13: performTask

 virtual void performTask(ScriptExecutionContext *context)
 {
     ASSERT(context->isWorkerContext());
     WorkerContext* workerContext = static_cast<WorkerContext*>(context);
     workerContext->thread()->runLoop().terminate();
 }
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:6,代码来源:WorkerThread.cpp


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