本文整理汇总了C++中V8BindingPerIsolateData类的典型用法代码示例。如果您正苦于以下问题:C++ V8BindingPerIsolateData类的具体用法?C++ V8BindingPerIsolateData怎么用?C++ V8BindingPerIsolateData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了V8BindingPerIsolateData类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: createRawTemplate
v8::Persistent<v8::FunctionTemplate> V8TestEventConstructor::GetRawTemplate()
{
V8BindingPerIsolateData* data = V8BindingPerIsolateData::current();
V8BindingPerIsolateData::TemplateMap::iterator result = data->rawTemplateMap().find(&info);
if (result != data->rawTemplateMap().end())
return result->second;
v8::HandleScope handleScope;
v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate();
data->rawTemplateMap().add(&info, templ);
return templ;
}
开发者ID:,项目名称:,代码行数:12,代码来源:
示例2: m_workerContext
WorkerScriptController::WorkerScriptController(WorkerContext* workerContext)
: m_workerContext(workerContext)
, m_isolate(v8::Isolate::New())
, m_executionForbidden(false)
, m_executionScheduledToTerminate(false)
{
V8BindingPerIsolateData* data = V8BindingPerIsolateData::create(m_isolate);
data->allStores().append(&m_DOMDataStore);
data->setDOMDataStore(&m_DOMDataStore);
m_isolate->Enter();
m_proxy = adoptPtr(new WorkerContextExecutionProxy(workerContext));
}
开发者ID:xiaolu31,项目名称:webkit-node,代码行数:12,代码来源:WorkerScriptController.cpp
示例3:
v8::Persistent<v8::FunctionTemplate> V8CSSCharsetRule::GetTemplate()
{
V8BindingPerIsolateData* data = V8BindingPerIsolateData::current();
V8BindingPerIsolateData::TemplateMap::iterator result = data->templateMap().find(&info);
if (result != data->templateMap().end())
return result->second;
v8::HandleScope handleScope;
v8::Persistent<v8::FunctionTemplate> templ =
ConfigureV8CSSCharsetRuleTemplate(GetRawTemplate());
data->templateMap().add(&info, templ);
return templ;
}
开发者ID:,项目名称:,代码行数:13,代码来源:
示例4: visitDOMObjects
// Create object groups for DOM tree nodes.
void V8GCController::gcPrologue()
{
v8::HandleScope scope;
#ifndef NDEBUG
DOMObjectVisitor domObjectVisitor;
visitDOMObjects(&domObjectVisitor);
#endif
// Run through all objects with possible pending activity making their
// wrappers non weak if there is pending activity.
GCPrologueVisitor prologueVisitor;
visitActiveDOMObjects(&prologueVisitor);
// Create object groups.
GrouperVisitor grouperVisitor;
visitDOMNodes(&grouperVisitor);
visitDOMObjects(&grouperVisitor);
grouperVisitor.applyGrouping();
// Clean single element cache for string conversions.
V8BindingPerIsolateData* data = V8BindingPerIsolateData::current();
data->stringCache()->clearOnGC();
}
开发者ID:sysrqb,项目名称:chromium-src,代码行数:25,代码来源:V8GCController.cpp
示例5: INC_STATS
v8::Handle<v8::Value> V8HTMLCanvasElement::getContextCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLCanvasElement.context");
v8::Handle<v8::Object> holder = args.Holder();
HTMLCanvasElement* imp = V8HTMLCanvasElement::toNative(holder);
String contextId = toWebCoreString(args[0]);
RefPtr<CanvasContextAttributes> attrs;
#if ENABLE(WEBGL)
if (contextId == "experimental-webgl" || contextId == "webkit-3d") {
attrs = WebGLContextAttributes::create();
WebGLContextAttributes* webGLAttrs = static_cast<WebGLContextAttributes*>(attrs.get());
if (args.Length() > 1 && args[1]->IsObject()) {
v8::Handle<v8::Object> jsAttrs = args[1]->ToObject();
v8::Handle<v8::String> alpha = v8::String::New("alpha");
if (jsAttrs->Has(alpha))
webGLAttrs->setAlpha(jsAttrs->Get(alpha)->BooleanValue());
v8::Handle<v8::String> depth = v8::String::New("depth");
if (jsAttrs->Has(depth))
webGLAttrs->setDepth(jsAttrs->Get(depth)->BooleanValue());
v8::Handle<v8::String> stencil = v8::String::New("stencil");
if (jsAttrs->Has(stencil))
webGLAttrs->setStencil(jsAttrs->Get(stencil)->BooleanValue());
v8::Handle<v8::String> antialias = v8::String::New("antialias");
if (jsAttrs->Has(antialias))
webGLAttrs->setAntialias(jsAttrs->Get(antialias)->BooleanValue());
v8::Handle<v8::String> premultipliedAlpha = v8::String::New("premultipliedAlpha");
if (jsAttrs->Has(premultipliedAlpha))
webGLAttrs->setPremultipliedAlpha(jsAttrs->Get(premultipliedAlpha)->BooleanValue());
v8::Handle<v8::String> preserveDrawingBuffer = v8::String::New("preserveDrawingBuffer");
if (jsAttrs->Has(preserveDrawingBuffer))
webGLAttrs->setPreserveDrawingBuffer(jsAttrs->Get(preserveDrawingBuffer)->BooleanValue());
}
}
#endif
CanvasRenderingContext* result = imp->getContext(contextId, attrs.get());
if (!result)
return v8::Null(args.GetIsolate());
// Both 2D and 3D canvas contexts can hold on to lots of GPU resources, and we
// want to take an opportunity to get rid of them as soon as possible when we
// navigate away from pages using them.
V8BindingPerIsolateData* perIsolateData = V8BindingPerIsolateData::current(args.GetIsolate());
perIsolateData->setShouldCollectGarbageSoon();
if (result->is2d())
return toV8(static_cast<CanvasRenderingContext2D*>(result), args.GetIsolate());
#if ENABLE(WEBGL)
else if (result->is3d()) {
v8::Handle<v8::Value> v8Result = toV8(static_cast<WebGLRenderingContext*>(result), args.GetIsolate());
if (InspectorInstrumentation::hasFrontends()) {
ScriptState* scriptState = ScriptState::forContext(v8::Context::GetCurrent());
ScriptObject glContext(scriptState, v8::Handle<v8::Object>::Cast(v8Result));
ScriptObject wrapped = InspectorInstrumentation::wrapWebGLRenderingContextForInstrumentation(imp->document(), glContext);
if (!wrapped.hasNoValue())
return wrapped.v8Value();
}
return v8Result;
}
#endif
ASSERT_NOT_REACHED();
return v8::Null(args.GetIsolate());
}
开发者ID:,项目名称:,代码行数:62,代码来源:
注:本文中的V8BindingPerIsolateData类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论