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

Side by Side Diff: src/inspector/v8-debugger.cc

Issue 2816373004: [inspector] don't enter to debugger context for PromiseEventOccurred (Closed)
Patch Set: Created 3 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 | « src/inspector/v8-debugger.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 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/inspector/v8-debugger.h" 5 #include "src/inspector/v8-debugger.h"
6 6
7 #include "src/inspector/debugger-script.h" 7 #include "src/inspector/debugger-script.h"
8 #include "src/inspector/inspected-context.h" 8 #include "src/inspector/inspected-context.h"
9 #include "src/inspector/protocol/Protocol.h" 9 #include "src/inspector/protocol/Protocol.h"
10 #include "src/inspector/script-breakpoint.h" 10 #include "src/inspector/script-breakpoint.h"
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 633
634 bool V8Debugger::IsFunctionBlackboxed(v8::Local<v8::debug::Script> script, 634 bool V8Debugger::IsFunctionBlackboxed(v8::Local<v8::debug::Script> script,
635 const v8::debug::Location& start, 635 const v8::debug::Location& start,
636 const v8::debug::Location& end) { 636 const v8::debug::Location& end) {
637 V8DebuggerAgentImpl* agent = agentForScript(m_inspector, script); 637 V8DebuggerAgentImpl* agent = agentForScript(m_inspector, script);
638 if (!agent) return false; 638 if (!agent) return false;
639 return agent->isFunctionBlackboxed(String16::fromInteger(script->Id()), start, 639 return agent->isFunctionBlackboxed(String16::fromInteger(script->Id()), start,
640 end); 640 end);
641 } 641 }
642 642
643 void V8Debugger::PromiseEventOccurred(v8::Local<v8::Context> context, 643 void V8Debugger::PromiseEventOccurred(v8::debug::PromiseDebugActionType type,
644 v8::debug::PromiseDebugActionType type,
645 int id, int parentId, 644 int id, int parentId,
646 bool createdByUser) { 645 bool createdByUser) {
647 // Async task events from Promises are given misaligned pointers to prevent 646 // Async task events from Promises are given misaligned pointers to prevent
648 // from overlapping with other Blink task identifiers. 647 // from overlapping with other Blink task identifiers.
649 void* task = reinterpret_cast<void*>(id * 2 + 1); 648 void* task = reinterpret_cast<void*>(id * 2 + 1);
650 void* parentTask = 649 void* parentTask =
651 parentId ? reinterpret_cast<void*>(parentId * 2 + 1) : nullptr; 650 parentId ? reinterpret_cast<void*>(parentId * 2 + 1) : nullptr;
652 switch (type) { 651 switch (type) {
653 case v8::debug::kDebugPromiseCreated: 652 case v8::debug::kDebugPromiseCreated:
654 asyncTaskCreatedForStack(task, parentTask); 653 asyncTaskCreatedForStack(task, parentTask);
655 if (createdByUser && parentTask) { 654 if (createdByUser && parentTask) asyncTaskCandidateForStepping(task);
656 v8::Context::Scope contextScope(context);
657 asyncTaskCandidateForStepping(task);
658 }
659 break; 655 break;
660 case v8::debug::kDebugEnqueueAsyncFunction: 656 case v8::debug::kDebugEnqueueAsyncFunction:
661 asyncTaskScheduledForStack("async function", task, true); 657 asyncTaskScheduledForStack("async function", task, true);
662 break; 658 break;
663 case v8::debug::kDebugEnqueuePromiseResolve: 659 case v8::debug::kDebugEnqueuePromiseResolve:
664 asyncTaskScheduledForStack("Promise.resolve", task, true); 660 asyncTaskScheduledForStack("Promise.resolve", task, true);
665 break; 661 break;
666 case v8::debug::kDebugEnqueuePromiseReject: 662 case v8::debug::kDebugEnqueuePromiseReject:
667 asyncTaskScheduledForStack("Promise.reject", task, true); 663 asyncTaskScheduledForStack("Promise.reject", task, true);
668 break; 664 break;
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 1027
1032 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); 1028 return V8StackTraceImpl::capture(this, contextGroupId, stackSize);
1033 } 1029 }
1034 1030
1035 int V8Debugger::currentContextGroupId() { 1031 int V8Debugger::currentContextGroupId() {
1036 if (!m_isolate->InContext()) return 0; 1032 if (!m_isolate->InContext()) return 0;
1037 return m_inspector->contextGroupId(m_isolate->GetCurrentContext()); 1033 return m_inspector->contextGroupId(m_isolate->GetCurrentContext());
1038 } 1034 }
1039 1035
1040 } // namespace v8_inspector 1036 } // namespace v8_inspector
OLDNEW
« no previous file with comments | « src/inspector/v8-debugger.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698