ECode AbstractEventLogger::OnCompleted( /* [in] */ Int32 statusCode) { if (mLogWritten) { return NOERROR; } else { mLogWritten = TRUE; } Int64 UNUSED(completionTime) = SystemClock::GetElapsedRealtime(); // We don't report latency for stopped syntheses because their overall // total time spent will be inaccurate (will not correlate with // the length of the utterance). // onAudioDataWritten() should normally always be called, and hence mPlaybackStartTime // should be set, if an error does not occur. if (statusCode != ITextToSpeech::TTS_SUCCESS || mPlaybackStartTime == -1 || mEngineCompleteTime == -1) { LogFailure(statusCode); return NOERROR; } Int64 audioLatency = mPlaybackStartTime - mReceivedTime; Int64 engineLatency = mEngineStartTime - mRequestProcessingStartTime; Int64 engineTotal = mEngineCompleteTime - mRequestProcessingStartTime; LogSuccess(audioLatency, engineLatency, engineTotal); return NOERROR; }
STATUS ShadowTable::InitializeReplyHandler( void *pContext_, STATUS rc ) { CONTEXT *pContext = (CONTEXT *)pContext_; switch( pContext->state ) { case READ_TABLE_DEF: // collect data and do clean-up if( rc != OK ) { Trace( (StringClass)"GetTableDef failed", ST_CRITICAL ); (m_pParentDdm->*(pContext->pCallback))( pContext->pCallersContext, rc ); delete pContext->pNumOfCols; delete pContext->pBytesPerRow; delete pContext->pNumOfRows; delete pContext->pFieldDef; delete pContext->pFieldDefSize; delete pContext; LogFailure( "ReadTableDef", rc ); break; } m_numberOfCols = *pContext->pNumOfCols; delete pContext->pNumOfCols; m_bytesPerRow = *pContext->pBytesPerRow; delete pContext->pBytesPerRow; m_numberOfRows = *pContext->pNumOfRows; delete pContext->pNumOfRows; m_pFieldDef = new fieldDef[ m_numberOfCols ]; memcpy( m_pFieldDef, pContext->pFieldDef, *pContext->pFieldDefSize ); delete pContext->pFieldDef; delete pContext->pFieldDefSize; // callback to report the GOOOOOOD news :-) m_isInited = true; (m_pParentDdm->*(pContext->pCallback))( pContext->pCallersContext, OK ); delete pContext; break; case INIT_LISTENERS: if( !m_areListenersInited ) { // report status if( rc != OK ) { Trace( (StringClass)"Register listeners failed", ST_CRITICAL ); (m_pParentDdm->*(pContext->pCallback))( pContext->pCallersContext, rc ); delete pContext; LogFailure("RegisterListener", rc ); break; } // do final clean-up m_areListenersInited = true; break; } else ; default: // PTS listen reply // TBDGAI: // this whole thing should be redone on real system. // make sure the memory is allocated by the transport, not me // and calculate the number of rows affected, now it's hardcoded to 1. if( *m_pListenTypeRet & ListenOnInsertRow ) { if( m_isInited ) m_numberOfRows++; (m_pParentDdm->*m_insertRowCallback)( m_pModifiedRecord, 1, this); } else if( *m_pListenTypeRet & ListenOnDeleteAnyRow ) { if( m_isInited ) m_numberOfRows--; (m_pParentDdm->*m_deleteRowCallback)( m_pModifiedRecord, 1, this); } else if( *m_pListenTypeRet & ListenOnModifyAnyRowAnyField ) { m_numberOfRows = m_numberOfRows; #if 0 // find the new rows by the row ids of the old ones and return them\ // TBDGAI: 1 is a hack now! But NOT the 1 when we do callback, this one is correct, // we do one at a time on this listen type rowID *pOldId = (rowID *)m_pModifiedRecord, *pNewId; for( U32 ridNum = 0; ridNum < 1; ridNum++, pOldId = (rowID *)((char *)pOldId + m_bytesPerRow ) ) { pNewId = (rowID *)m_pTableDataRet; for( U32 i = 0; i < m_sizeOfTableDataRet / m_bytesPerRow; i++, pNewId = (rowID *)( (char *)pNewId + m_bytesPerRow ) ) { if( RowId(*pNewId) == RowId(*pOldId) ) } } #else (m_pParentDdm->*m_modifyRowCallback)( (void *)m_pModifiedRecord, 1, this); #endif #ifndef WIN32 // I had problems with this....it seems that there some overlap // between this memory and memory allocated for objects elsewhere... // let's see if this is present on the eval or...if I van survive without using it. delete m_pTableDataRet; #endif } break; }