void APIBinding::_CreateKList(const ValueList& args, KValueRef result) { args.VerifyException("createKList", "?l"); if (args.size() <= 0) { result->SetList(new StaticBoundList()); } else { KListRef wrapped = args.GetList(0); result->SetList(new KListWrapper(wrapped)); } }
void APIBinding::_InstallDependencies(const ValueList& args, KValueRef result) { args.VerifyException("installDependencies", "l,m"); KListRef dependenciesList = args.GetList(0); KMethodRef callback = args.GetMethod(1, 0); vector<SharedDependency> dependencies; for (unsigned int i = 0; i < dependenciesList->Size(); i++) { if (!dependenciesList->At(i)->IsObject()) { continue; } AutoPtr<DependencyBinding> d = dependenciesList->At(i)->ToObject().cast<DependencyBinding>(); if (!d.isNull()) { dependencies.push_back(d->GetDependency()); } } if (dependencies.size() > 0) { if (!this->installerMutex.tryLock()) { throw ValueException::FromString( "Tried to launch more than one instance of the installer"); } if (this->installerThread) { delete this->installerThread; } this->installerDependencies = dependencies; this->installerCallback = callback; this->installerThread = new Poco::Thread(); this->installerThread->start(*this->installerThreadAdapter); } }