Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp

Issue 1978103002: DevTools: Make timeline show the JS stacks for microtasks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update the test. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/tracing/timeline-receive-response-event-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 return v8::MaybeLocal<v8::Value>(throwStackOverflowExceptionIfNeeded(iso late)); 451 return v8::MaybeLocal<v8::Value>(throwStackOverflowExceptionIfNeeded(iso late));
452 452
453 RELEASE_ASSERT(!context->isIteratingOverObservers()); 453 RELEASE_ASSERT(!context->isIteratingOverObservers());
454 454
455 if (ScriptForbiddenScope::isScriptForbidden()) { 455 if (ScriptForbiddenScope::isScriptForbidden()) {
456 throwScriptForbiddenException(isolate); 456 throwScriptForbiddenException(isolate);
457 return v8::MaybeLocal<v8::Value>(); 457 return v8::MaybeLocal<v8::Value>();
458 } 458 }
459 if (!depth) 459 if (!depth)
460 TRACE_EVENT_BEGIN1("devtools.timeline", "FunctionCall", "data", Inspecto rFunctionCallEvent::data(context, function)); 460 TRACE_EVENT_BEGIN1("devtools.timeline", "FunctionCall", "data", Inspecto rFunctionCallEvent::data(context, function));
461 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kRunMicrot asks); 461 v8::MaybeLocal<v8::Value> result;
462 ThreadDebugger::willExecuteScript(isolate, function->ScriptId()); 462 {
463 v8::MaybeLocal<v8::Value> result = function->Call(isolate->GetCurrentContext (), receiver, argc, args); 463 // Create an extra block so FunctionCall trace event end phase is record ed after
464 crashIfIsolateIsDead(isolate); 464 // v8::MicrotasksScope destructor, as the latter is running microtasks.
465 ThreadDebugger::didExecuteScript(isolate); 465 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kRunMi crotasks);
466 ThreadDebugger::willExecuteScript(isolate, function->ScriptId());
467 result = function->Call(isolate->GetCurrentContext(), receiver, argc, ar gs);
468 crashIfIsolateIsDead(isolate);
469 ThreadDebugger::didExecuteScript(isolate);
470 }
466 if (!depth) 471 if (!depth)
467 TRACE_EVENT_END0("devtools.timeline", "FunctionCall"); 472 TRACE_EVENT_END0("devtools.timeline", "FunctionCall");
468 return result; 473 return result;
469 } 474 }
470 475
471 v8::MaybeLocal<v8::Value> V8ScriptRunner::callInternalFunction(v8::Local<v8::Fun ction> function, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> a rgs[], v8::Isolate* isolate) 476 v8::MaybeLocal<v8::Value> V8ScriptRunner::callInternalFunction(v8::Local<v8::Fun ction> function, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> a rgs[], v8::Isolate* isolate)
472 { 477 {
473 TRACE_EVENT0("v8", "v8.callFunction"); 478 TRACE_EVENT0("v8", "v8.callFunction");
474 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); 479 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution");
475 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunM icrotasks); 480 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunM icrotasks);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 // Store a timestamp to the cache as hint. 532 // Store a timestamp to the cache as hint.
528 void V8ScriptRunner::setCacheTimeStamp(CachedMetadataHandler* cacheHandler) 533 void V8ScriptRunner::setCacheTimeStamp(CachedMetadataHandler* cacheHandler)
529 { 534 {
530 double now = WTF::currentTime(); 535 double now = WTF::currentTime();
531 unsigned tag = cacheTag(CacheTagTimeStamp, cacheHandler); 536 unsigned tag = cacheTag(CacheTagTimeStamp, cacheHandler);
532 cacheHandler->clearCachedMetadata(CachedMetadataHandler::CacheLocally); 537 cacheHandler->clearCachedMetadata(CachedMetadataHandler::CacheLocally);
533 cacheHandler->setCachedMetadata(tag, reinterpret_cast<char*>(&now), sizeof(n ow), CachedMetadataHandler::SendToPlatform); 538 cacheHandler->setCachedMetadata(tag, reinterpret_cast<char*>(&now), sizeof(n ow), CachedMetadataHandler::SendToPlatform);
534 } 539 }
535 540
536 } // namespace blink 541 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/tracing/timeline-receive-response-event-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698