void MainThreadDebugger::contextCreated(ScriptState* scriptState, LocalFrame* frame, SecurityOrigin* origin) { ASSERT(isMainThread()); v8::HandleScope handles(scriptState->isolate()); DOMWrapperWorld& world = scriptState->world(); std::unique_ptr<protocol::DictionaryValue> auxDataValue = protocol::DictionaryValue::create(); auxDataValue->setBoolean("isDefault", world.isMainWorld()); auxDataValue->setString("frameId", IdentifiersFactory::frameId(frame)); String auxData = auxDataValue->toJSONString(); String humanReadableName = world.isIsolatedWorld() ? world.isolatedWorldHumanReadableName() : String(); String originString = origin ? origin->toRawString() : String(); v8_inspector::V8ContextInfo contextInfo( scriptState->context(), contextGroupId(frame), toV8InspectorStringView(humanReadableName)); contextInfo.origin = toV8InspectorStringView(originString); contextInfo.auxData = toV8InspectorStringView(auxData); contextInfo.hasMemoryOnConsole = scriptState->getExecutionContext() && scriptState->getExecutionContext()->isDocument(); v8Inspector()->contextCreated(contextInfo); }
QScriptValue REcmaHelper::throwError(const QString& message, QScriptContext* context) { QScriptContextInfo contextInfo(context); return context->throwError( QString("%1:%2:%3: %4\n%5") .arg(contextInfo.fileName()) .arg(contextInfo.lineNumber()) .arg(contextInfo.columnNumber()) .arg(message) .arg(context->backtrace().join("\n"))); }
int OpenSLPlayer::createSource() { map<int, ContextInfo>::iterator itr = contextInfos.find(contextIndex); if( itr == contextInfos.end() ) { g2cerror( "Attempt to create source from context that doesn't exist." " index=%d\n", contextIndex); exit(0); } ContextInfo& contextInfo(itr->second); SourceInfo* sourceInfo = new SourceInfo; SLresult result; // configure audio source SLDataLocator_AndroidSimpleBufferQueue loc_bufq = {SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, 2}; SLDataFormat_PCM format_pcm = {SL_DATAFORMAT_PCM, 1, SL_SAMPLINGRATE_44_1, SL_PCMSAMPLEFORMAT_FIXED_16, SL_PCMSAMPLEFORMAT_FIXED_16, SL_SPEAKER_FRONT_CENTER, SL_BYTEORDER_LITTLEENDIAN}; SLDataSource audioSrc = {&loc_bufq, &format_pcm}; // configure audio sink SLDataLocator_OutputMix loc_outmix = {SL_DATALOCATOR_OUTPUTMIX, contextInfo.outputMixObject}; SLDataSink audioSnk = {&loc_outmix, NULL}; // create audio player const SLInterfaceID ids[3] = {SL_IID_BUFFERQUEUE, SL_IID_EFFECTSEND, SL_IID_VOLUME}; const SLboolean req[3] = {SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE}; result = (*contextInfo.engine)->CreateAudioPlayer( contextInfo.engine, &(sourceInfo->bqPlayerObject), &audioSrc, &audioSnk, 3, ids, req); if( SL_RESULT_SUCCESS != result ) { g2cerror("OpenSL Failed to initialize OpenSL audio player.\n"); exit(0); } int index = 1; while( sourceInfos.find(index) != sourceInfos.end() ) index++; sourceInfos[index] = sourceInfo; sourceInfo->realize(); return index; }