MCPcopy Create free account
hub / github.com/NativeScript/android / timeCallback

Method timeCallback

test-app/runtime/src/main/cpp/console/Console.cpp:444–478  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

442}
443
444void Console::timeCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
445 try {
446 auto isolate = info.GetIsolate();
447
448 v8::HandleScope scope(isolate);
449
450 auto argLen = info.Length();
451 std::string label = "default";
452
453 v8::Local<v8::String> argString;
454 if (argLen && info[0]->ToString(isolate->GetCurrentContext()).ToLocal(&argString)) {
455 label = ArgConverter::ConvertToString(argString);
456 }
457
458 auto it = Console::s_isolateToConsoleTimersMap.find(isolate);
459 if (it == Console::s_isolateToConsoleTimersMap.end()) {
460 // throw?
461 }
462
463 auto nano = std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::system_clock::now());
464 double timeStamp = nano.time_since_epoch().count();
465
466 it->second.insert(std::make_pair(label, timeStamp));
467 } catch (NativeScriptException& e) {
468 e.ReThrowToV8();
469 } catch (std::exception e) {
470 std::stringstream ss;
471 ss << "Error: c++ exception: " << e.what() << std::endl;
472 NativeScriptException nsEx(ss.str());
473 nsEx.ReThrowToV8();
474 } catch (...) {
475 NativeScriptException nsEx(std::string("Error: c++ exception!"));
476 nsEx.ReThrowToV8();
477 }
478}
479
480void Console::timeEndCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
481 try {

Callers

nothing calls this directly

Calls 10

ToLocalMethod · 0.80
ReThrowToV8Method · 0.80
countMethod · 0.65
GetIsolateMethod · 0.45
LengthMethod · 0.45
ToStringMethod · 0.45
findMethod · 0.45
endMethod · 0.45
insertMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected