您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ toWorkerGlobalScope函数代码示例

51自学网 2021-06-03 08:53:46
  C++
这篇教程C++ toWorkerGlobalScope函数代码示例写得很实用,希望能帮到您。

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

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

示例1: lock

void WorkerThread::stop(){    // Mutex protection is necessary because stop() can be called before the context is fully created.    MutexLocker lock(m_threadCreationMutex);    // Ensure that tasks are being handled by thread event loop. If script execution weren't forbidden, a while(1) loop in JS could keep the thread alive forever.    if (m_workerGlobalScope) {        m_workerGlobalScope->script()->scheduleExecutionTermination();#if ENABLE(SQL_DATABASE)        DatabaseManager::manager().interruptAllDatabasesForContext(m_workerGlobalScope.get());#endif        m_runLoop.postTaskAndTerminate({ ScriptExecutionContext::Task::CleanupTask, [] (ScriptExecutionContext* context ) {            WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context);#if ENABLE(SQL_DATABASE)            // FIXME: Should we stop the databases as part of stopActiveDOMObjects() below?            DatabaseTaskSynchronizer cleanupSync;            DatabaseManager::manager().stopDatabases(workerGlobalScope, &cleanupSync);#endif            workerGlobalScope->stopActiveDOMObjects();            workerGlobalScope->notifyObserversOfStop();            // Event listeners would keep DOMWrapperWorld objects alive for too long. Also, they have references to JS objects,            // which become dangling once Heap is destroyed.            workerGlobalScope->removeAllEventListeners();#if ENABLE(SQL_DATABASE)            // We wait for the database thread to clean up all its stuff so that we            // can do more stringent leak checks as we exit.            cleanupSync.waitForTaskCompletion();#endif            // Stick a shutdown command at the end of the queue, so that we deal            // with all the cleanup tasks the databases post first.            workerGlobalScope->postTask({ ScriptExecutionContext::Task::CleanupTask, [] (ScriptExecutionContext* context) {                WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context);                // It's not safe to call clearScript until all the cleanup tasks posted by functions initiated by WorkerThreadShutdownStartTask have completed.                workerGlobalScope->clearScript();            } });        } });        return;    }    m_runLoop.terminate();}
开发者ID:Wrichik1999,项目名称:webkit,代码行数:48,


示例2: DCHECK

void InProcessWorkerObjectProxy::didCreateWorkerGlobalScope(    WorkerOrWorkletGlobalScope* globalScope) {  DCHECK(!m_workerGlobalScope);  m_workerGlobalScope = toWorkerGlobalScope(globalScope);  m_timer = wrapUnique(new Timer<InProcessWorkerObjectProxy>(      this, &InProcessWorkerObjectProxy::checkPendingActivity));}
开发者ID:mirror,项目名称:chromium,代码行数:7,


示例3: while

void MessagePort::dispatchMessages() {  // Because close() doesn't cancel any in flight calls to dispatchMessages() we  // need to check if the port is still open before dispatch.  if (m_closed)    return;  // Messages for contexts that are not fully active get dispatched too, but  // JSAbstractEventListener::handleEvent() doesn't call handlers for these.  // The HTML5 spec specifies that any messages sent to a document that is not  // fully active should be dropped, so this behavior is OK.  if (!started())    return;  RefPtr<SerializedScriptValue> message;  std::unique_ptr<MessagePortChannelArray> channels;  while (tryGetMessage(message, channels)) {    // close() in Worker onmessage handler should prevent next message from    // dispatching.    if (getExecutionContext()->isWorkerGlobalScope() &&        toWorkerGlobalScope(getExecutionContext())->isClosing())      return;    MessagePortArray* ports =        MessagePort::entanglePorts(*getExecutionContext(), std::move(channels));    Event* evt = MessageEvent::create(ports, message.release());    dispatchEvent(evt);  }}
开发者ID:ollie314,项目名称:chromium,代码行数:29,


示例4: from

    static ThrottlingController* from(ExecutionContext* context)    {        if (!context)            return 0;        if (context->isDocument()) {            Document* document = toDocument(context);            if (!document->frame())                return 0;            ThrottlingController* controller = static_cast<ThrottlingController*>(WillBeHeapSupplement<LocalFrame>::from(document->frame(), supplementName()));            if (controller)                return controller;            controller = new ThrottlingController();            WillBeHeapSupplement<LocalFrame>::provideTo(*document->frame(), supplementName(), adoptPtrWillBeNoop(controller));            return controller;        }        ASSERT(!isMainThread());        ASSERT(context->isWorkerGlobalScope());        WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context);        ThrottlingController* controller = static_cast<ThrottlingController*>(WillBeHeapSupplement<WorkerClients>::from(workerGlobalScope->clients(), supplementName()));        if (controller)            return controller;        controller = new ThrottlingController();        WillBeHeapSupplement<WorkerClients>::provideTo(*workerGlobalScope->clients(), supplementName(), adoptPtrWillBeNoop(controller));        return controller;    }
开发者ID:eth-srl,项目名称:BlinkER,代码行数:29,


示例5: performTask

    virtual void performTask(ScriptExecutionContext *context)    {        WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context);#if ENABLE(SQL_DATABASE)        // FIXME: Should we stop the databases as part of stopActiveDOMObjects() below?        DatabaseTaskSynchronizer cleanupSync;        DatabaseManager::manager().stopDatabases(workerGlobalScope, &cleanupSync);#endif        workerGlobalScope->stopActiveDOMObjects();        workerGlobalScope->notifyObserversOfStop();        // Event listeners would keep DOMWrapperWorld objects alive for too long. Also, they have references to JS objects,        // which become dangling once Heap is destroyed.        workerGlobalScope->removeAllEventListeners();#if ENABLE(SQL_DATABASE)        // We wait for the database thread to clean up all its stuff so that we        // can do more stringent leak checks as we exit.        cleanupSync.waitForTaskCompletion();#endif        // Stick a shutdown command at the end of the queue, so that we deal        // with all the cleanup tasks the databases post first.        workerGlobalScope->postTask(WorkerThreadShutdownFinishTask::create());    }
开发者ID:boska,项目名称:webkit,代码行数:28,


示例6: protect

void V8WorkerGlobalScopeEventListener::handleEvent(ExecutionContext* context, Event* event){    if (!context)        return;    // The callback function on XMLHttpRequest can clear the event listener and destroys 'this' object. Keep a local reference to it.    // See issue 889829.    RefPtr<V8AbstractEventListener> protect(this);    v8::Isolate* isolate = toIsolate(context);    v8::HandleScope handleScope(isolate);    WorkerScriptController* script = toWorkerGlobalScope(context)->script();    if (!script)        return;    v8::Handle<v8::Context> v8Context = script->context();    if (v8Context.IsEmpty())        return;    // Enter the V8 context in which to perform the event handling.    v8::Context::Scope scope(v8Context);    // Get the V8 wrapper for the event object.    v8::Handle<v8::Value> jsEvent = toV8(event, v8::Handle<v8::Object>(), isolate);    invokeEventHandler(context, event, v8::Local<v8::Value>::New(isolate, jsEvent));}
开发者ID:Mihiri,项目名称:blink,代码行数:28,


示例7: execute

void ScheduledAction::execute(ScriptExecutionContext* context){    if (context->isDocument())        execute(toDocument(context));    else        execute(toWorkerGlobalScope(context));}
开发者ID:MYSHLIFE,项目名称:webkit,代码行数:7,


示例8: ASSERT

double WorkerPerformance::now(ExecutionContext* context) const{    ASSERT(context);    ASSERT(context->isWorkerGlobalScope());    WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context);    return 1000.0 * (monotonicallyIncreasingTime() - workerGlobalScope->timeOrigin());}
开发者ID:PeterWangIntel,项目名称:blink-crosswalk,代码行数:7,


示例9: ASSERT

bool DatabaseObserver::canEstablishDatabase(ExecutionContext* executionContext, const String& name, const String& displayName, unsigned long estimatedSize){    ASSERT(executionContext->isContextThread());    ASSERT(executionContext->isDocument() || executionContext->isWorkerGlobalScope());    if (executionContext->isDocument()) {        Document* document = toDocument(executionContext);        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 {        WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(executionContext);        WorkerPermissionClient* permissionClient = WorkerPermissionClient::from(workerGlobalScope);        if (permissionClient->proxy())            return permissionClient->allowDatabase(name, displayName, estimatedSize);        // FIXME: Deprecate this bridge code when PermissionClientProxy is        // implemented by the embedder.        WebWorkerBase* webWorker = static_cast<WebWorkerBase*>(workerGlobalScope->thread()->workerLoaderProxy().toWebWorkerBase());        WebView* view = webWorker->view();        if (!view)            return false;        return allowDatabaseForWorker(view->mainFrame(), name, displayName, estimatedSize);    }    return true;}
开发者ID:rzr,项目名称:Tizen_Crosswalk,代码行数:31,


示例10: ASSERT

bool DatabaseObserver::canEstablishDatabase(ScriptExecutionContext* scriptExecutionContext, const String& name, const String& displayName, unsigned long estimatedSize){    ASSERT(scriptExecutionContext->isContextThread());    ASSERT(scriptExecutionContext->isDocument() || scriptExecutionContext->isWorkerGlobalScope());    if (scriptExecutionContext->isDocument()) {        Document* document = toDocument(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 {        WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(scriptExecutionContext);        WebWorkerBase* webWorker = static_cast<WebWorkerBase*>(workerGlobalScope->thread()->workerLoaderProxy().toWebWorkerBase());        WebView* view = webWorker->view();        if (!view)            return false;        return allowDatabaseForWorker(view->mainFrame(), name, displayName, estimatedSize);    }    return true;}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:25,


示例11: ASSERT

void ScriptExecutionContext::destroyedMessagePort(MessagePort& messagePort){    ASSERT((isDocument() && isMainThread())        || (isWorkerGlobalScope() && currentThread() == toWorkerGlobalScope(this)->thread().threadID()));    m_messagePorts.remove(&messagePort);}
开发者ID:sinoory,项目名称:webv8,代码行数:7,


示例12: ASSERT

WorkerMessagingProxy::~WorkerMessagingProxy(){    ASSERT(!m_workerObject);    ASSERT((m_executionContext->isDocument() && isMainThread())        || (m_executionContext->isWorkerGlobalScope() && toWorkerGlobalScope(m_executionContext.get())->thread()->isCurrentThread()));    if (m_loaderProxy)        m_loaderProxy->detachProvider(this);}
开发者ID:Pluto-tv,项目名称:blink-crosswalk,代码行数:8,


示例13: ASSERT

void ScriptExecutionContext::createdMessagePort(MessagePort* port){    ASSERT(port);    ASSERT((isDocument() && isMainThread())        || (isWorkerGlobalScope() && currentThread() == toWorkerGlobalScope(this)->thread().threadID()));    m_messagePorts.add(port);}
开发者ID:MYSHLIFE,项目名称:webkit,代码行数:8,


示例14: fromInternal

ImageBitmapFactories& ImageBitmapFactories::from(EventTarget& eventTarget){    if (LocalDOMWindow* window = eventTarget.toDOMWindow())        return fromInternal(*window);    ASSERT(eventTarget.executionContext()->isWorkerGlobalScope());    return ImageBitmapFactories::fromInternal(*toWorkerGlobalScope(eventTarget.executionContext()));}
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:8,


示例15: supplementName

LocalFileSystem* LocalFileSystem::from(ExecutionContext& context){    if (context.isDocument()) {        return static_cast<LocalFileSystem*>(WillBeHeapSupplement<LocalFrame>::from(toDocument(context).frame(), supplementName()));    }    ASSERT(context.isWorkerGlobalScope());    return static_cast<LocalFileSystem*>(WillBeHeapSupplement<WorkerClients>::from(toWorkerGlobalScope(context).clients(), supplementName()));}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:8,


示例16: toWorkerGlobalScope

void WorkerMessagingProxy::disconnectFromInspector(){    m_pageInspector = 0;    if (m_askedToTerminate)        return;    m_workerThread->runLoop().postTaskForMode([] (ScriptExecutionContext* context) {        toWorkerGlobalScope(context)->workerInspectorController().disconnectFrontend(Inspector::InspectorDisconnectReason::InspectorDestroyed);    }, WorkerDebuggerAgent::debuggerTaskMode);}
开发者ID:Zirias,项目名称:webkitfltk,代码行数:9,


示例17: protector

// This is called if the associated ExecutionContext is destructing while// we're still associated with it. That's our cue to disassociate and shutdown.// To do this, we stop the database and let everything shutdown naturally// because the database closing process may still make use of this context.// It is not safe to just delete the context here.void DatabaseContext::contextDestroyed(){    RefPtrWillBeRawPtr<DatabaseContext> protector(this);    stopDatabases();    if (executionContext()->isWorkerGlobalScope())        toWorkerGlobalScope(executionContext())->unregisterTerminationObserver(this);    DatabaseManager::manager().unregisterDatabaseContext(this);    ActiveDOMObject::contextDestroyed();}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:14,


示例18: toWorkerGlobalScope

void MemoryCache::removeURLFromCache(ExecutionContext* context, const KURL& url){    if (context->isWorkerGlobalScope()) {        WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context);        workerGlobalScope->thread()->workerLoaderProxy().postTaskToLoader(createCallbackTask(&removeURLFromCacheInternal, url));        return;    }    removeURLFromCacheInternal(context, url);}
开发者ID:Igalia,项目名称:blink,代码行数:9,


示例19: toWorkerGlobalScope

void WebSharedWorkerImpl::connectTask(PassOwnPtr<WebMessagePortChannel> channel, ExecutionContext* context){    // Wrap the passed-in channel in a MessagePort, and send it off via a connect event.    MessagePort* port = MessagePort::create(*context);    port->entangle(channel);    WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context);    ASSERT_WITH_SECURITY_IMPLICATION(workerGlobalScope->isSharedWorkerGlobalScope());    workerGlobalScope->dispatchEvent(createConnectEvent(port));}
开发者ID:howardroark2018,项目名称:chromium,代码行数:9,


示例20: loadResourceSynchronously

void ThreadableLoader::loadResourceSynchronously(ExecutionContext& context, const ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions){    if (context.isWorkerGlobalScope()) {        WorkerThreadableLoader::loadResourceSynchronously(toWorkerGlobalScope(context), request, client, options, resourceLoaderOptions);        return;    }    DocumentThreadableLoader::loadResourceSynchronously(toDocument(context), request, client, options, resourceLoaderOptions);}
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:9,


示例21: executionContext

bool ActiveDOMCallback::isScriptControllerTerminating() const{    ExecutionContext* context = executionContext();    if (context && context->isWorkerGlobalScope()) {        WorkerScriptController* scriptController = toWorkerGlobalScope(context)->script();        if (!scriptController || scriptController->isExecutionForbidden() || scriptController->isExecutionTerminating())            return true;    }    return false;}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:10,


示例22: toDocument

IndexedDBClient* IndexedDBClient::from(ExecutionContext* context) {  if (context->isDocument())    return static_cast<IndexedDBClient*>(Supplement<LocalFrame>::from(        toDocument(*context).frame(), supplementName()));  WorkerClients* clients = toWorkerGlobalScope(*context).clients();  ASSERT(clients);  return static_cast<IndexedDBClient*>(      Supplement<WorkerClients>::from(clients, supplementName()));}
开发者ID:mirror,项目名称:chromium,代码行数:10,


示例23: toWorkerGlobalScope

void WebSharedWorkerImpl::connectTask(WebMessagePortChannelUniquePtr channel,                                      ExecutionContext* context) {  // Wrap the passed-in channel in a MessagePort, and send it off via a connect  // event.  MessagePort* port = MessagePort::create(*context);  port->entangle(std::move(channel));  WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context);  SECURITY_DCHECK(workerGlobalScope->isSharedWorkerGlobalScope());  workerGlobalScope->dispatchEvent(createConnectEvent(port));}
开发者ID:mirror,项目名称:chromium,代码行数:10,


示例24: ASSERT

void WorkerMessagingProxy::connectToInspector(WorkerGlobalScopeProxy::PageInspector* pageInspector){    if (m_askedToTerminate)        return;    ASSERT(!m_pageInspector);    m_pageInspector = pageInspector;    m_workerThread->runLoop().postTaskForMode([] (ScriptExecutionContext* context) {        toWorkerGlobalScope(context)->workerInspectorController().connectFrontend();    }, WorkerDebuggerAgent::debuggerTaskMode);}
开发者ID:Zirias,项目名称:webkitfltk,代码行数:10,


示例25: ASSERT

PassOwnPtr<ThreadableLoader> ThreadableLoader::create(ExecutionContext& context, ThreadableLoaderClient* client, const ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions){    ASSERT(client);    if (context.isWorkerGlobalScope()) {        return WorkerThreadableLoader::create(toWorkerGlobalScope(context), client, options, resourceLoaderOptions);    }    return DocumentThreadableLoader::create(toDocument(context), client, options, resourceLoaderOptions);}
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:10,


示例26: ASSERT

bool LocalFileSystemClient::requestFileSystemAccessSync(ExecutionContext* context){    ASSERT(context);    if (context->isDocument()) {        ASSERT_NOT_REACHED();        return false;    }    ASSERT(context->isWorkerGlobalScope());    return WorkerPermissionClient::from(*toWorkerGlobalScope(context))->requestFileSystemAccessSync();}
开发者ID:335969568,项目名称:Blink-1,代码行数:11,



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


C++ to_acpi_device函数代码示例
C++ toWebLocalFrameImpl函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。