本文整理汇总了C++中xbox::VJSParms_callStaticFunction::GetContext方法的典型用法代码示例。如果您正苦于以下问题:C++ VJSParms_callStaticFunction::GetContext方法的具体用法?C++ VJSParms_callStaticFunction::GetContext怎么用?C++ VJSParms_callStaticFunction::GetContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xbox::VJSParms_callStaticFunction
的用法示例。
在下文中一共展示了VJSParms_callStaticFunction::GetContext方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Address
void VJSNetServerObject::Address(XBOX::VJSParms_callStaticFunction &ioParms, VJSNetServerObject *inServer)
{
xbox_assert(inServer != NULL);
XBOX::VJSObject object(ioParms.GetContext());
object.MakeEmpty();
object.SetProperty("address", inServer->fAddress);
object.SetProperty("port", inServer->fPort);
}
示例2: _terminate
void VJSDedicatedWorkerClass::_terminate (XBOX::VJSParms_callStaticFunction &ioParms, VJSWebWorkerObject *inDedicatedWorker)
{
xbox_assert(inDedicatedWorker != NULL);
VJSWorker *outsideWorker = VJSWorker::RetainWorker(ioParms.GetContext());
VJSWorker *insideWorker = inDedicatedWorker->fOnMessagePort->GetOther(outsideWorker);
insideWorker->Terminate();
XBOX::ReleaseRefCountable<VJSWorker>(&outsideWorker);
}
示例3: PostMessageMethod
void VJSMessagePort::PostMessageMethod (XBOX::VJSParms_callStaticFunction &ioParms, VJSMessagePort *inMessagePort)
{
xbox_assert(inMessagePort != NULL);
if (ioParms.CountParams() < 1) {
XBOX::vThrowError(XBOX::VE_INVALID_PARAMETER);
return;
}
VJSWorker *worker = VJSWorker::RetainWorker(ioParms.GetContext());
XBOX::VJSValue value = ioParms.GetParamValue(1);
VJSStructuredClone *message = VJSStructuredClone::RetainClone(value);
inMessagePort->PostMessage(inMessagePort->GetOther(worker), message);
XBOX::ReleaseRefCountable<VJSStructuredClone>(&message);
XBOX::ReleaseRefCountable<VJSWorker>(&worker);
}
示例4: _terminate
void VJSDedicatedWorkerClass::_terminate (XBOX::VJSParms_callStaticFunction &ioParms, VJSWebWorkerObject *inDedicatedWorker)
{
xbox_assert(inDedicatedWorker != NULL);
VJSWorker *outsideWorker = VJSWorker::RetainWorker(ioParms.GetContext());
VJSWorker *insideWorker = inDedicatedWorker->fOnMessagePort->GetOther(outsideWorker);
//**
// ACI0081079:
//
// Defensive programming, check pointer is not NULL. Pending definitive fix (and architecture overall in WAK5).
// insideWorker should never be NULL !
if (insideWorker != NULL)
insideWorker->Terminate();
//**
XBOX::ReleaseRefCountable<VJSWorker>(&outsideWorker);
}
示例5: _accept
void VJSNetServerSyncClass::_accept (XBOX::VJSParms_callStaticFunction &ioParms, VJSNetServerObject *inServer)
{
xbox_assert(inServer != NULL);
sLONG timeOut;
if (ioParms.CountParams() >= 1) {
if (!ioParms.IsNumberParam(1) || !ioParms.GetLongParam(1, &timeOut)) {
XBOX::vThrowError(XBOX::VE_JVSC_WRONG_PARAMETER_TYPE_NUMBER, "1");
return;
}
if (timeOut < 0) {
XBOX::vThrowError(XBOX::VE_JVSC_WRONG_PARAMETER_TYPE_NUMBER, "1");
return;
}
} else
timeOut = 0;
XBOX::XTCPSock *socket;
// If socket returned is NULL, accept() has timed out or an error has occured.
// An exception is thrown by GetNewConnectedSocket() if erroneous.
if ((socket = inServer->fSockListener->GetNewConnectedSocket(timeOut)) == NULL)
ioParms.ReturnNullValue();
else {
XBOX::VTCPEndPoint *endPoint = NULL;
VJSNetSocketObject *socketObject = NULL;
if ((endPoint = new XBOX::VTCPEndPoint(socket)) == NULL
|| (socketObject = new VJSNetSocketObject(true, VJSNetSocketObject::eTYPE_TCP4, false)) == NULL) {
if (endPoint != NULL)
endPoint->Release();
if (socketObject != NULL)
socketObject->Release();
socket->Close();
delete socket;
XBOX::vThrowError(XBOX::VE_MEMORY_FULL);
} else {
socketObject->fEndPoint = endPoint;
socketObject->fEndPoint->SetNoDelay(false);
XBOX::VJSObject newSocketSync = VJSNetSocketSyncClass::CreateInstance(ioParms.GetContext(), socketObject);
XBOX::VString address;
socketObject->fObjectRef = newSocketSync.GetObjectRef();
socketObject->fWorker = VJSWorker::RetainWorker(ioParms.GetContext());
socketObject->fEndPoint->GetIP(address);
newSocketSync.SetProperty("remoteAddress", address);
newSocketSync.SetProperty("remotePort", (sLONG) socketObject->fEndPoint->GetPort() & 0xffff);
ioParms.ReturnValue(newSocketSync);
}
}
}
示例6: _listen
void VJSNetServerClass::_listen (XBOX::VJSParms_callStaticFunction &ioParms, VJSNetServerObject *inServer)
{
xbox_assert(inServer != NULL);
XBOX::VString address;
sLONG port;
if (!ioParms.CountParams()) {
XBOX::vThrowError(XBOX::VE_JVSC_EXPECTING_PARAMETER, "net.Server.listen()");
return;
}
if (!ioParms.IsNumberParam(1) || !ioParms.GetLongParam(1, &port)) {
XBOX::vThrowError(XBOX::VE_JVSC_WRONG_PARAMETER_TYPE_NUMBER, "1");
return;
}
XBOX::VString hostname;
XBOX::VJSObject callback(ioParms.GetContext());
bool hasCallback;
hostname = "";
hasCallback = false;
if (ioParms.CountParams() >= 2) {
if (ioParms.IsStringParam(2)) {
if (!ioParms.GetStringParam(2, hostname)) {
XBOX::vThrowError(XBOX::VE_JVSC_WRONG_PARAMETER_TYPE_STRING, "2");
return;
}
} else if (ioParms.IsObjectParam(2) && ioParms.GetParamFunc(2, callback)) {
hasCallback = true;
} else {
XBOX::vThrowError(XBOX::VE_JVSC_WRONG_PARAMETER_TYPE_FUNCTION, "2");
return;
}
}
if (ioParms.CountParams() == 3 ) {
if ((hasCallback || !ioParms.IsObjectParam(3) || !ioParms.GetParamFunc(3, callback))) {
XBOX::vThrowError(XBOX::VE_JVSC_WRONG_PARAMETER_TYPE_FUNCTION, "3");
return;
} else
hasCallback = true;
}
// We are already listening, stop previous listener.
if (inServer->fConnectionListener != NULL)
inServer->Close();
// Set up listener.
if ((inServer->fConnectionListener = new XBOX::VTCPConnectionListener())== NULL) {
XBOX::vThrowError(XBOX::VE_MEMORY_FULL);
return;
}
if (inServer->fIsSSL)
inServer->fConnectionListener->SetSSLKeyAndCertificate(inServer->fCertificate, inServer->fKey);
VJSNetSocketObject::sMutex.Lock();
if (VJSNetSocketObject::sSelectIOPool == NULL)
VJSNetSocketObject::sSelectIOPool = new XBOX::VTCPSelectIOPool();
VJSNetSocketObject::sMutex.Unlock();
inServer->fConnectionListener->AddSelectIOPool(VJSNetSocketObject::sSelectIOPool);
VJSWorker *worker;
worker = VJSWorker::RetainWorker(ioParms.GetContext());
VJSConnectionHandlerFactory *connectionHandlerFactory;
if ((connectionHandlerFactory = new VJSConnectionHandlerFactory(worker, inServer, inServer->fIsSSL)) == NULL) {
//.........这里部分代码省略.........