本文整理汇总了C++中WorkerGlobalScope类的典型用法代码示例。如果您正苦于以下问题:C++ WorkerGlobalScope类的具体用法?C++ WorkerGlobalScope怎么用?C++ WorkerGlobalScope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WorkerGlobalScope类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: performTask
virtual void performTask(ScriptExecutionContext *context)
{
ASSERT_WITH_SECURITY_IMPLICATION(context->isWorkerGlobalScope());
WorkerGlobalScope* workerGlobalScope = static_cast<WorkerGlobalScope*>(context);
// It's not safe to call clearScript until all the cleanup tasks posted by functions initiated by WorkerThreadShutdownStartTask have completed.
workerGlobalScope->clearScript();
}
开发者ID:CannedFish,项目名称:webkitgtk,代码行数:7,代码来源:WorkerThread.cpp
示例2: 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,代码来源:WorkerPerformance.cpp
示例3: 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,代码来源:WorkerThread.cpp
示例4: 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,代码来源:DatabaseObserver.cpp
示例5: 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,代码来源:FileReader.cpp
示例6: 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,代码来源:DatabaseObserver.cpp
示例7: Dump
void WorkerDebuggerGlobalScope::Dump(JSContext* aCx,
const Optional<nsAString>& aString) const {
WorkerGlobalScope* scope = mWorkerPrivate->GetOrCreateGlobalScope(aCx);
if (scope) {
scope->Dump(aString);
}
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:7,代码来源:WorkerScope.cpp
示例8: performTask
virtual void performTask(ScriptExecutionContext *context)
{
ASSERT_WITH_SECURITY_IMPLICATION(context->isWorkerGlobalScope());
WorkerGlobalScope* workerGlobalScope = static_cast<WorkerGlobalScope*>(context);
// Notify parent that this context is closed. Parent is responsible for calling WorkerThread::stop().
workerGlobalScope->thread()->workerReportingProxy().workerGlobalScopeClosed();
}
开发者ID:JeStasG,项目名称:phantomjs,代码行数:7,代码来源:WorkerGlobalScope.cpp
示例9: 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,代码来源:WebSharedWorkerImpl.cpp
示例10: 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,代码来源:MemoryCache.cpp
示例11: 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,代码来源:WebSharedWorkerImpl.cpp
示例12: GetGlobal
void WorkerDebuggerGlobalScope::GetGlobal(JSContext* aCx,
JS::MutableHandle<JSObject*> aGlobal,
ErrorResult& aRv) {
WorkerGlobalScope* scope = mWorkerPrivate->GetOrCreateGlobalScope(aCx);
if (!scope) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
aGlobal.set(scope->GetWrapper());
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:11,代码来源:WorkerScope.cpp
示例13: performTask
virtual void performTask(ScriptExecutionContext* scriptContext)
{
RefPtr<MessagePort> port = MessagePort::create(*scriptContext);
port->entangle(m_channel.release());
ASSERT_WITH_SECURITY_IMPLICATION(scriptContext->isWorkerGlobalScope());
WorkerGlobalScope* workerGlobalScope = static_cast<WorkerGlobalScope*>(scriptContext);
// Since close() stops the thread event loop, this should not ever get called while closing.
ASSERT(!workerGlobalScope->isClosing());
ASSERT_WITH_SECURITY_IMPLICATION(workerGlobalScope->isSharedWorkerGlobalScope());
workerGlobalScope->dispatchEvent(createConnectEvent(port));
}
开发者ID:kodybrown,项目名称:webkit,代码行数:11,代码来源:DefaultSharedWorkerRepository.cpp
示例14: SharedWorkerConnectTask
SharedWorkerConnectTask(MessagePortChannel* channel)
: ScriptExecutionContext::Task([=] (ScriptExecutionContext& context) {
RefPtr<MessagePort> port = MessagePort::create(context);
port->entangle(std::unique_ptr<MessagePortChannel>(channel));
ASSERT_WITH_SECURITY_IMPLICATION(context.isWorkerGlobalScope());
WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(&context);
// Since close() stops the thread event loop, this should not ever get called while closing.
ASSERT(!workerGlobalScope->isClosing());
ASSERT_WITH_SECURITY_IMPLICATION(workerGlobalScope->isSharedWorkerGlobalScope());
workerGlobalScope->dispatchEvent(createConnectEvent(port));
})
{
}
开发者ID:aosm,项目名称:WebCore,代码行数:13,代码来源:DefaultSharedWorkerRepository.cpp
示例15: controllerForContext
WorkerScriptController* WorkerScriptController::controllerForContext(v8::Isolate* isolate)
{
// Happens on frame destruction, check otherwise GetCurrent() will crash.
if (!isolate || !isolate->InContext())
return 0;
v8::Handle<v8::Context> context = isolate->GetCurrentContext();
v8::Handle<v8::Object> global = context->Global();
global = global->FindInstanceInPrototypeChain(V8WorkerGlobalScope::domTemplate(isolate, WorkerWorld));
// Return 0 if the current executing context is not the worker context.
if (global.IsEmpty())
return 0;
WorkerGlobalScope* workerGlobalScope = V8WorkerGlobalScope::toNative(global);
return workerGlobalScope->script();
}
开发者ID:kublaj,项目名称:blink,代码行数:14,代码来源:WorkerScriptController.cpp
示例16: RetrieveConsoleEvents
void WorkerDebuggerGlobalScope::RetrieveConsoleEvents(
JSContext* aCx, nsTArray<JS::Value>& aEvents, ErrorResult& aRv) {
WorkerGlobalScope* scope = mWorkerPrivate->GetOrCreateGlobalScope(aCx);
if (!scope) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
RefPtr<Console> console = scope->GetConsole(aRv);
if (NS_WARN_IF(aRv.Failed())) {
return;
}
console->RetrieveConsoleEvents(aCx, aEvents, aRv);
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:15,代码来源:WorkerScope.cpp
示例17: supplementName
WorkerGlobalScopeIndexedDatabase* WorkerGlobalScopeIndexedDatabase::from(ScriptExecutionContext* context)
{
WorkerGlobalScopeIndexedDatabase* supplement = static_cast<WorkerGlobalScopeIndexedDatabase*>(Supplement<ScriptExecutionContext>::from(context, supplementName()));
if (!supplement) {
String databaseDirectoryIdentifier;
WorkerGlobalScope* workerGlobalScope = static_cast<WorkerGlobalScope*>(context);
const GroupSettings* groupSettings = workerGlobalScope->groupSettings();
if (groupSettings)
databaseDirectoryIdentifier = groupSettings->indexedDBDatabasePath();
supplement = new WorkerGlobalScopeIndexedDatabase(databaseDirectoryIdentifier);
provideTo(context, supplementName(), adoptPtr(supplement));
}
return supplement;
}
开发者ID:ZeusbaseWeb,项目名称:webkit,代码行数:15,代码来源:WorkerGlobalScopeIndexedDatabase.cpp
示例18: loadResourceSynchronously
void WorkerThreadableLoader::loadResourceSynchronously(WorkerGlobalScope& workerGlobalScope, const ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions)
{
WebWaitableEvent* shutdownEvent =
workerGlobalScope.thread()->shutdownEvent();
OwnPtr<WebWaitableEvent> loaderDone =
adoptPtr(Platform::current()->createWaitableEvent());
Vector<WebWaitableEvent*> events;
events.append(shutdownEvent);
events.append(loaderDone.get());
RefPtr<ThreadableLoaderClientWrapper> clientWrapper(ThreadableLoaderClientWrapper::create(&client));
OwnPtr<WorkerLoaderClientBridgeSyncHelper> clientBridge(WorkerLoaderClientBridgeSyncHelper::create(clientWrapper.get(), loaderDone.release()));
// This must be valid while loader is around.
WorkerLoaderClientBridgeSyncHelper* clientBridgePtr = clientBridge.get();
RefPtr<WorkerThreadableLoader> loader = WorkerThreadableLoader::create(workerGlobalScope, clientWrapper, clientBridge.release(), request, options, resourceLoaderOptions);
WebWaitableEvent* signalled;
{
SafePointScope scope(ThreadState::HeapPointersOnStack);
signalled = Platform::current()->waitMultipleEvents(events);
}
if (signalled == shutdownEvent) {
loader->cancel();
return;
}
clientBridgePtr->run();
}
开发者ID:smishenk,项目名称:chromium-crosswalk,代码行数:31,代码来源:WorkerThreadableLoader.cpp
示例19: MainThreadBridge
WorkerThreadableLoader::WorkerThreadableLoader(WorkerGlobalScope& workerGlobalScope, PassRefPtr<ThreadableLoaderClientWrapper> clientWrapper, PassOwnPtr<ThreadableLoaderClient> clientBridge, const ResourceRequest& request, const ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions)
: m_workerGlobalScope(&workerGlobalScope)
, m_workerClientWrapper(clientWrapper)
, m_bridge(*(new MainThreadBridge(m_workerClientWrapper, clientBridge, workerGlobalScope.thread()->workerLoaderProxy(), request, options, resourceLoaderOptions, workerGlobalScope.referrerPolicy(), workerGlobalScope.url().strippedForUseAsReferrer())))
{
m_workerClientWrapper->setResourceTimingClient(this);
}
开发者ID:smishenk,项目名称:chromium-crosswalk,代码行数:7,代码来源:WorkerThreadableLoader.cpp
示例20: postTask
void WorkerGlobalScope::close()
{
if (m_closing)
return;
// Let current script run to completion but prevent future script evaluations.
// After m_closing is set, all the tasks in the queue continue to be fetched but only
// tasks with isCleanupTask()==true will be executed.
m_closing = true;
postTask({ ScriptExecutionContext::Task::CleanupTask, [] (ScriptExecutionContext& context) {
ASSERT_WITH_SECURITY_IMPLICATION(context.isWorkerGlobalScope());
WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(&context);
// Notify parent that this context is closed. Parent is responsible for calling WorkerThread::stop().
workerGlobalScope->thread().workerReportingProxy().workerGlobalScopeClosed();
} });
}
开发者ID:sinoory,项目名称:webv8,代码行数:16,代码来源:WorkerGlobalScope.cpp
注:本文中的WorkerGlobalScope类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论