Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 3 files). Show all
Unified · Split
| @@ -1284,8 +1284,8 @@ void ScriptEngine::timerFired() { · 1283 unmodified lines | |||
| 1284 | 1284 | ||
| 1285 | // call the associated JS function, if it exists | 1285 | // call the associated JS function, if it exists |
| 1286 | if (timerData.function.isValid()) { | 1286 | if (timerData.function.isValid()) { |
| 1287 | //PROFILE_RANGE(script, __FUNCTION__); | 1287 | PROFILE_RANGE(script, __FUNCTION__); |
| 1288 | PROFILE_RANGE(script, timerData.function.toString().toStdString().c_str()); | 1288 | // PROFILE_RANGE(script, timerData.function.toString().toStdString().c_str()); |
| 1289 | auto preTimer = p_high_resolution_clock::now(); | 1289 | auto preTimer = p_high_resolution_clock::now(); |
| 1290 | callWithEnvironment(timerData.definingEntityIdentifier, timerData.definingSandboxURL, timerData.function, timerData.function, QScriptValueList()); | 1290 | callWithEnvironment(timerData.definingEntityIdentifier, timerData.definingSandboxURL, timerData.function, timerData.function, QScriptValueList()); |
| 1291 | auto postTimer = p_high_resolution_clock::now(); | 1291 | auto postTimer = p_high_resolution_clock::now(); |
| @@ -1396,6 +1396,19 @@ void ScriptEngine::print(const QString& message) { · 104 unmodified lines | |||
| 1396 | emit printedMessage(message, getFilename()); | 1396 | emit printedMessage(message, getFilename()); |
| 1397 | } | 1397 | } |
| 1398 | 1398 | ||
| 1399 | |||
| 1400 | void ScriptEngine::beginProfileRange(const QString& label) const { | ||
| 1401 | if (trace_script().isDebugEnabled()) { | ||
| 1402 | tracing::traceEvent(trace_script(), label.toStdString().c_str(), tracing::DurationBegin); | ||
| 1403 | } | ||
| 1404 | } | ||
| 1405 | |||
| 1406 | void ScriptEngine::endProfileRange(const QString& label) const { | ||
| 1407 | if (trace_script().isDebugEnabled()) { | ||
| 1408 | tracing::traceEvent(trace_script(), label.toStdString().c_str(), tracing::DurationEnd); | ||
| 1409 | } | ||
| 1410 | } | ||
| 1411 | |||
| 1399 | // Script.require.resolve -- like resolvePath, but performs more validation and throws exceptions on invalid module identifiers (for consistency with Node.js) | 1412 | // Script.require.resolve -- like resolvePath, but performs more validation and throws exceptions on invalid module identifiers (for consistency with Node.js) |
| 1400 | QString ScriptEngine::_requireResolve(const QString& moduleId, const QString& relativeTo) { | 1413 | QString ScriptEngine::_requireResolve(const QString& moduleId, const QString& relativeTo) { |
| 1401 | if (!IS_THREADSAFE_INVOCATION(thread(), __FUNCTION__)) { | 1414 | if (!IS_THREADSAFE_INVOCATION(thread(), __FUNCTION__)) { |