当前位置: 首页>>代码示例>>C++>>正文


C++ FunctionCallbackInfo::Callee方法代码示例

本文整理汇总了C++中v8::FunctionCallbackInfo::Callee方法的典型用法代码示例。如果您正苦于以下问题:C++ FunctionCallbackInfo::Callee方法的具体用法?C++ FunctionCallbackInfo::Callee怎么用?C++ FunctionCallbackInfo::Callee使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在v8::FunctionCallbackInfo的用法示例。


在下文中一共展示了FunctionCallbackInfo::Callee方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: NewImage

void ImageWrapper::NewImage( const v8::FunctionCallbackInfo< v8::Value >& args)
{
    v8::Isolate* isolate = args.GetIsolate();
    v8::HandleScope handleScope( isolate);

    if(!args.IsConstructCall())
    {
        DALI_SCRIPT_EXCEPTION( isolate, "Image constructor called without 'new'");
        return;
    }

    // find out the callee function name...e.g. BufferImage, ResourceImage
    v8::Local<v8::Function> callee = args.Callee();
    v8::Local<v8::Value> v8String = callee->GetName();
    std::string typeName = V8Utils::v8StringToStdString( v8String );

    ImageType imageType = GetImageType( typeName );

    if( imageType == UNKNOWN_IMAGE_TYPE )
    {
        DALI_SCRIPT_EXCEPTION( isolate, "unknown image type");
        return;
    }
    Image image = (ImageApiLookup[imageType].constructor)( args );

    if( ! image )
    {
        // a v8 exception will have been thrown by the constructor
        return;
    }

    v8::Local<v8::Object> localObject = WrapImage( isolate, image, imageType );

    args.GetReturnValue().Set( localObject );
}
开发者ID:noyangunday,项目名称:dali,代码行数:35,代码来源:image-wrapper.cpp

示例2: frameWait

void frameWait(const v8::FunctionCallbackInfo<v8::Value>& args) {
	Interface::frameWait();
	
	Local<External> shapeManagerExternal = Local<External>::Cast(args.Callee()->Get(String::NewFromUtf8(Isolate::GetCurrent(), shapeManagerStr.c_str())));
	ShapeManager2d* shapeManager = static_cast<ShapeManager2d*>(shapeManagerExternal->Value());
	
	UDPsocket socket = SDLNet_UDP_Open(0); // socket for writing.
	
	std::stringstream sstream;
	bostream out(sstream);
	out << *shapeManager;
	
	std::string str = sstream.str();
	
	UDPpacket* packet = SDLNet_AllocPacket(str.size());
	
	if(!packet) {
		std::cerr << "SDLNet_AllocPacket: " << SDLNet_GetError() << std::endl;
		// perhaps do something else since you can't make this packet
	} else {
		packet->len = str.size();
		memcpy(packet->data, str.c_str(), str.size());
		SDLNet_ResolveHost(&packet->address, "127.0.0.1", 54321);
		
		SDLNet_UDP_Send(socket, -1, packet);
		
		SDLNet_FreePacket(packet);
	}
	
	SDLNet_UDP_Close(socket);
	
	args.GetReturnValue().Set(Boolean::New(Isolate::GetCurrent(), true));
}
开发者ID:Databean,项目名称:ProgNet,代码行数:33,代码来源:V8Script.cpp

示例3:

void V8PerIsolateData::constructorOfToString(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    // The DOM constructors' toString functions grab the current toString
    // for Functions by taking the toString function of itself and then
    // calling it with the constructor as its receiver. This means that
    // changes to the Function prototype chain or toString function are
    // reflected when printing DOM constructors. The only wart is that
    // changes to a DOM constructor's toString's toString will cause the
    // toString of the DOM constructor itself to change. This is extremely
    // obscure and unlikely to be a problem.
    v8::Handle<v8::Value> value = info.Callee()->Get(v8::String::NewSymbol("toString"));
    if (!value->IsFunction()) {
        v8SetReturnValue(info, v8::String::Empty(info.GetIsolate()));
        return;
    }
    v8SetReturnValue(info, V8ScriptRunner::callInternalFunction(v8::Handle<v8::Function>::Cast(value), info.This(), 0, 0, v8::Isolate::GetCurrent()));
}
开发者ID:chunywang,项目名称:blink-crosswalk,代码行数:17,代码来源:V8PerIsolateData.cpp

示例4: makeLine

void makeLine(const v8::FunctionCallbackInfo<v8::Value>& args) {
	if(args.Length() != 4) {
		args.GetReturnValue().Set(Boolean::New(Isolate::GetCurrent(), false));
		return;
	}
	Local<External> shapeManagerExternal = Local<External>::Cast(args.Callee()->Get(String::NewFromUtf8(Isolate::GetCurrent(), shapeManagerStr.c_str())));
	ShapeManager2d* shapeManager = static_cast<ShapeManager2d*>(shapeManagerExternal->Value());
	
	Point2d p1{args[0]->NumberValue(), args[1]->NumberValue()};
	Point2d p2{args[2]->NumberValue(), args[3]->NumberValue()};
	
	Local<Object> obj = initShape()->NewInstance();
	unsigned int shape = shapeManager->makeLine(p1, p2);
	obj->SetInternalField(0, shapeManagerExternal);
	obj->SetInternalField(1, Integer::NewFromUnsigned(Isolate::GetCurrent(), shape));
	
	args.GetReturnValue().Set(obj);
}
开发者ID:Databean,项目名称:ProgNet,代码行数:18,代码来源:V8Script.cpp

示例5: constructorOfToString

static void constructorOfToString(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    // The DOM constructors' toString functions grab the current toString
    // for Functions by taking the toString function of itself and then
    // calling it with the constructor as its receiver. This means that
    // changes to the Function prototype chain or toString function are
    // reflected when printing DOM constructors. The only wart is that
    // changes to a DOM constructor's toString's toString will cause the
    // toString of the DOM constructor itself to change. This is extremely
    // obscure and unlikely to be a problem.
    v8::Isolate* isolate = info.GetIsolate();
    v8::Local<v8::Value> value;
    if (!info.Callee()->Get(isolate->GetCurrentContext(), v8AtomicString(isolate, "toString")).ToLocal(&value) || !value->IsFunction()) {
        v8SetReturnValue(info, v8::String::Empty(isolate));
        return;
    }
    v8::Local<v8::Value> result;
    if (V8ScriptRunner::callInternalFunction(v8::Local<v8::Function>::Cast(value), info.This(), 0, 0, isolate).ToLocal(&result))
        v8SetReturnValue(info, result);
}
开发者ID:hnney,项目名称:chromium.bb,代码行数:20,代码来源:V8PerIsolateData.cpp


注:本文中的v8::FunctionCallbackInfo::Callee方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。