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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp

Issue 1827993002: [DevTools] Remove promise inspector experiment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 8 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/Source/platform/v8_inspector/V8DebuggerImpl.h ('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) 2010-2011 Google Inc. All rights reserved. 2 * Copyright (c) 2010-2011 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 v8::Local<v8::Value> getterValue = object->Get(v8InternalizedString(function Name)); 591 v8::Local<v8::Value> getterValue = object->Get(v8InternalizedString(function Name));
592 ASSERT(!getterValue.IsEmpty() && getterValue->IsFunction()); 592 ASSERT(!getterValue.IsEmpty() && getterValue->IsFunction());
593 return v8::Local<v8::Function>::Cast(getterValue)->Call(m_isolate->GetCurren tContext(), object, 0, 0).ToLocalChecked(); 593 return v8::Local<v8::Function>::Cast(getterValue)->Call(m_isolate->GetCurren tContext(), object, 0, 0).ToLocalChecked();
594 } 594 }
595 595
596 void V8DebuggerImpl::handleV8DebugEvent(const v8::Debug::EventDetails& eventDeta ils) 596 void V8DebuggerImpl::handleV8DebugEvent(const v8::Debug::EventDetails& eventDeta ils)
597 { 597 {
598 if (!enabled()) 598 if (!enabled())
599 return; 599 return;
600 v8::DebugEvent event = eventDetails.GetEvent(); 600 v8::DebugEvent event = eventDetails.GetEvent();
601 if (event != v8::AsyncTaskEvent && event != v8::Break && event != v8::Except ion && event != v8::AfterCompile && event != v8::BeforeCompile && event != v8::C ompileError && event != v8::PromiseEvent) 601 if (event != v8::AsyncTaskEvent && event != v8::Break && event != v8::Except ion && event != v8::AfterCompile && event != v8::BeforeCompile && event != v8::C ompileError)
602 return; 602 return;
603 603
604 v8::Local<v8::Context> eventContext = eventDetails.GetEventContext(); 604 v8::Local<v8::Context> eventContext = eventDetails.GetEventContext();
605 ASSERT(!eventContext.IsEmpty()); 605 ASSERT(!eventContext.IsEmpty());
606 606
607 V8DebuggerAgentImpl* agent = getDebuggerAgentForContext(eventContext); 607 V8DebuggerAgentImpl* agent = getDebuggerAgentForContext(eventContext);
608 if (agent) { 608 if (agent) {
609 v8::HandleScope scope(m_isolate); 609 v8::HandleScope scope(m_isolate);
610 if (event == v8::AfterCompile || event == v8::CompileError) { 610 if (event == v8::AfterCompile || event == v8::CompileError) {
611 v8::Context::Scope contextScope(debuggerContext()); 611 v8::Context::Scope contextScope(debuggerContext());
612 v8::Local<v8::Value> argv[] = { eventDetails.GetEventData() }; 612 v8::Local<v8::Value> argv[] = { eventDetails.GetEventData() };
613 v8::Local<v8::Value> value = callDebuggerMethod("getAfterCompileScri pt", 1, argv).ToLocalChecked(); 613 v8::Local<v8::Value> value = callDebuggerMethod("getAfterCompileScri pt", 1, argv).ToLocalChecked();
614 ASSERT(value->IsObject()); 614 ASSERT(value->IsObject());
615 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(value); 615 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(value);
616 agent->didParseSource(createParsedScript(object, event == v8::AfterC ompile)); 616 agent->didParseSource(createParsedScript(object, event == v8::AfterC ompile));
617 } else if (event == v8::Exception) { 617 } else if (event == v8::Exception) {
618 v8::Local<v8::Object> eventData = eventDetails.GetEventData(); 618 v8::Local<v8::Object> eventData = eventDetails.GetEventData();
619 v8::Local<v8::Value> exception = callInternalGetterFunction(eventDat a, "exception"); 619 v8::Local<v8::Value> exception = callInternalGetterFunction(eventDat a, "exception");
620 v8::Local<v8::Value> promise = callInternalGetterFunction(eventData, "promise"); 620 v8::Local<v8::Value> promise = callInternalGetterFunction(eventData, "promise");
621 bool isPromiseRejection = !promise.IsEmpty() && promise->IsObject(); 621 bool isPromiseRejection = !promise.IsEmpty() && promise->IsObject();
622 handleProgramBreak(eventContext, eventDetails.GetExecutionState(), e xception, v8::Local<v8::Array>(), isPromiseRejection); 622 handleProgramBreak(eventContext, eventDetails.GetExecutionState(), e xception, v8::Local<v8::Array>(), isPromiseRejection);
623 } else if (event == v8::Break) { 623 } else if (event == v8::Break) {
624 v8::Local<v8::Value> argv[] = { eventDetails.GetEventData() }; 624 v8::Local<v8::Value> argv[] = { eventDetails.GetEventData() };
625 v8::Local<v8::Value> hitBreakpoints = callDebuggerMethod("getBreakpo intNumbers", 1, argv).ToLocalChecked(); 625 v8::Local<v8::Value> hitBreakpoints = callDebuggerMethod("getBreakpo intNumbers", 1, argv).ToLocalChecked();
626 ASSERT(hitBreakpoints->IsArray()); 626 ASSERT(hitBreakpoints->IsArray());
627 handleProgramBreak(eventContext, eventDetails.GetExecutionState(), v 8::Local<v8::Value>(), hitBreakpoints.As<v8::Array>()); 627 handleProgramBreak(eventContext, eventDetails.GetExecutionState(), v 8::Local<v8::Value>(), hitBreakpoints.As<v8::Array>());
628 } else if (event == v8::AsyncTaskEvent) { 628 } else if (event == v8::AsyncTaskEvent) {
629 if (agent->v8AsyncTaskEventsEnabled()) 629 if (agent->v8AsyncTaskEventsEnabled())
630 handleV8AsyncTaskEvent(agent, eventContext, eventDetails.GetExec utionState(), eventDetails.GetEventData()); 630 handleV8AsyncTaskEvent(agent, eventContext, eventDetails.GetExec utionState(), eventDetails.GetEventData());
631 } else if (event == v8::PromiseEvent) {
632 if (agent->v8PromiseEventsEnabled())
633 handleV8PromiseEvent(agent, eventContext, eventDetails.GetExecut ionState(), eventDetails.GetEventData());
634 } 631 }
635 } 632 }
636 } 633 }
637 634
638 void V8DebuggerImpl::handleV8AsyncTaskEvent(V8DebuggerAgentImpl* agent, v8::Loca l<v8::Context> context, v8::Local<v8::Object> executionState, v8::Local<v8::Obje ct> eventData) 635 void V8DebuggerImpl::handleV8AsyncTaskEvent(V8DebuggerAgentImpl* agent, v8::Loca l<v8::Context> context, v8::Local<v8::Object> executionState, v8::Local<v8::Obje ct> eventData)
639 { 636 {
640 String16 type = toProtocolStringWithTypeCheck(callInternalGetterFunction(eve ntData, "type")); 637 String16 type = toProtocolStringWithTypeCheck(callInternalGetterFunction(eve ntData, "type"));
641 String16 name = toProtocolStringWithTypeCheck(callInternalGetterFunction(eve ntData, "name")); 638 String16 name = toProtocolStringWithTypeCheck(callInternalGetterFunction(eve ntData, "name"));
642 int id = callInternalGetterFunction(eventData, "id")->ToInteger(m_isolate)-> Value(); 639 int id = callInternalGetterFunction(eventData, "id")->ToInteger(m_isolate)-> Value();
643 640
644 m_pausedContext = context; 641 m_pausedContext = context;
645 m_executionState = executionState; 642 m_executionState = executionState;
646 agent->didReceiveV8AsyncTaskEvent(context, type, name, id); 643 agent->didReceiveV8AsyncTaskEvent(context, type, name, id);
647 m_pausedContext.Clear(); 644 m_pausedContext.Clear();
648 m_executionState.Clear(); 645 m_executionState.Clear();
649 } 646 }
650 647
651 void V8DebuggerImpl::handleV8PromiseEvent(V8DebuggerAgentImpl* agent, v8::Local< v8::Context> context, v8::Local<v8::Object> executionState, v8::Local<v8::Object > eventData)
652 {
653 v8::Local<v8::Value> argv[] = { eventData };
654 v8::Local<v8::Value> value = callDebuggerMethod("getPromiseDetails", 1, argv ).ToLocalChecked();
655 ASSERT(value->IsObject());
656 v8::Local<v8::Object> promiseDetails = v8::Local<v8::Object>::Cast(value);
657 v8::Local<v8::Object> promise = promiseDetails->Get(v8InternalizedString("pr omise"))->ToObject(m_isolate);
658 int status = promiseDetails->Get(v8InternalizedString("status"))->ToInteger( m_isolate)->Value();
659 v8::Local<v8::Value> parentPromise = promiseDetails->Get(v8InternalizedStrin g("parentPromise"));
660
661 m_pausedContext = context;
662 m_executionState = executionState;
663 agent->didReceiveV8PromiseEvent(context, promise, parentPromise, status);
664 m_pausedContext.Clear();
665 m_executionState.Clear();
666 }
667
668 V8DebuggerParsedScript V8DebuggerImpl::createParsedScript(v8::Local<v8::Object> object, bool success) 648 V8DebuggerParsedScript V8DebuggerImpl::createParsedScript(v8::Local<v8::Object> object, bool success)
669 { 649 {
670 v8::Local<v8::Value> id = object->Get(v8InternalizedString("id")); 650 v8::Local<v8::Value> id = object->Get(v8InternalizedString("id"));
671 ASSERT(!id.IsEmpty() && id->IsInt32()); 651 ASSERT(!id.IsEmpty() && id->IsInt32());
672 652
673 V8DebuggerParsedScript parsedScript; 653 V8DebuggerParsedScript parsedScript;
674 parsedScript.scriptId = String16::number(id->Int32Value()); 654 parsedScript.scriptId = String16::number(id->Int32Value());
675 parsedScript.script.setURL(toProtocolStringWithTypeCheck(object->Get(v8Inter nalizedString("name")))) 655 parsedScript.script.setURL(toProtocolStringWithTypeCheck(object->Get(v8Inter nalizedString("name"))))
676 .setSourceURL(toProtocolStringWithTypeCheck(object->Get(v8InternalizedSt ring("sourceURL")))) 656 .setSourceURL(toProtocolStringWithTypeCheck(object->Get(v8InternalizedSt ring("sourceURL"))))
677 .setSourceMappingURL(toProtocolStringWithTypeCheck(object->Get(v8Interna lizedString("sourceMappingURL")))) 657 .setSourceMappingURL(toProtocolStringWithTypeCheck(object->Get(v8Interna lizedString("sourceMappingURL"))))
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 } 836 }
857 837
858 v8::Local<v8::Context> V8DebuggerImpl::regexContext() 838 v8::Local<v8::Context> V8DebuggerImpl::regexContext()
859 { 839 {
860 if (m_regexContext.IsEmpty()) 840 if (m_regexContext.IsEmpty())
861 m_regexContext.Reset(m_isolate, v8::Context::New(m_isolate)); 841 m_regexContext.Reset(m_isolate, v8::Context::New(m_isolate));
862 return m_regexContext.Get(m_isolate); 842 return m_regexContext.Get(m_isolate);
863 } 843 }
864 844
865 } // namespace blink 845 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698