本文整理汇总了C++中v8::Handle::GetPrototype方法的典型用法代码示例。如果您正苦于以下问题:C++ Handle::GetPrototype方法的具体用法?C++ Handle::GetPrototype怎么用?C++ Handle::GetPrototype使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类v8::Handle
的用法示例。
在下文中一共展示了Handle::GetPrototype方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: v8ToMongo
BSONObj v8ToMongo( v8::Handle<v8::Object> o ){
BSONObjBuilder b;
v8::Handle<v8::String> idName = String::New( "_id" );
if ( o->HasRealNamedProperty( idName ) ){
v8ToMongoElement( b , idName , "_id" , o->Get( idName ) );
}
Local<v8::Array> names = o->GetPropertyNames();
for ( unsigned int i=0; i<names->Length(); i++ ){
v8::Local<v8::String> name = names->Get(v8::Integer::New(i) )->ToString();
if ( o->GetPrototype()->IsObject() &&
o->GetPrototype()->ToObject()->HasRealNamedProperty( name ) )
continue;
v8::Local<v8::Value> value = o->Get( name );
const string sname = toSTLString( name );
if ( sname == "_id" )
continue;
v8ToMongoElement( b , name , sname , value );
}
return b.obj();
}
示例2: copyElements
bool copyElements(v8::Handle<v8::Object> destArray, v8::Handle<v8::Object> srcArray, uint32_t length, uint32_t offset, v8::Isolate* isolate)
{
v8::Handle<v8::Value> prototype_value = destArray->GetPrototype();
if (prototype_value.IsEmpty() || !prototype_value->IsObject())
return false;
v8::Handle<v8::Object> prototype = prototype_value.As<v8::Object>();
v8::Handle<v8::Value> value = getHiddenCopyMethod(prototype);
if (value.IsEmpty())
value = installHiddenCopyMethod(prototype);
if (value.IsEmpty() || !value->IsFunction())
return false;
v8::Handle<v8::Function> copy_method = value.As<v8::Function>();
v8::Handle<v8::Value> arguments[3];
arguments[0] = srcArray;
arguments[1] = v8::Uint32::New(length);
arguments[2] = v8::Uint32::New(offset);
copy_method->Call(destArray, 3, arguments);
return true;
}
示例3: copyElements
bool copyElements(v8::Handle<v8::Object> destArray, v8::Handle<v8::Object> srcArray, uint32_t length, uint32_t offset, v8::Isolate* isolate)
{
v8::Handle<v8::Value> prototype_value = destArray->GetPrototype();
if (prototype_value.IsEmpty() || !prototype_value->IsObject())
return false;
v8::Handle<v8::Object> prototype = prototype_value.As<v8::Object>();
v8::Handle<v8::Value> value = prototype->GetHiddenValue(V8HiddenPropertyName::typedArrayHiddenCopyMethod());
if (value.IsEmpty()) {
String source(reinterpret_cast<const char*>(V8ArrayBufferViewCustomScript_js), sizeof(V8ArrayBufferViewCustomScript_js));
value = V8ScriptRunner::compileAndRunInternalScript(v8String(source, isolate), isolate);
prototype->SetHiddenValue(V8HiddenPropertyName::typedArrayHiddenCopyMethod(), value);
}
if (value.IsEmpty() || !value->IsFunction())
return false;
v8::Handle<v8::Function> copy_method = value.As<v8::Function>();
v8::Handle<v8::Value> arguments[3] = { srcArray, v8::Uint32::New(length), v8::Uint32::New(offset) };
V8ScriptRunner::callInternalFunction(copy_method, destArray, WTF_ARRAY_LENGTH(arguments), arguments, isolate);
return true;
}
示例4: checkDocumentWrapper
static void checkDocumentWrapper(v8::Handle<v8::Object> wrapper, Document* document)
{
ASSERT(V8Document::toNative(wrapper) == document);
ASSERT(!document->isHTMLDocument() || (V8Document::toNative(v8::Handle<v8::Object>::Cast(wrapper->GetPrototype())) == document));
}