| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium 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 "platform/v8_inspector/V8Debugger.h" | 5 #include "platform/v8_inspector/V8Debugger.h" |
| 6 | 6 |
| 7 #include "platform/v8_inspector/DebuggerScript.h" | 7 #include "platform/v8_inspector/DebuggerScript.h" |
| 8 #include "platform/v8_inspector/ScriptBreakpoint.h" | 8 #include "platform/v8_inspector/ScriptBreakpoint.h" |
| 9 #include "platform/v8_inspector/V8Compat.h" | 9 #include "platform/v8_inspector/V8Compat.h" |
| 10 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" | 10 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // static | 88 // static |
| 89 int V8Debugger::contextId(v8::Local<v8::Context> context) | 89 int V8Debugger::contextId(v8::Local<v8::Context> context) |
| 90 { | 90 { |
| 91 v8::Local<v8::Value> data = context->GetEmbedderData(static_cast<int>(v8::Co
ntext::kDebugIdIndex)); | 91 v8::Local<v8::Value> data = context->GetEmbedderData(static_cast<int>(v8::Co
ntext::kDebugIdIndex)); |
| 92 if (data.IsEmpty() || !data->IsString()) | 92 if (data.IsEmpty() || !data->IsString()) |
| 93 return 0; | 93 return 0; |
| 94 String16 dataString = toProtocolString(data.As<v8::String>()); | 94 String16 dataString = toProtocolString(data.As<v8::String>()); |
| 95 if (dataString.isEmpty()) | 95 if (dataString.isEmpty()) |
| 96 return 0; | 96 return 0; |
| 97 size_t commaPos = dataString.find(","); | 97 size_t commaPos = dataString.find(","); |
| 98 if (commaPos == kNotFound) | 98 if (commaPos == String16::kNotFound) |
| 99 return 0; | 99 return 0; |
| 100 size_t commaPos2 = dataString.find(",", commaPos + 1); | 100 size_t commaPos2 = dataString.find(",", commaPos + 1); |
| 101 if (commaPos2 == kNotFound) | 101 if (commaPos2 == String16::kNotFound) |
| 102 return 0; | 102 return 0; |
| 103 return dataString.substring(commaPos + 1, commaPos2 - commaPos - 1).toInt(); | 103 return dataString.substring(commaPos + 1, commaPos2 - commaPos - 1).toIntege
r(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 // static | 106 // static |
| 107 int V8Debugger::getGroupId(v8::Local<v8::Context> context) | 107 int V8Debugger::getGroupId(v8::Local<v8::Context> context) |
| 108 { | 108 { |
| 109 v8::Local<v8::Value> data = context->GetEmbedderData(static_cast<int>(v8::Co
ntext::kDebugIdIndex)); | 109 v8::Local<v8::Value> data = context->GetEmbedderData(static_cast<int>(v8::Co
ntext::kDebugIdIndex)); |
| 110 if (data.IsEmpty() || !data->IsString()) | 110 if (data.IsEmpty() || !data->IsString()) |
| 111 return 0; | 111 return 0; |
| 112 String16 dataString = toProtocolString(data.As<v8::String>()); | 112 String16 dataString = toProtocolString(data.As<v8::String>()); |
| 113 if (dataString.isEmpty()) | 113 if (dataString.isEmpty()) |
| 114 return 0; | 114 return 0; |
| 115 size_t commaPos = dataString.find(","); | 115 size_t commaPos = dataString.find(","); |
| 116 if (commaPos == kNotFound) | 116 if (commaPos == String16::kNotFound) |
| 117 return 0; | 117 return 0; |
| 118 return dataString.substring(0, commaPos).toInt(); | 118 return dataString.substring(0, commaPos).toInteger(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void V8Debugger::getCompiledScripts(int contextGroupId, std::vector<std::unique_
ptr<V8DebuggerScript>>& result) | 121 void V8Debugger::getCompiledScripts(int contextGroupId, std::vector<std::unique_
ptr<V8DebuggerScript>>& result) |
| 122 { | 122 { |
| 123 v8::HandleScope scope(m_isolate); | 123 v8::HandleScope scope(m_isolate); |
| 124 v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicr
otasks); | 124 v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicr
otasks); |
| 125 v8::Local<v8::Object> debuggerScript = m_debuggerScript.Get(m_isolate); | 125 v8::Local<v8::Object> debuggerScript = m_debuggerScript.Get(m_isolate); |
| 126 DCHECK(!debuggerScript->IsUndefined()); | 126 DCHECK(!debuggerScript->IsUndefined()); |
| 127 v8::Local<v8::Function> getScriptsFunction = v8::Local<v8::Function>::Cast(d
ebuggerScript->Get(toV8StringInternalized(m_isolate, "getScripts"))); | 127 v8::Local<v8::Function> getScriptsFunction = v8::Local<v8::Function>::Cast(d
ebuggerScript->Get(toV8StringInternalized(m_isolate, "getScripts"))); |
| 128 v8::Local<v8::Value> argv[] = { v8::Integer::New(m_isolate, contextGroupId)
}; | 128 v8::Local<v8::Value> argv[] = { v8::Integer::New(m_isolate, contextGroupId)
}; |
| (...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 return nullptr; | 828 return nullptr; |
| 829 | 829 |
| 830 size_t stackSize = fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture :
1; | 830 size_t stackSize = fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture :
1; |
| 831 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) | 831 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) |
| 832 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; | 832 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; |
| 833 | 833 |
| 834 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); | 834 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); |
| 835 } | 835 } |
| 836 | 836 |
| 837 } // namespace blink | 837 } // namespace blink |
| OLD | NEW |