| OLD | NEW |
| 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 18 matching lines...) Expand all Loading... |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "platform/v8_inspector/V8DebuggerImpl.h" | 31 #include "platform/v8_inspector/V8DebuggerImpl.h" |
| 32 | 32 |
| 33 #include "platform/inspector_protocol/Values.h" | 33 #include "platform/inspector_protocol/Values.h" |
| 34 #include "platform/v8_inspector/Atomics.h" | 34 #include "platform/v8_inspector/Atomics.h" |
| 35 #include "platform/v8_inspector/DebuggerScript.h" | 35 #include "platform/v8_inspector/DebuggerScript.h" |
| 36 #include "platform/v8_inspector/InspectedContext.h" | 36 #include "platform/v8_inspector/InspectedContext.h" |
| 37 #include "platform/v8_inspector/ScriptBreakpoint.h" | 37 #include "platform/v8_inspector/ScriptBreakpoint.h" |
| 38 #include "platform/v8_inspector/V8Compat.h" | 38 #include "platform/v8_inspector/V8Compat.h" |
| 39 #include "platform/v8_inspector/V8ConsoleAgentImpl.h" |
| 40 #include "platform/v8_inspector/V8ConsoleMessage.h" |
| 39 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" | 41 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" |
| 40 #include "platform/v8_inspector/V8InjectedScriptHost.h" | 42 #include "platform/v8_inspector/V8InjectedScriptHost.h" |
| 41 #include "platform/v8_inspector/V8InspectorSessionImpl.h" | 43 #include "platform/v8_inspector/V8InspectorSessionImpl.h" |
| 42 #include "platform/v8_inspector/V8RuntimeAgentImpl.h" | 44 #include "platform/v8_inspector/V8RuntimeAgentImpl.h" |
| 43 #include "platform/v8_inspector/V8StackTraceImpl.h" | 45 #include "platform/v8_inspector/V8StackTraceImpl.h" |
| 44 #include "platform/v8_inspector/V8StringUtil.h" | 46 #include "platform/v8_inspector/V8StringUtil.h" |
| 45 #include "platform/v8_inspector/public/V8DebuggerClient.h" | 47 #include "platform/v8_inspector/public/V8DebuggerClient.h" |
| 46 #include <v8-profiler.h> | 48 #include <v8-profiler.h> |
| 47 | 49 |
| 48 namespace blink { | 50 namespace blink { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 74 } | 76 } |
| 75 | 77 |
| 76 std::unique_ptr<V8Debugger> V8Debugger::create(v8::Isolate* isolate, V8DebuggerC
lient* client) | 78 std::unique_ptr<V8Debugger> V8Debugger::create(v8::Isolate* isolate, V8DebuggerC
lient* client) |
| 77 { | 79 { |
| 78 return wrapUnique(new V8DebuggerImpl(isolate, client)); | 80 return wrapUnique(new V8DebuggerImpl(isolate, client)); |
| 79 } | 81 } |
| 80 | 82 |
| 81 V8DebuggerImpl::V8DebuggerImpl(v8::Isolate* isolate, V8DebuggerClient* client) | 83 V8DebuggerImpl::V8DebuggerImpl(v8::Isolate* isolate, V8DebuggerClient* client) |
| 82 : m_isolate(isolate) | 84 : m_isolate(isolate) |
| 83 , m_client(client) | 85 , m_client(client) |
| 86 , m_capturingStackTracesCount(0) |
| 87 , m_muteConsoleCount(0) |
| 88 , m_lastConsoleMessageId(0) |
| 84 , m_enabledAgentsCount(0) | 89 , m_enabledAgentsCount(0) |
| 85 , m_breakpointsActivated(true) | 90 , m_breakpointsActivated(true) |
| 86 , m_runningNestedMessageLoop(false) | 91 , m_runningNestedMessageLoop(false) |
| 87 , m_maxAsyncCallStackDepth(0) | 92 , m_maxAsyncCallStackDepth(0) |
| 88 { | 93 { |
| 89 } | 94 } |
| 90 | 95 |
| 91 V8DebuggerImpl::~V8DebuggerImpl() | 96 V8DebuggerImpl::~V8DebuggerImpl() |
| 92 { | 97 { |
| 93 } | 98 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 109 m_debuggerContext.Reset(); | 114 m_debuggerContext.Reset(); |
| 110 allAsyncTasksCanceled(); | 115 allAsyncTasksCanceled(); |
| 111 v8::Debug::SetDebugEventListener(m_isolate, nullptr); | 116 v8::Debug::SetDebugEventListener(m_isolate, nullptr); |
| 112 } | 117 } |
| 113 | 118 |
| 114 bool V8DebuggerImpl::enabled() const | 119 bool V8DebuggerImpl::enabled() const |
| 115 { | 120 { |
| 116 return !m_debuggerScript.IsEmpty(); | 121 return !m_debuggerScript.IsEmpty(); |
| 117 } | 122 } |
| 118 | 123 |
| 119 int V8Debugger::contextId(v8::Local<v8::Context> context) | 124 int V8DebuggerImpl::contextId(v8::Local<v8::Context> context) |
| 120 { | 125 { |
| 121 v8::Local<v8::Value> data = context->GetEmbedderData(static_cast<int>(v8::Co
ntext::kDebugIdIndex)); | 126 v8::Local<v8::Value> data = context->GetEmbedderData(static_cast<int>(v8::Co
ntext::kDebugIdIndex)); |
| 122 if (data.IsEmpty() || !data->IsString()) | 127 if (data.IsEmpty() || !data->IsString()) |
| 123 return 0; | 128 return 0; |
| 124 String16 dataString = toProtocolString(data.As<v8::String>()); | 129 String16 dataString = toProtocolString(data.As<v8::String>()); |
| 125 if (dataString.isEmpty()) | 130 if (dataString.isEmpty()) |
| 126 return 0; | 131 return 0; |
| 127 size_t commaPos = dataString.find(","); | 132 size_t commaPos = dataString.find(","); |
| 128 if (commaPos == kNotFound) | 133 if (commaPos == kNotFound) |
| 129 return 0; | 134 return 0; |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 v8::True(m_isolate), // internal | 786 v8::True(m_isolate), // internal |
| 782 toV8String(m_isolate, String16()), // sourceMap | 787 toV8String(m_isolate, String16()), // sourceMap |
| 783 v8::True(m_isolate)); // opaqueresource | 788 v8::True(m_isolate)); // opaqueresource |
| 784 v8::ScriptCompiler::Source source(code, origin); | 789 v8::ScriptCompiler::Source source(code, origin); |
| 785 v8::Local<v8::Script> script; | 790 v8::Local<v8::Script> script; |
| 786 if (!v8::ScriptCompiler::Compile(context, &source, v8::ScriptCompiler::kNoCo
mpileOptions).ToLocal(&script)) | 791 if (!v8::ScriptCompiler::Compile(context, &source, v8::ScriptCompiler::kNoCo
mpileOptions).ToLocal(&script)) |
| 787 return v8::Local<v8::Script>(); | 792 return v8::Local<v8::Script>(); |
| 788 return script; | 793 return script; |
| 789 } | 794 } |
| 790 | 795 |
| 796 void V8DebuggerImpl::enableStackCapturingIfNeeded() |
| 797 { |
| 798 if (!m_capturingStackTracesCount) |
| 799 V8StackTraceImpl::setCaptureStackTraceForUncaughtExceptions(m_isolate, t
rue); |
| 800 ++m_capturingStackTracesCount; |
| 801 } |
| 802 |
| 803 void V8DebuggerImpl::disableStackCapturingIfNeeded() |
| 804 { |
| 805 if (!(--m_capturingStackTracesCount)) |
| 806 V8StackTraceImpl::setCaptureStackTraceForUncaughtExceptions(m_isolate, f
alse); |
| 807 } |
| 808 |
| 809 V8ConsoleMessageStorage* V8DebuggerImpl::ensureConsoleMessageStorage(int context
GroupId) |
| 810 { |
| 811 ConsoleStorageMap::iterator storageIt = m_consoleStorageMap.find(contextGrou
pId); |
| 812 if (storageIt == m_consoleStorageMap.end()) |
| 813 storageIt = m_consoleStorageMap.insert(std::make_pair(contextGroupId, wr
apUnique(new V8ConsoleMessageStorage(this, contextGroupId)))).first; |
| 814 return storageIt->second.get(); |
| 815 } |
| 816 |
| 791 std::unique_ptr<V8StackTrace> V8DebuggerImpl::createStackTrace(v8::Local<v8::Sta
ckTrace> stackTrace) | 817 std::unique_ptr<V8StackTrace> V8DebuggerImpl::createStackTrace(v8::Local<v8::Sta
ckTrace> stackTrace) |
| 792 { | 818 { |
| 793 int contextGroupId = m_isolate->InContext() ? getGroupId(m_isolate->GetCurre
ntContext()) : 0; | 819 int contextGroupId = m_isolate->InContext() ? getGroupId(m_isolate->GetCurre
ntContext()) : 0; |
| 794 return V8StackTraceImpl::create(this, contextGroupId, stackTrace, V8StackTra
ce::maxCallStackSizeToCapture); | 820 return V8StackTraceImpl::create(this, contextGroupId, stackTrace, V8StackTra
ceImpl::maxCallStackSizeToCapture); |
| 795 } | 821 } |
| 796 | 822 |
| 797 std::unique_ptr<V8InspectorSession> V8DebuggerImpl::connect(int contextGroupId,
protocol::FrontendChannel* channel, V8InspectorSessionClient* client, const Stri
ng16* state) | 823 std::unique_ptr<V8InspectorSession> V8DebuggerImpl::connect(int contextGroupId,
protocol::FrontendChannel* channel, V8InspectorSessionClient* client, const Stri
ng16* state) |
| 798 { | 824 { |
| 799 DCHECK(m_sessions.find(contextGroupId) == m_sessions.cend()); | 825 DCHECK(m_sessions.find(contextGroupId) == m_sessions.cend()); |
| 800 std::unique_ptr<V8InspectorSessionImpl> session = | 826 std::unique_ptr<V8InspectorSessionImpl> session = |
| 801 V8InspectorSessionImpl::create(this, contextGroupId, channel, client, st
ate); | 827 V8InspectorSessionImpl::create(this, contextGroupId, channel, client, st
ate); |
| 802 m_sessions[contextGroupId] = session.get(); | 828 m_sessions[contextGroupId] = session.get(); |
| 803 return std::move(session); | 829 return std::move(session); |
| 804 } | 830 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 DCHECK(contextById->find(contextId) == contextById->cend()); | 867 DCHECK(contextById->find(contextId) == contextById->cend()); |
| 842 InspectedContext* context = new InspectedContext(this, info, contextId); | 868 InspectedContext* context = new InspectedContext(this, info, contextId); |
| 843 (*contextById)[contextId] = wrapUnique(context); | 869 (*contextById)[contextId] = wrapUnique(context); |
| 844 SessionMap::iterator sessionIt = m_sessions.find(info.contextGroupId); | 870 SessionMap::iterator sessionIt = m_sessions.find(info.contextGroupId); |
| 845 if (sessionIt != m_sessions.end()) | 871 if (sessionIt != m_sessions.end()) |
| 846 sessionIt->second->runtimeAgent()->reportExecutionContextCreated(context
); | 872 sessionIt->second->runtimeAgent()->reportExecutionContextCreated(context
); |
| 847 } | 873 } |
| 848 | 874 |
| 849 void V8DebuggerImpl::contextDestroyed(v8::Local<v8::Context> context) | 875 void V8DebuggerImpl::contextDestroyed(v8::Local<v8::Context> context) |
| 850 { | 876 { |
| 851 int contextId = V8Debugger::contextId(context); | 877 int contextId = V8DebuggerImpl::contextId(context); |
| 852 int contextGroupId = getGroupId(context); | 878 int contextGroupId = getGroupId(context); |
| 879 |
| 880 ConsoleStorageMap::iterator storageIt = m_consoleStorageMap.find(contextGrou
pId); |
| 881 if (storageIt != m_consoleStorageMap.end()) |
| 882 storageIt->second->contextDestroyed(contextId); |
| 883 |
| 853 InspectedContext* inspectedContext = getContext(contextGroupId, contextId); | 884 InspectedContext* inspectedContext = getContext(contextGroupId, contextId); |
| 854 if (!inspectedContext) | 885 if (!inspectedContext) |
| 855 return; | 886 return; |
| 856 | 887 |
| 857 SessionMap::iterator iter = m_sessions.find(contextGroupId); | 888 SessionMap::iterator iter = m_sessions.find(contextGroupId); |
| 858 if (iter != m_sessions.end()) | 889 if (iter != m_sessions.end()) |
| 859 iter->second->runtimeAgent()->reportExecutionContextDestroyed(inspectedC
ontext); | 890 iter->second->runtimeAgent()->reportExecutionContextDestroyed(inspectedC
ontext); |
| 860 discardInspectedContext(contextGroupId, contextId); | 891 discardInspectedContext(contextGroupId, contextId); |
| 861 } | 892 } |
| 862 | 893 |
| 863 void V8DebuggerImpl::resetContextGroup(int contextGroupId) | 894 void V8DebuggerImpl::resetContextGroup(int contextGroupId) |
| 864 { | 895 { |
| 896 m_consoleStorageMap.erase(contextGroupId); |
| 865 SessionMap::iterator session = m_sessions.find(contextGroupId); | 897 SessionMap::iterator session = m_sessions.find(contextGroupId); |
| 866 if (session != m_sessions.end()) | 898 if (session != m_sessions.end()) |
| 867 session->second->reset(); | 899 session->second->reset(); |
| 868 m_contexts.erase(contextGroupId); | 900 m_contexts.erase(contextGroupId); |
| 869 } | 901 } |
| 870 | 902 |
| 871 void V8DebuggerImpl::setAsyncCallStackDepth(V8DebuggerAgentImpl* agent, int dept
h) | 903 void V8DebuggerImpl::setAsyncCallStackDepth(V8DebuggerAgentImpl* agent, int dept
h) |
| 872 { | 904 { |
| 873 if (depth <= 0) | 905 if (depth <= 0) |
| 874 m_maxAsyncCallStackDepthMap.erase(agent); | 906 m_maxAsyncCallStackDepthMap.erase(agent); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 893 if (!maxAsyncCallStackDepth) | 925 if (!maxAsyncCallStackDepth) |
| 894 allAsyncTasksCanceled(); | 926 allAsyncTasksCanceled(); |
| 895 } | 927 } |
| 896 | 928 |
| 897 void V8DebuggerImpl::asyncTaskScheduled(const String16& taskName, void* task, bo
ol recurring) | 929 void V8DebuggerImpl::asyncTaskScheduled(const String16& taskName, void* task, bo
ol recurring) |
| 898 { | 930 { |
| 899 if (!m_maxAsyncCallStackDepth) | 931 if (!m_maxAsyncCallStackDepth) |
| 900 return; | 932 return; |
| 901 v8::HandleScope scope(m_isolate); | 933 v8::HandleScope scope(m_isolate); |
| 902 int contextGroupId = m_isolate->InContext() ? getGroupId(m_isolate->GetCurre
ntContext()) : 0; | 934 int contextGroupId = m_isolate->InContext() ? getGroupId(m_isolate->GetCurre
ntContext()) : 0; |
| 903 std::unique_ptr<V8StackTraceImpl> chain = V8StackTraceImpl::capture(this, co
ntextGroupId, V8StackTrace::maxCallStackSizeToCapture, taskName); | 935 std::unique_ptr<V8StackTraceImpl> chain = V8StackTraceImpl::capture(this, co
ntextGroupId, V8StackTraceImpl::maxCallStackSizeToCapture, taskName); |
| 904 if (chain) { | 936 if (chain) { |
| 905 m_asyncTaskStacks[task] = std::move(chain); | 937 m_asyncTaskStacks[task] = std::move(chain); |
| 906 if (recurring) | 938 if (recurring) |
| 907 m_recurringTasks.insert(task); | 939 m_recurringTasks.insert(task); |
| 908 } | 940 } |
| 909 } | 941 } |
| 910 | 942 |
| 911 void V8DebuggerImpl::asyncTaskCanceled(void* task) | 943 void V8DebuggerImpl::asyncTaskCanceled(void* task) |
| 912 { | 944 { |
| 913 if (!m_maxAsyncCallStackDepth) | 945 if (!m_maxAsyncCallStackDepth) |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 void V8DebuggerImpl::idleStarted() | 1008 void V8DebuggerImpl::idleStarted() |
| 977 { | 1009 { |
| 978 m_isolate->GetCpuProfiler()->SetIdle(true); | 1010 m_isolate->GetCpuProfiler()->SetIdle(true); |
| 979 } | 1011 } |
| 980 | 1012 |
| 981 void V8DebuggerImpl::idleFinished() | 1013 void V8DebuggerImpl::idleFinished() |
| 982 { | 1014 { |
| 983 m_isolate->GetCpuProfiler()->SetIdle(false); | 1015 m_isolate->GetCpuProfiler()->SetIdle(false); |
| 984 } | 1016 } |
| 985 | 1017 |
| 986 std::unique_ptr<V8StackTrace> V8DebuggerImpl::captureStackTrace(size_t maxStackS
ize) | 1018 bool V8DebuggerImpl::addConsoleMessage(int contextGroupId, MessageSource source,
MessageLevel level, const String16& message, const String16& url, unsigned line
Number, unsigned columnNumber, std::unique_ptr<V8StackTrace> stackTrace, int scr
iptId, const String16& requestIdentifier) |
| 987 { | 1019 { |
| 988 int contextGroupId = m_isolate->InContext() ? getGroupId(m_isolate->GetCurre
ntContext()) : 0; | 1020 if (m_muteConsoleCount) |
| 989 return V8StackTraceImpl::capture(this, contextGroupId, maxStackSize); | 1021 return false; |
| 1022 ensureConsoleMessageStorage(contextGroupId)->addMessage(wrapUnique(new V8Con
soleMessage(m_client->currentTimeMS(), source, level, message, url, lineNumber,
columnNumber, std::move(stackTrace), scriptId, requestIdentifier))); |
| 1023 return true; |
| 1024 } |
| 1025 |
| 1026 void V8DebuggerImpl::logToConsole(v8::Local<v8::Context> context, const String16
& message, v8::Local<v8::Value> arg1, v8::Local<v8::Value> arg2) |
| 1027 { |
| 1028 int contextGroupId = getGroupId(context); |
| 1029 InspectedContext* inspectedContext = getContext(contextGroupId, contextId(co
ntext)); |
| 1030 if (!inspectedContext) |
| 1031 return; |
| 1032 std::vector<v8::Local<v8::Value>> arguments; |
| 1033 if (!arg1.IsEmpty()) |
| 1034 arguments.push_back(arg1); |
| 1035 if (!arg2.IsEmpty()) |
| 1036 arguments.push_back(arg2); |
| 1037 ensureConsoleMessageStorage(contextGroupId)->addMessage(V8ConsoleMessage::cr
eateForConsoleAPI(m_client->currentTimeMS(), LogMessageType, LogMessageLevel, me
ssage, arguments.size() ? &arguments : nullptr, captureStackTrace(false), inspec
tedContext)); |
| 1038 } |
| 1039 |
| 1040 unsigned V8DebuggerImpl::promiseRejected(v8::Local<v8::Context> context, const S
tring16& errorMessage, v8::Local<v8::Value> reason, const String16& url, unsigne
d lineNumber, unsigned columnNumber, std::unique_ptr<V8StackTrace> stackTrace, i
nt scriptId) |
| 1041 { |
| 1042 if (m_muteConsoleCount) |
| 1043 return 0; |
| 1044 int contextGroupId = getGroupId(context); |
| 1045 if (!contextGroupId) |
| 1046 return 0; |
| 1047 |
| 1048 const String16 defaultMessage = "Uncaught (in promise)"; |
| 1049 String16 message = errorMessage; |
| 1050 if (message.isEmpty()) |
| 1051 message = defaultMessage; |
| 1052 else if (message.startWith("Uncaught ")) |
| 1053 message = message.substring(0, 8) + " (in promise)" + message.substring(
8); |
| 1054 |
| 1055 m_client->messageAddedToConsole(contextGroupId, JSMessageSource, ErrorMessag
eLevel, message, url, lineNumber, columnNumber, stackTrace.get()); |
| 1056 std::unique_ptr<V8ConsoleMessage> consoleMessage = wrapUnique(new V8ConsoleM
essage(m_client->currentTimeMS(), JSMessageSource, ErrorMessageLevel, message, u
rl, lineNumber, columnNumber, std::move(stackTrace), scriptId, String16())); |
| 1057 unsigned id = ++m_lastConsoleMessageId; |
| 1058 consoleMessage->assignId(id); |
| 1059 |
| 1060 std::vector<v8::Local<v8::Value>> arguments; |
| 1061 arguments.push_back(toV8String(m_isolate, defaultMessage)); |
| 1062 arguments.push_back(reason); |
| 1063 consoleMessage->addArguments(m_isolate, contextId(context), &arguments); |
| 1064 |
| 1065 ensureConsoleMessageStorage(contextGroupId)->addMessage(std::move(consoleMes
sage)); |
| 1066 return id; |
| 1067 } |
| 1068 |
| 1069 void V8DebuggerImpl::promiseRejectionRevoked(v8::Local<v8::Context> context, uns
igned promiseRejectionId) |
| 1070 { |
| 1071 if (m_muteConsoleCount) |
| 1072 return; |
| 1073 int contextGroupId = getGroupId(context); |
| 1074 if (!contextGroupId) |
| 1075 return; |
| 1076 |
| 1077 const String16 message = "Handler added to rejected promise"; |
| 1078 m_client->messageAddedToConsole(contextGroupId, JSMessageSource, RevokedErro
rMessageLevel, message, String16(), 0, 0, nullptr); |
| 1079 std::unique_ptr<V8ConsoleMessage> consoleMessage = wrapUnique(new V8ConsoleM
essage(m_client->currentTimeMS(), JSMessageSource, RevokedErrorMessageLevel, mes
sage, String16(), 0, 0, nullptr, 0, String16())); |
| 1080 consoleMessage->assignRelatedId(promiseRejectionId); |
| 1081 ensureConsoleMessageStorage(contextGroupId)->addMessage(std::move(consoleMes
sage)); |
| 1082 } |
| 1083 |
| 1084 void V8DebuggerImpl::consoleMessagesCount(int contextGroupId, unsigned* total, u
nsigned* withArguments) |
| 1085 { |
| 1086 *total = 0; |
| 1087 *withArguments = 0; |
| 1088 ConsoleStorageMap::iterator storageIt = m_consoleStorageMap.find(contextGrou
pId); |
| 1089 if (storageIt == m_consoleStorageMap.end()) |
| 1090 return; |
| 1091 *total = storageIt->second->messages().size(); |
| 1092 for (const auto& message : storageIt->second->messages()) { |
| 1093 if (message->argumentCount()) |
| 1094 (*withArguments)++; |
| 1095 } |
| 1096 } |
| 1097 |
| 1098 std::unique_ptr<V8StackTrace> V8DebuggerImpl::captureStackTrace(bool fullStack) |
| 1099 { |
| 1100 if (!m_isolate->InContext()) |
| 1101 return nullptr; |
| 1102 |
| 1103 v8::HandleScope handles(m_isolate); |
| 1104 int contextGroupId = getGroupId(m_isolate->GetCurrentContext()); |
| 1105 if (!contextGroupId) |
| 1106 return nullptr; |
| 1107 |
| 1108 size_t stackSize = fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture :
1; |
| 1109 SessionMap::iterator sessionIt = m_sessions.find(contextGroupId); |
| 1110 if (sessionIt != m_sessions.end() && sessionIt->second->consoleAgent()->enab
led()) |
| 1111 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; |
| 1112 |
| 1113 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); |
| 990 } | 1114 } |
| 991 | 1115 |
| 992 v8::Local<v8::Context> V8DebuggerImpl::regexContext() | 1116 v8::Local<v8::Context> V8DebuggerImpl::regexContext() |
| 993 { | 1117 { |
| 994 if (m_regexContext.IsEmpty()) | 1118 if (m_regexContext.IsEmpty()) |
| 995 m_regexContext.Reset(m_isolate, v8::Context::New(m_isolate)); | 1119 m_regexContext.Reset(m_isolate, v8::Context::New(m_isolate)); |
| 996 return m_regexContext.Get(m_isolate); | 1120 return m_regexContext.Get(m_isolate); |
| 997 } | 1121 } |
| 998 | 1122 |
| 999 void V8DebuggerImpl::discardInspectedContext(int contextGroupId, int contextId) | 1123 void V8DebuggerImpl::discardInspectedContext(int contextGroupId, int contextId) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1013 | 1137 |
| 1014 V8InspectorSessionImpl* V8DebuggerImpl::sessionForContextGroup(int contextGroupI
d) | 1138 V8InspectorSessionImpl* V8DebuggerImpl::sessionForContextGroup(int contextGroupI
d) |
| 1015 { | 1139 { |
| 1016 if (!contextGroupId) | 1140 if (!contextGroupId) |
| 1017 return nullptr; | 1141 return nullptr; |
| 1018 SessionMap::iterator iter = m_sessions.find(contextGroupId); | 1142 SessionMap::iterator iter = m_sessions.find(contextGroupId); |
| 1019 return iter == m_sessions.end() ? nullptr : iter->second; | 1143 return iter == m_sessions.end() ? nullptr : iter->second; |
| 1020 } | 1144 } |
| 1021 | 1145 |
| 1022 } // namespace blink | 1146 } // namespace blink |
| OLD | NEW |