本文整理汇总了C++中nan::EscapableHandleScope类的典型用法代码示例。如果您正苦于以下问题:C++ EscapableHandleScope类的具体用法?C++ EscapableHandleScope怎么用?C++ EscapableHandleScope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EscapableHandleScope类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DILexicalBlock
v8::Local<v8::Value> DILexicalBlock::Create(llvm::DILexicalBlock* llvm_dilexicalblock) {
Nan::EscapableHandleScope scope;
Local<Object> new_instance = Nan::NewInstance(Nan::New(DILexicalBlock::constructor_func)).ToLocalChecked();
DILexicalBlock* new_dilexicalblock = new DILexicalBlock(llvm_dilexicalblock);
new_dilexicalblock->Wrap(new_instance);
return scope.Escape(new_instance);
}
示例2: DebugLoc
v8::Local<v8::Value> DebugLoc::Create(llvm::DebugLoc llvm_debugloc) {
Nan::EscapableHandleScope scope;
Local<Object> new_instance = Nan::NewInstance(Nan::New(DebugLoc::constructor_func)).ToLocalChecked();
DebugLoc* new_debugloc = new DebugLoc(llvm_debugloc);
new_debugloc->Wrap(new_instance);
return scope.Escape(new_instance);
}
示例3: DIFile
v8::Local<v8::Value> DIFile::Create(llvm::DIFile* llvm_difile) {
Nan::EscapableHandleScope scope;
Local<Object> new_instance = Nan::NewInstance(Nan::New(DIFile::constructor_func)).ToLocalChecked();
DIFile* new_difile = new DIFile(llvm_difile);
new_difile->Wrap(new_instance);
return scope.Escape(new_instance);
}
示例4: DICompileUnit
v8::Local<v8::Value> DICompileUnit::Create(llvm::DICompileUnit* llvm_dicompileunit) {
Nan::EscapableHandleScope scope;
Local<Object> new_instance = Nan::NewInstance(Nan::New(DICompileUnit::constructor_func)).ToLocalChecked();
DICompileUnit* new_dicompileunit = new DICompileUnit(llvm_dicompileunit);
new_dicompileunit->Wrap(new_instance);
return scope.Escape(new_instance);
}
示例5: DISubprogram
v8::Local<v8::Value> DISubprogram::Create(llvm::DISubprogram* llvm_disubprogram) {
Nan::EscapableHandleScope scope;
Local<Object> new_instance = Nan::NewInstance(Nan::New(DISubprogram::constructor_func)).ToLocalChecked();
DISubprogram* new_disubprogram = new DISubprogram(llvm_disubprogram);
new_disubprogram->Wrap(new_instance);
return scope.Escape(new_instance);
}
示例6: MSOutputFormat
v8::Local<v8::Value> MSOutputFormat::NewInstance(outputFormatObj *of_ptr) {
Nan::EscapableHandleScope scope;
MSOutputFormat* of = new MSOutputFormat();
of->this_ = of_ptr;
v8::Local<v8::Value> ext = Nan::New<v8::External>(of);
return scope.Escape(Nan::New(constructor)->GetFunction()->NewInstance(1, &ext));
}
示例7:
v8::Local<v8::Value> Grid::_clearSync(Nan::NAN_METHOD_ARGS_TYPE info)
{
Nan::EscapableHandleScope scope;
Grid* g = Nan::ObjectWrap::Unwrap<Grid>(info.Holder());
g->get()->clear();
return scope.Escape(Nan::Undefined());
}
示例8: MSLayers
v8::Local<v8::Value> MSLayers::NewInstance(mapObj *ptr) {
Nan::EscapableHandleScope scope;
MSLayers* obj = new MSLayers();
obj->this_ = ptr;
v8::Local<v8::Value> ext = Nan::New<v8::External>(obj);
return scope.Escape(Nan::New(constructor)->GetFunction()->NewInstance(1, &ext));
}
示例9: getRequireCache
// Unfortunately native modules don't get a reference
// to require.cache as this happens in Module._compile()
// and native modules aren't compiled, they are loaded
// directly by NativeModule.require() (in Module._load())
// So we need to get it from Module._cache instead (by
// executing require('module')._cache)
static Local<Object> getRequireCache(Handle<Object> module) {
Nan::EscapableHandleScope scope;
Handle<Value> args[] = { Nan::New<String>("module").ToLocalChecked() };
Local<Value> m = module->Get(Nan::New<String>("require").ToLocalChecked())->ToObject()->CallAsFunction(Nan::GetCurrentContext()->Global(), 1, args);
Local<Object> cache = m->ToObject()->Get(Nan::New<String>("_cache").ToLocalChecked())->ToObject();
return scope.Escape(cache);
}
示例10: MemoryDatasource
v8::Local<v8::Value> MemoryDatasource::NewInstance(mapnik::datasource_ptr ds_ptr) {
Nan::EscapableHandleScope scope;
MemoryDatasource* d = new MemoryDatasource();
d->datasource_ = ds_ptr;
v8::Local<v8::Value> ext = Nan::New<v8::External>(d);
return scope.Escape( Nan::New(constructor)->GetFunction()->NewInstance(1, &ext));
}
示例11: wkbFlatten
Local<Value> Geometry::getConstructor(OGRwkbGeometryType type) {
Nan::EscapableHandleScope scope;
type = wkbFlatten(type);
switch (type) {
case wkbPoint:
return scope.Escape(Nan::New(Point::constructor)->GetFunction());
case wkbLineString:
return scope.Escape(Nan::New(LineString::constructor)->GetFunction());
case wkbLinearRing:
return scope.Escape(Nan::New(LinearRing::constructor)->GetFunction());
case wkbPolygon:
return scope.Escape(Nan::New(Polygon::constructor)->GetFunction());
case wkbGeometryCollection:
return scope.Escape(Nan::New(GeometryCollection::constructor)->GetFunction());
case wkbMultiPoint:
return scope.Escape(Nan::New(MultiPoint::constructor)->GetFunction());
case wkbMultiLineString:
return scope.Escape(Nan::New(MultiLineString::constructor)->GetFunction());
case wkbMultiPolygon:
return scope.Escape(Nan::New(MultiPolygon::constructor)->GetFunction());
default:
return scope.Escape(Nan::Null());
}
}
示例12: Color
v8::Local<v8::Value> Color::NewInstance(mapnik::color const& color) {
Nan::EscapableHandleScope scope;
Color* c = new Color();
c->this_ = std::make_shared<mapnik::color>(color);
v8::Local<v8::Value> ext = Nan::New<v8::External>(c);
return scope.Escape(Nan::New(constructor)->GetFunction()->NewInstance(1, &ext));
}
示例13: Feature
v8::Local<v8::Value> Feature::NewInstance(mapnik::feature_ptr f_ptr)
{
Nan::EscapableHandleScope scope;
Feature* f = new Feature(f_ptr);
v8::Local<v8::Value> ext = Nan::New<v8::External>(f);
return scope.Escape(Nan::New(constructor)->GetFunction()->NewInstance(1, &ext));
}
示例14: operator
v8::Local<v8::Object> operator()(const point<T>& point) {
Nan::EscapableHandleScope scope;
v8::Local<v8::Array> result = Nan::New<v8::Array>(2);
Nan::Set(result, 0, Nan::New(point.x));
Nan::Set(result, 1, Nan::New(point.y));
return scope.Escape(result);
}
示例15: MultiPolygon
Local<Value> MultiPolygon::New(OGRMultiPolygon *geom, bool owned)
{
Nan::EscapableHandleScope scope;
if (!geom) {
return scope.Escape(Nan::Null());
}
//make a copy of geometry owned by a feature
// + no need to track when a feature is destroyed
// + no need to throw errors when a method trys to modify an owned read-only geometry
// - is slower
if (!owned) {
geom = static_cast<OGRMultiPolygon*>(geom->clone());
};
MultiPolygon *wrapped = new MultiPolygon(geom);
wrapped->owned_ = true;
UPDATE_AMOUNT_OF_GEOMETRY_MEMORY(wrapped);
Local<Value> ext = Nan::New<External>(wrapped);
Local<Object> obj = Nan::New(MultiPolygon::constructor)->GetFunction()->NewInstance(1, &ext);
return scope.Escape(obj);
}