void loadFragments(Wt::WTreeTable *markerTree, bool mini, zmq::socket_t *socket) { //needs markerTree #ifdef PLOT waveformTimer->start(); #endif bool disconnect = false; if (socket == 0) { socket = zmq_conn::connect(); disconnect = true; } Wt::Json::Object response; response = zmq_conn::interact("title?",socket); Wt::WString trackname = response.get("title"); MyTreeTableNode *root = new MyTreeTableNode(trackname); markerTree->setTreeRoot(root,trackname); MyTreeTableNode *current_root = root; response = zmq_conn::interact("fragments?",socket); Wt::Json::Array fragments; fragments = response.get("fragments"); loadGroup(current_root,fragments, mini); root->expand(); if (disconnect) { zmq_conn::disconnect(socket); } }
inline void PBFParser::ParseData() { while (true) { _ThreadData *threadData; threadDataQueue->wait_and_pop(threadData); if( NULL==threadData ) { SimpleLogger().Write() << "Parse Data Thread Finished"; threadDataQueue->push(NULL); // Signal end of data for other threads break; } loadBlock(threadData); for(int i = 0, groupSize = threadData->PBFprimitiveBlock.primitivegroup_size(); i < groupSize; ++i) { threadData->currentGroupID = i; loadGroup(threadData); if(threadData->entityTypeIndicator == TypeNode) { parseNode(threadData); } if(threadData->entityTypeIndicator == TypeWay) { parseWay(threadData); } if(threadData->entityTypeIndicator == TypeRelation) { parseRelation(threadData); } if(threadData->entityTypeIndicator == TypeDenseNode) { parseDenseNode(threadData); } } delete threadData; threadData = NULL; } }
void loadGroup(MyTreeTableNode *current_root, Wt::Json::Array fragments, bool mini) { //Recursively add the fragments to the treetable //does not need object at all //this->log("info") <<"Loading fragments"; for(auto fragmentValue:fragments) { const Wt::Json::Array& fragment = fragmentValue; std::string type = fragment[0]; Wt::WString name = fragment[1]; //this->log("debug") <<"Loading fragment "<<name<<" of type "<<type; if (type == "group") { loadGroup( MyTreeTableNode::addNode(current_root,name,-1,-1, mini) ,fragment[2], mini); } else if (type == "fragment") { long long start_time = fragment[2]; long long stop_time = fragment[3]; MyTreeTableNode::addNode(current_root,name,start_time,stop_time, mini); } else { //this->log("warn")<<"Node type not understood"; } } }
bool loadScriptStates(const char *filename) { WzConfig ini(filename); QStringList list = ini.childGroups(); debug(LOG_SAVE, "Loading script states for %d script contexts", scripts.size()); for (int i = 0; i < list.size(); ++i) { ini.beginGroup(list[i]); int player = ini.value("me").toInt(); QString scriptName = ini.value("scriptName").toString(); QScriptEngine *engine = findEngineForPlayer(player, scriptName); if (engine && list[i].startsWith("triggers_")) { timerNode node; node.player = player; node.ms = ini.value("ms").toInt(); node.frameTime = ini.value("frame").toInt(); node.engine = engine; debug(LOG_SAVE, "Registering trigger %d for player %d, script %s", i, node.player, scriptName.toUtf8().constData()); node.function = ini.value("function").toString(); node.baseobj = ini.value("baseobj", -1).toInt(); node.type = (timerType)ini.value("type", TIMER_REPEAT).toInt(); timers.push_back(node); } else if (engine && list[i].startsWith("globals_")) { QStringList keys = ini.childKeys(); debug(LOG_SAVE, "Loading script globals for player %d, script %s -- found %d values", player, scriptName.toUtf8().constData(), keys.size()); for (int j = 0; j < keys.size(); ++j) { engine->globalObject().setProperty(keys.at(j), engine->toScriptValue(ini.value(keys.at(j)))); } } else if (engine && list[i].startsWith("groups_")) { QStringList keys = ini.childKeys(); for (int j = 0; j < keys.size(); ++j) { QStringList values = ini.value(keys.at(j)).toStringList(); bool ok = false; // check if number int droidId = keys.at(j).toInt(&ok); for (int k = 0; ok && k < values.size(); k++) { int groupId = values.at(k).toInt(); loadGroup(engine, groupId, droidId); } } } ini.endGroup(); } return true; }
inline void PBFParser::ParseData() { tbb::task_scheduler_init init(num_parser_threads); while (true) { ParserThreadData *thread_data; thread_data_queue->wait_and_pop(thread_data); if (nullptr == thread_data) { thread_data_queue->push(nullptr); // Signal end of data for other threads break; } loadBlock(thread_data); int group_size = thread_data->PBFprimitiveBlock.primitivegroup_size(); for (int i = 0; i < group_size; ++i) { thread_data->currentGroupID = i; loadGroup(thread_data); if (thread_data->entityTypeIndicator == TypeNode) { parseNode(thread_data); } if (thread_data->entityTypeIndicator == TypeWay) { parseWay(thread_data); } if (thread_data->entityTypeIndicator == TypeRelation) { parseRelation(thread_data); } if (thread_data->entityTypeIndicator == TypeDenseNode) { parseDenseNode(thread_data); } } delete thread_data; thread_data = nullptr; } }
void GxsGroupDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req) { std::cerr << "GxsGroupDialog::loadRequest() UserType: " << req.mUserType; std::cerr << std::endl; if (queue == mInternalTokenQueue) { /* now switch on req */ switch(req.mUserType) { case GXSGROUP_INTERNAL_LOADGROUP: loadGroup(req.mToken); break; default: std::cerr << "GxsGroupDialog::loadGroup() UNKNOWN UserType "; std::cerr << std::endl; break; } } }
void ActionListViewItem::loadGroup( ananasListViewItem * parent, aCfgItem child ) { ActionListViewItem * gparent; QString oclass; aCfgItem cobj; gparent = new ActionListViewItem( parent, getLastChild(), md, child, QString::null ); gparent->setPixmap(0, rcIcon("action_g.png")); cobj = md->firstChild ( gparent->obj ); while ( !cobj.isNull() ) { oclass = md->objClass ( cobj ); if ( oclass == md_actiongroup ) loadGroup ( gparent, cobj ); oclass = md->objClass ( cobj ); if ( oclass == md_action ) new ActionListViewItem( gparent, getLastChild(), md, cobj, QString::null ); cobj = md->nextSibling ( cobj ); } };
NS_IMETHODIMP MsgMailNewsUrlBase::GetLoadGroup(nsILoadGroup **aLoadGroup) { *aLoadGroup = nullptr; // note: it is okay to return a null load group and not return an error // it's possible the url really doesn't have load group nsCOMPtr<nsILoadGroup> loadGroup (do_QueryReferent(m_loadGroupWeak)); if (!loadGroup) { nsCOMPtr<nsIMsgWindow> msgWindow(do_QueryReferent(m_msgWindowWeak)); if (msgWindow) { // XXXbz This is really weird... why are we getting some // random loadgroup we're not really a part of? nsCOMPtr<nsIDocShell> docShell; msgWindow->GetRootDocShell(getter_AddRefs(docShell)); loadGroup = do_GetInterface(docShell); m_loadGroupWeak = do_GetWeakReference(loadGroup); } } loadGroup.swap(*aLoadGroup); return *aLoadGroup ? NS_OK : NS_ERROR_NULL_POINTER; }
void ActionListViewItem::loadTree() { QString oclass; aCfgItem cobj; // clear tree clearTree(); if ( !md ) return; setPixmap(0, rcIcon("actions.png")); cobj = md->firstChild ( obj ); while ( !cobj.isNull() ) { oclass = md->objClass ( cobj ); if ( oclass == md_actiongroup ) loadGroup ( this, cobj ); oclass = md->objClass ( cobj ); if ( oclass == md_action ) new ActionListViewItem( this, getLastChild(), md, cobj, QString::null ); cobj = md->nextSibling ( cobj ); } };
nsresult nsUserFontSet::StartLoad(gfxFontEntry *aFontToLoad, const gfxFontFaceSrc *aFontFaceSrc) { nsresult rv; // check same-site origin nsIPresShell *ps = mPresContext->PresShell(); if (!ps) return NS_ERROR_FAILURE; NS_ASSERTION(aFontFaceSrc && !aFontFaceSrc->mIsLocal, "bad font face url passed to fontloader"); NS_ASSERTION(aFontFaceSrc->mURI, "null font uri"); if (!aFontFaceSrc->mURI) return NS_ERROR_FAILURE; // use document principal, original principal if flag set // this enables user stylesheets to load font files via // @font-face rules nsCOMPtr<nsIPrincipal> principal = ps->GetDocument()->NodePrincipal(); NS_ASSERTION(aFontFaceSrc->mOriginPrincipal, "null origin principal in @font-face rule"); if (aFontFaceSrc->mUseOriginPrincipal) { principal = do_QueryInterface(aFontFaceSrc->mOriginPrincipal); } rv = nsFontFaceLoader::CheckLoadAllowed(principal, aFontFaceSrc->mURI, ps->GetDocument()); if (NS_FAILED(rv)) { #ifdef PR_LOGGING if (LOG_ENABLED()) { nsCAutoString fontURI, referrerURI; aFontFaceSrc->mURI->GetSpec(fontURI); if (aFontFaceSrc->mReferrer) aFontFaceSrc->mReferrer->GetSpec(referrerURI); LOG(("fontdownloader download blocked - font uri: (%s) " "referrer uri: (%s) err: %8.8x\n", fontURI.get(), referrerURI.get(), rv)); } #endif return rv; } nsCOMPtr<nsIStreamLoader> streamLoader; nsCOMPtr<nsILoadGroup> loadGroup(ps->GetDocument()->GetDocumentLoadGroup()); nsCOMPtr<nsIChannel> channel; // get Content Security Policy from principal to pass into channel nsCOMPtr<nsIChannelPolicy> channelPolicy; nsCOMPtr<nsIContentSecurityPolicy> csp; rv = principal->GetCsp(getter_AddRefs(csp)); NS_ENSURE_SUCCESS(rv, rv); if (csp) { channelPolicy = do_CreateInstance("@mozilla.org/nschannelpolicy;1"); channelPolicy->SetContentSecurityPolicy(csp); channelPolicy->SetLoadType(nsIContentPolicy::TYPE_FONT); } rv = NS_NewChannel(getter_AddRefs(channel), aFontFaceSrc->mURI, nsnull, loadGroup, nsnull, nsIRequest::LOAD_NORMAL, channelPolicy); NS_ENSURE_SUCCESS(rv, rv); nsRefPtr<nsFontFaceLoader> fontLoader = new nsFontFaceLoader(aFontToLoad, aFontFaceSrc->mURI, this, channel); if (!fontLoader) return NS_ERROR_OUT_OF_MEMORY; #ifdef PR_LOGGING if (LOG_ENABLED()) { nsCAutoString fontURI, referrerURI; aFontFaceSrc->mURI->GetSpec(fontURI); if (aFontFaceSrc->mReferrer) aFontFaceSrc->mReferrer->GetSpec(referrerURI); LOG(("fontdownloader (%p) download start - font uri: (%s) " "referrer uri: (%s)\n", fontLoader.get(), fontURI.get(), referrerURI.get())); } #endif nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(channel)); if (httpChannel) httpChannel->SetReferrer(aFontFaceSrc->mReferrer); rv = NS_NewStreamLoader(getter_AddRefs(streamLoader), fontLoader); NS_ENSURE_SUCCESS(rv, rv); PRBool inherits = PR_FALSE; rv = NS_URIChainHasFlags(aFontFaceSrc->mURI, nsIProtocolHandler::URI_INHERITS_SECURITY_CONTEXT, &inherits); if (NS_SUCCEEDED(rv) && inherits) { // allow data, javascript, etc URI's rv = channel->AsyncOpen(streamLoader, nsnull); } else { nsCOMPtr<nsIStreamListener> listener = new nsCrossSiteListenerProxy(streamLoader, principal, channel, PR_FALSE, &rv); if (NS_FAILED(rv)) { fontLoader->DropChannel(); // explicitly need to break ref cycle } NS_ENSURE_TRUE(listener, NS_ERROR_OUT_OF_MEMORY); NS_ENSURE_SUCCESS(rv, rv); rv = channel->AsyncOpen(listener, nsnull); } if (NS_SUCCEEDED(rv)) { mLoaders.PutEntry(fontLoader); } return rv; }
void DocumentScene::newGroup(QString extension) { loadGroup("", extension); }
nsresult nsDOMWorkerScriptLoader::RunInternal() { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); // Things we need to make all this work... nsCOMPtr<nsIDocument> parentDoc = mWorker->Pool()->ParentDocument(); if (!parentDoc) { // Must have been canceled. return NS_ERROR_ABORT; } nsIPrincipal* principal; nsIURI* baseURI; if (mForWorker) { NS_ASSERTION(mScriptCount == 1, "Bad state!"); nsRefPtr<nsDOMWorker> parentWorker = mWorker->GetParent(); if (parentWorker) { principal = parentWorker->GetPrincipal(); NS_ENSURE_STATE(principal); baseURI = parentWorker->GetURI(); NS_ENSURE_STATE(baseURI); } else { principal = parentDoc->NodePrincipal(); NS_ENSURE_STATE(principal); baseURI = parentDoc->GetDocBaseURI(); } } else { principal = mWorker->GetPrincipal(); baseURI = mWorker->GetURI(); NS_ASSERTION(principal && baseURI, "Should have been set already!"); } // All of these can potentially be null, but that should be ok. We'll either // succeed without them or fail below. nsCOMPtr<nsILoadGroup> loadGroup(parentDoc->GetDocumentLoadGroup()); nsCOMPtr<nsIIOService> ios(do_GetIOService()); for (PRUint32 index = 0; index < mScriptCount; index++) { ScriptLoadInfo& loadInfo = mLoadInfos[index]; nsresult& rv = loadInfo.result; nsCOMPtr<nsIURI>& uri = loadInfo.finalURI; rv = nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(uri), loadInfo.url, parentDoc, baseURI); if (NS_FAILED(rv)) { return rv; } nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager(); NS_ENSURE_TRUE(secMan, NS_ERROR_FAILURE); PRInt16 shouldLoad = nsIContentPolicy::ACCEPT; rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_SCRIPT, uri, principal, parentDoc, NS_LITERAL_CSTRING("text/javascript"), nsnull, &shouldLoad, nsContentUtils::GetContentPolicy(), secMan); if (NS_FAILED(rv) || NS_CP_REJECTED(shouldLoad)) { if (NS_FAILED(rv) || shouldLoad != nsIContentPolicy::REJECT_TYPE) { return NS_ERROR_CONTENT_BLOCKED; } return NS_ERROR_CONTENT_BLOCKED_SHOW_ALT; } // If this script loader is being used to make a new worker then we need to // do a same-origin check. Otherwise we need to clear the load with the // security manager. if (mForWorker) { rv = principal->CheckMayLoad(uri, PR_FALSE); NS_ENSURE_SUCCESS(rv, rv); // Set the principal and URI on the new worker. mWorker->SetPrincipal(principal); rv = mWorker->SetURI(uri); NS_ENSURE_SUCCESS(rv, rv); } else { rv = secMan->CheckLoadURIWithPrincipal(principal, uri, 0); NS_ENSURE_SUCCESS(rv, rv); } // We need to know which index we're on in OnStreamComplete so we know where // to put the result. nsCOMPtr<nsISupportsPRUint32> indexSupports = do_CreateInstance(NS_SUPPORTS_PRUINT32_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); rv = indexSupports->SetData(index); NS_ENSURE_SUCCESS(rv, rv); // We don't care about progress so just use the simple stream loader for // OnStreamComplete notification only. nsCOMPtr<nsIStreamLoader> loader; rv = NS_NewStreamLoader(getter_AddRefs(loader), this); NS_ENSURE_SUCCESS(rv, rv); // get Content Security Policy from parent document to pass into channel nsCOMPtr<nsIChannelPolicy> channelPolicy; nsCOMPtr<nsIContentSecurityPolicy> csp; rv = parentDoc->NodePrincipal()->GetCsp(getter_AddRefs(csp)); NS_ENSURE_SUCCESS(rv, rv); if (csp) { channelPolicy = do_CreateInstance("@mozilla.org/nschannelpolicy;1"); channelPolicy->SetContentSecurityPolicy(csp); channelPolicy->SetLoadType(nsIContentPolicy::TYPE_SCRIPT); } rv = NS_NewChannel(getter_AddRefs(loadInfo.channel), uri, ios, loadGroup, nsnull, // callbacks nsIRequest::LOAD_NORMAL | nsIChannel::LOAD_CLASSIFY_URI, // loadFlags channelPolicy); // CSP info NS_ENSURE_SUCCESS(rv, rv); rv = loadInfo.channel->AsyncOpen(loader, indexSupports); if (NS_FAILED(rv)) { // Null this out so we don't try to cancel it later. loadInfo.channel = nsnull; return rv; } } return NS_OK; }
FMODMusic::FMODMusic( FMODAudio* audio ): mAudio( audio ), mCurrentChannel( 0 ) { memset( mChannels, 0, sizeof( mChannels ) ); loadGroup(); }
void DocumentScene::newGroup(Analyzer *analyzer) { loadGroup("", analyzer); }