本文整理汇总了C++中WorkerContext类的典型用法代码示例。如果您正苦于以下问题:C++ WorkerContext类的具体用法?C++ WorkerContext怎么用?C++ WorkerContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WorkerContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: closeCallback
static v8::Handle<v8::Value> closeCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WorkerContext.close");
WorkerContext* imp = V8WorkerContext::toNative(args.Holder());
imp->close();
return v8::Handle<v8::Value>();
}
开发者ID:Treeeater,项目名称:chrome_bindings,代码行数:7,代码来源:V8WorkerContext.cpp
示例2: openDatabaseSyncCallback
static v8::Handle<v8::Value> openDatabaseSyncCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WorkerContext.openDatabaseSync");
if (args.Length() < 4)
return throwError("Not enough arguments", V8Proxy::SyntaxError);
WorkerContext* imp = V8WorkerContext::toNative(args.Holder());
ExceptionCode ec = 0;
{
STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, name, args[0]);
STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, version, args[1]);
STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, displayName, args[2]);
EXCEPTION_BLOCK(unsigned, estimatedSize, toUInt32(args[3]));
RefPtr<DatabaseCallback> creationCallback;
if (args.Length() > 4 && !args[4]->IsNull() && !args[4]->IsUndefined()) {
if (!args[4]->IsObject())
return throwError(TYPE_MISMATCH_ERR);
creationCallback = V8DatabaseCallback::create(args[4], getScriptExecutionContext());
}
RefPtr<DatabaseSync> result = imp->openDatabaseSync(name, version, displayName, estimatedSize, creationCallback, ec);
if (UNLIKELY(ec))
goto fail;
return toV8(result.release());
}
fail:
V8Proxy::setDOMException(ec);
return v8::Handle<v8::Value>();
}
开发者ID:Treeeater,项目名称:chrome_bindings,代码行数:27,代码来源:V8WorkerContext.cpp
示例3: setJSWorkerContextOnmessage
void setJSWorkerContextOnmessage(ExecState* exec, JSObject* thisObject, JSValue value)
{
UNUSED_PARAM(exec);
WorkerContext* imp = static_cast<WorkerContext*>(static_cast<JSWorkerContext*>(thisObject)->impl());
JSDOMGlobalObject* globalObject = static_cast<JSWorkerContext*>(thisObject);
imp->setOnmessage(globalObject->createJSAttributeEventListener(value));
}
开发者ID:,项目名称:,代码行数:7,代码来源:
示例4: ASSERT
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
示例5: ASSERT
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
示例6: performTask
virtual void performTask(ScriptExecutionContext *context)
{
ASSERT(context->isWorkerContext());
WorkerContext* workerContext = static_cast<WorkerContext*>(context);
#if ENABLE(DATABASE)
// We currently ignore any DatabasePolicy used for the document's
// databases; if it's actually used anywhere, this should be revisited.
DatabaseTaskSynchronizer cleanupSync;
workerContext->stopDatabases(&cleanupSync);
#endif
workerContext->stopActiveDOMObjects();
// Event listeners would keep DOMWrapperWorld objects alive for too long. Also, they have references to JS objects,
// which become dangling once Heap is destroyed.
workerContext->removeAllEventListeners();
#if ENABLE(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.
workerContext->postTask(WorkerThreadShutdownFinishTask::create());
}
开发者ID:azrul2202,项目名称:WebKit-Smartphone,代码行数:28,代码来源:WorkerThread.cpp
示例7: INC_STATS
v8::Handle<v8::Value> V8WorkerContext::importScriptsCallback(const v8::Arguments& args)
{
INC_STATS(L"DOM.WorkerContext.importScripts()");
if (!args.Length())
return v8::Undefined();
Vector<String> urls;
for (int i = 0; i < args.Length(); i++) {
v8::TryCatch tryCatch;
v8::Handle<v8::String> scriptUrl = args[i]->ToString();
if (tryCatch.HasCaught() || scriptUrl.IsEmpty())
return v8::Undefined();
urls.append(toWebCoreString(scriptUrl));
}
WorkerContext* workerContext = V8WorkerContext::toNative(args.Holder());
ExceptionCode ec = 0;
workerContext->importScripts(urls, ec);
if (ec)
return throwError(ec);
return v8::Undefined();
}
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:25,代码来源:V8WorkerContextCustom.cpp
示例8: INC_STATS
v8::Handle<v8::Value> V8WorkerContext::importScriptsCallback(const v8::Arguments& args)
{
INC_STATS(L"DOM.WorkerContext.importScripts()");
if (!args.Length())
return v8::Undefined();
String callerURL;
if (!V8Proxy::sourceName(callerURL))
return v8::Undefined();
int callerLine;
if (!V8Proxy::sourceLineNumber(callerLine))
return v8::Undefined();
callerLine += 1;
Vector<String> urls;
for (int i = 0; i < args.Length(); i++) {
v8::TryCatch tryCatch;
v8::Handle<v8::String> scriptUrl = args[i]->ToString();
if (tryCatch.HasCaught() || scriptUrl.IsEmpty())
return v8::Undefined();
urls.append(toWebCoreString(scriptUrl));
}
WorkerContext* workerContext = V8DOMWrapper::convertDOMWrapperToNative<WorkerContext>(args.Holder());
ExceptionCode ec = 0;
workerContext->importScripts(urls, callerURL, callerLine, ec);
if (ec)
return throwError(ec);
return v8::Undefined();
}
开发者ID:flying-dutchmen,项目名称:3DS_w3Browser,代码行数:33,代码来源:V8WorkerContextCustom.cpp
示例9: SetTimeoutOrInterval
v8::Handle<v8::Value> SetTimeoutOrInterval(const v8::Arguments& args, bool singleShot)
{
WorkerContext* workerContext = V8DOMWrapper::convertDOMWrapperToNative<WorkerContext>(args.Holder());
int argumentCount = args.Length();
if (argumentCount < 1)
return v8::Undefined();
v8::Handle<v8::Value> function = args[0];
int32_t timeout = argumentCount >= 2 ? args[1]->Int32Value() : 0;
int timerId;
v8::Handle<v8::Context> v8Context = workerContext->script()->proxy()->context();
if (function->IsString()) {
WebCore::String stringFunction = toWebCoreString(function);
timerId = DOMTimer::install(workerContext, new ScheduledAction(v8Context, stringFunction, workerContext->url()), timeout, singleShot);
} else if (function->IsFunction()) {
size_t paramCount = argumentCount >= 2 ? argumentCount - 2 : 0;
v8::Local<v8::Value>* params = 0;
if (paramCount > 0) {
params = new v8::Local<v8::Value>[paramCount];
for (size_t i = 0; i < paramCount; ++i)
params[i] = args[i+2];
}
// ScheduledAction takes ownership of actual params and releases them in its destructor.
ScheduledAction* action = new ScheduledAction(v8Context, v8::Handle<v8::Function>::Cast(function), paramCount, params);
delete [] params;
timerId = DOMTimer::install(workerContext, action, timeout, singleShot);
} else
return v8::Undefined();
return v8::Integer::New(timerId);
}
开发者ID:flying-dutchmen,项目名称:3DS_w3Browser,代码行数:33,代码来源:V8WorkerContextCustom.cpp
示例10: 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,代码来源:
示例11: performTask
virtual void performTask(ScriptExecutionContext *context)
{
ASSERT(context->isWorkerContext());
WorkerContext* workerContext = static_cast<WorkerContext*>(context);
#if ENABLE(SQL_DATABASE)
// FIXME: Should we stop the databases as part of stopActiveDOMObjects() below?
DatabaseTaskSynchronizer cleanupSync;
DatabaseManager::manager().stopDatabases(workerContext, &cleanupSync);
#endif
workerContext->stopActiveDOMObjects();
workerContext->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.
workerContext->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.
workerContext->postTask(WorkerThreadShutdownFinishTask::create());
}
开发者ID:jiezh,项目名称:h5vcc,代码行数:29,代码来源:WorkerThread.cpp
示例12: clearIntervalCallback
static v8::Handle<v8::Value> clearIntervalCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WorkerContext.clearInterval");
WorkerContext* imp = V8WorkerContext::toNative(args.Holder());
EXCEPTION_BLOCK(int, handle, toInt32(args[0]));
imp->clearInterval(handle);
return v8::Handle<v8::Value>();
}
开发者ID:Treeeater,项目名称:chrome_bindings,代码行数:8,代码来源:V8WorkerContext.cpp
示例13: onerrorAttrSetter
static void onerrorAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
INC_STATS("DOM.WorkerContext.onerror._set");
WorkerContext* imp = V8WorkerContext::toNative(info.Holder());
transferHiddenDependency(info.Holder(), imp->onerror(), value, V8WorkerContext::eventListenerCacheIndex);
imp->setOnerror(V8EventListenerList::findOrCreateWrapper<V8WorkerContextErrorHandler>(value, true));
return;
}
开发者ID:Treeeater,项目名称:chrome_bindings,代码行数:8,代码来源:V8WorkerContext.cpp
示例14: performTask
virtual void performTask(ScriptExecutionContext* scriptContext)
{
RefPtr<MessagePort> port = MessagePort::create(*scriptContext);
port->entangle(m_channel.release());
ASSERT(scriptContext->isWorkerContext());
WorkerContext* workerContext = static_cast<WorkerContext*>(scriptContext);
ASSERT(workerContext->isSharedWorkerContext());
workerContext->toSharedWorkerContext()->dispatchConnect(port);
}
开发者ID:halfkiss,项目名称:ComponentSuperAccessor,代码行数:9,代码来源:DefaultSharedWorkerRepository.cpp
示例15: while
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
示例16: ASSERT
void WebSharedWorkerImpl::connectTask(ScriptExecutionContext* context, PassOwnPtr<MessagePortChannel> channel)
{
// Wrap the passed-in channel in a MessagePort, and send it off via a connect event.
RefPtr<MessagePort> port = MessagePort::create(*context);
port->entangle(channel);
ASSERT(context->isWorkerContext());
WorkerContext* workerContext = static_cast<WorkerContext*>(context);
ASSERT(workerContext->isSharedWorkerContext());
workerContext->dispatchEvent(createConnectEvent(port));
}
开发者ID:,项目名称:,代码行数:10,代码来源:
示例17: jsWorkerContextOnmessage
JSValue jsWorkerContextOnmessage(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
UNUSED_PARAM(exec);
WorkerContext* imp = static_cast<WorkerContext*>(static_cast<JSWorkerContext*>(asObject(slot.slotBase()))->impl());
if (EventListener* listener = imp->onmessage()) {
if (JSObject* jsFunction = listener->jsFunction())
return jsFunction;
}
return jsNull();
}
开发者ID:,项目名称:,代码行数:10,代码来源:
示例18: performTask
virtual void performTask(ScriptExecutionContext* scriptContext)
{
RefPtr<MessagePort> port = MessagePort::create(*scriptContext);
port->entangle(m_channel.release());
ASSERT(scriptContext->isWorkerContext());
WorkerContext* workerContext = static_cast<WorkerContext*>(scriptContext);
// Since close() stops the thread event loop, this should not ever get called while closing.
ASSERT(!workerContext->isClosing());
ASSERT(workerContext->isSharedWorkerContext());
workerContext->toSharedWorkerContext()->dispatchEvent(createConnectEvent(port));
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:11,代码来源:DefaultSharedWorkerRepository.cpp
示例19: ENABLE
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
示例20: jsWorkerContextPrototypeFunctionClearInterval
JSValue JSC_HOST_CALL jsWorkerContextPrototypeFunctionClearInterval(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.isObject(&JSWorkerContext::s_info))
return throwError(exec, TypeError);
JSWorkerContext* castedThisObj = static_cast<JSWorkerContext*>(asObject(thisValue));
WorkerContext* imp = static_cast<WorkerContext*>(castedThisObj->impl());
int handle = args.at(0).toInt32(exec);
imp->clearInterval(handle);
return jsUndefined();
}
开发者ID:,项目名称:,代码行数:12,代码来源:
注:本文中的WorkerContext类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论