| 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/V8InspectorSessionImpl.h" | 5 #include "platform/v8_inspector/V8InspectorSessionImpl.h" |
| 6 | 6 |
| 7 #include "platform/v8_inspector/InjectedScript.h" | 7 #include "platform/v8_inspector/InjectedScript.h" |
| 8 #include "platform/v8_inspector/InspectedContext.h" | 8 #include "platform/v8_inspector/InspectedContext.h" |
| 9 #include "platform/v8_inspector/RemoteObjectId.h" | 9 #include "platform/v8_inspector/RemoteObjectId.h" |
| 10 #include "platform/v8_inspector/SearchUtil.h" |
| 11 #include "platform/v8_inspector/StringUtil.h" |
| 10 #include "platform/v8_inspector/V8ConsoleAgentImpl.h" | 12 #include "platform/v8_inspector/V8ConsoleAgentImpl.h" |
| 11 #include "platform/v8_inspector/V8Debugger.h" | 13 #include "platform/v8_inspector/V8Debugger.h" |
| 12 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" | 14 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" |
| 13 #include "platform/v8_inspector/V8HeapProfilerAgentImpl.h" | 15 #include "platform/v8_inspector/V8HeapProfilerAgentImpl.h" |
| 14 #include "platform/v8_inspector/V8InspectorImpl.h" | 16 #include "platform/v8_inspector/V8InspectorImpl.h" |
| 15 #include "platform/v8_inspector/V8ProfilerAgentImpl.h" | 17 #include "platform/v8_inspector/V8ProfilerAgentImpl.h" |
| 16 #include "platform/v8_inspector/V8RuntimeAgentImpl.h" | 18 #include "platform/v8_inspector/V8RuntimeAgentImpl.h" |
| 17 #include "platform/v8_inspector/V8SchemaAgentImpl.h" | 19 #include "platform/v8_inspector/V8SchemaAgentImpl.h" |
| 18 #include "platform/v8_inspector/V8StringUtil.h" | 20 #include "platform/v8_inspector/protocol/Protocol.h" |
| 19 #include "platform/v8_inspector/public/V8ContextInfo.h" | 21 #include "platform/v8_inspector/public/V8ContextInfo.h" |
| 20 #include "platform/v8_inspector/public/V8InspectorClient.h" | 22 #include "platform/v8_inspector/public/V8InspectorClient.h" |
| 21 | 23 |
| 22 namespace v8_inspector { | 24 namespace v8_inspector { |
| 23 | 25 |
| 24 // static | 26 // static |
| 25 bool V8InspectorSession::canDispatchMethod(const StringView& method) | 27 bool V8InspectorSession::canDispatchMethod(const StringView& method) |
| 26 { | 28 { |
| 27 return stringViewStartsWith(method, protocol::Runtime::Metainfo::commandPref
ix) | 29 return stringViewStartsWith(method, protocol::Runtime::Metainfo::commandPref
ix) |
| 28 || stringViewStartsWith(method, protocol::Debugger::Metainfo::commandPre
fix) | 30 || stringViewStartsWith(method, protocol::Debugger::Metainfo::commandPre
fix) |
| 29 || stringViewStartsWith(method, protocol::Profiler::Metainfo::commandPre
fix) | 31 || stringViewStartsWith(method, protocol::Profiler::Metainfo::commandPre
fix) |
| 30 || stringViewStartsWith(method, protocol::HeapProfiler::Metainfo::comman
dPrefix) | 32 || stringViewStartsWith(method, protocol::HeapProfiler::Metainfo::comman
dPrefix) |
| 31 || stringViewStartsWith(method, protocol::Console::Metainfo::commandPref
ix) | 33 || stringViewStartsWith(method, protocol::Console::Metainfo::commandPref
ix) |
| 32 || stringViewStartsWith(method, protocol::Schema::Metainfo::commandPrefi
x); | 34 || stringViewStartsWith(method, protocol::Schema::Metainfo::commandPrefi
x); |
| 33 } | 35 } |
| 34 | 36 |
| 35 std::unique_ptr<V8InspectorSessionImpl> V8InspectorSessionImpl::create(V8Inspect
orImpl* inspector, int contextGroupId, protocol::FrontendChannel* channel, const
StringView& state) | 37 std::unique_ptr<V8InspectorSessionImpl> V8InspectorSessionImpl::create(V8Inspect
orImpl* inspector, int contextGroupId, V8Inspector::Channel* channel, const Stri
ngView& state) |
| 36 { | 38 { |
| 37 return wrapUnique(new V8InspectorSessionImpl(inspector, contextGroupId, chan
nel, state)); | 39 return wrapUnique(new V8InspectorSessionImpl(inspector, contextGroupId, chan
nel, state)); |
| 38 } | 40 } |
| 39 | 41 |
| 40 V8InspectorSessionImpl::V8InspectorSessionImpl(V8InspectorImpl* inspector, int c
ontextGroupId, protocol::FrontendChannel* channel, const StringView& savedState) | 42 V8InspectorSessionImpl::V8InspectorSessionImpl(V8InspectorImpl* inspector, int c
ontextGroupId, V8Inspector::Channel* channel, const StringView& savedState) |
| 41 : m_contextGroupId(contextGroupId) | 43 : m_contextGroupId(contextGroupId) |
| 42 , m_inspector(inspector) | 44 , m_inspector(inspector) |
| 45 , m_channel(channel) |
| 43 , m_customObjectFormatterEnabled(false) | 46 , m_customObjectFormatterEnabled(false) |
| 44 , m_dispatcher(channel) | 47 , m_dispatcher(this) |
| 45 , m_state(nullptr) | 48 , m_state(nullptr) |
| 46 , m_runtimeAgent(nullptr) | 49 , m_runtimeAgent(nullptr) |
| 47 , m_debuggerAgent(nullptr) | 50 , m_debuggerAgent(nullptr) |
| 48 , m_heapProfilerAgent(nullptr) | 51 , m_heapProfilerAgent(nullptr) |
| 49 , m_profilerAgent(nullptr) | 52 , m_profilerAgent(nullptr) |
| 50 , m_consoleAgent(nullptr) | 53 , m_consoleAgent(nullptr) |
| 51 , m_schemaAgent(nullptr) | 54 , m_schemaAgent(nullptr) |
| 52 { | 55 { |
| 53 if (savedState.length()) { | 56 if (savedState.length()) { |
| 54 std::unique_ptr<protocol::Value> state = protocol::parseJSON(toString16(
savedState)); | 57 std::unique_ptr<protocol::Value> state = protocol::parseJSON(toString16(
savedState)); |
| 55 if (state) | 58 if (state) |
| 56 m_state = protocol::DictionaryValue::cast(std::move(state)); | 59 m_state = protocol::DictionaryValue::cast(std::move(state)); |
| 57 if (!m_state) | 60 if (!m_state) |
| 58 m_state = protocol::DictionaryValue::create(); | 61 m_state = protocol::DictionaryValue::create(); |
| 59 } else { | 62 } else { |
| 60 m_state = protocol::DictionaryValue::create(); | 63 m_state = protocol::DictionaryValue::create(); |
| 61 } | 64 } |
| 62 | 65 |
| 63 m_runtimeAgent = wrapUnique(new V8RuntimeAgentImpl(this, channel, agentState
(protocol::Runtime::Metainfo::domainName))); | 66 m_runtimeAgent = wrapUnique(new V8RuntimeAgentImpl(this, this, agentState(pr
otocol::Runtime::Metainfo::domainName))); |
| 64 protocol::Runtime::Dispatcher::wire(&m_dispatcher, m_runtimeAgent.get()); | 67 protocol::Runtime::Dispatcher::wire(&m_dispatcher, m_runtimeAgent.get()); |
| 65 | 68 |
| 66 m_debuggerAgent = wrapUnique(new V8DebuggerAgentImpl(this, channel, agentSta
te(protocol::Debugger::Metainfo::domainName))); | 69 m_debuggerAgent = wrapUnique(new V8DebuggerAgentImpl(this, this, agentState(
protocol::Debugger::Metainfo::domainName))); |
| 67 protocol::Debugger::Dispatcher::wire(&m_dispatcher, m_debuggerAgent.get()); | 70 protocol::Debugger::Dispatcher::wire(&m_dispatcher, m_debuggerAgent.get()); |
| 68 | 71 |
| 69 m_profilerAgent = wrapUnique(new V8ProfilerAgentImpl(this, channel, agentSta
te(protocol::Profiler::Metainfo::domainName))); | 72 m_profilerAgent = wrapUnique(new V8ProfilerAgentImpl(this, this, agentState(
protocol::Profiler::Metainfo::domainName))); |
| 70 protocol::Profiler::Dispatcher::wire(&m_dispatcher, m_profilerAgent.get()); | 73 protocol::Profiler::Dispatcher::wire(&m_dispatcher, m_profilerAgent.get()); |
| 71 | 74 |
| 72 m_heapProfilerAgent = wrapUnique(new V8HeapProfilerAgentImpl(this, channel,
agentState(protocol::HeapProfiler::Metainfo::domainName))); | 75 m_heapProfilerAgent = wrapUnique(new V8HeapProfilerAgentImpl(this, this, age
ntState(protocol::HeapProfiler::Metainfo::domainName))); |
| 73 protocol::HeapProfiler::Dispatcher::wire(&m_dispatcher, m_heapProfilerAgent.
get()); | 76 protocol::HeapProfiler::Dispatcher::wire(&m_dispatcher, m_heapProfilerAgent.
get()); |
| 74 | 77 |
| 75 m_consoleAgent = wrapUnique(new V8ConsoleAgentImpl(this, channel, agentState
(protocol::Console::Metainfo::domainName))); | 78 m_consoleAgent = wrapUnique(new V8ConsoleAgentImpl(this, this, agentState(pr
otocol::Console::Metainfo::domainName))); |
| 76 protocol::Console::Dispatcher::wire(&m_dispatcher, m_consoleAgent.get()); | 79 protocol::Console::Dispatcher::wire(&m_dispatcher, m_consoleAgent.get()); |
| 77 | 80 |
| 78 m_schemaAgent = wrapUnique(new V8SchemaAgentImpl(this, channel, agentState(p
rotocol::Schema::Metainfo::domainName))); | 81 m_schemaAgent = wrapUnique(new V8SchemaAgentImpl(this, this, agentState(prot
ocol::Schema::Metainfo::domainName))); |
| 79 protocol::Schema::Dispatcher::wire(&m_dispatcher, m_schemaAgent.get()); | 82 protocol::Schema::Dispatcher::wire(&m_dispatcher, m_schemaAgent.get()); |
| 80 | 83 |
| 81 if (savedState.length()) { | 84 if (savedState.length()) { |
| 82 m_runtimeAgent->restore(); | 85 m_runtimeAgent->restore(); |
| 83 m_debuggerAgent->restore(); | 86 m_debuggerAgent->restore(); |
| 84 m_heapProfilerAgent->restore(); | 87 m_heapProfilerAgent->restore(); |
| 85 m_profilerAgent->restore(); | 88 m_profilerAgent->restore(); |
| 86 m_consoleAgent->restore(); | 89 m_consoleAgent->restore(); |
| 87 } | 90 } |
| 88 } | 91 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 104 { | 107 { |
| 105 protocol::DictionaryValue* state = m_state->getObject(name); | 108 protocol::DictionaryValue* state = m_state->getObject(name); |
| 106 if (!state) { | 109 if (!state) { |
| 107 std::unique_ptr<protocol::DictionaryValue> newState = protocol::Dictiona
ryValue::create(); | 110 std::unique_ptr<protocol::DictionaryValue> newState = protocol::Dictiona
ryValue::create(); |
| 108 state = newState.get(); | 111 state = newState.get(); |
| 109 m_state->setObject(name, std::move(newState)); | 112 m_state->setObject(name, std::move(newState)); |
| 110 } | 113 } |
| 111 return state; | 114 return state; |
| 112 } | 115 } |
| 113 | 116 |
| 117 void V8InspectorSessionImpl::sendProtocolResponse(int callId, const String16& me
ssage) |
| 118 { |
| 119 m_channel->sendProtocolResponse(callId, toStringView(message)); |
| 120 } |
| 121 |
| 122 void V8InspectorSessionImpl::sendProtocolNotification(const String16& message) |
| 123 { |
| 124 m_channel->sendProtocolNotification(toStringView(message)); |
| 125 } |
| 126 |
| 127 void V8InspectorSessionImpl::flushProtocolNotifications() |
| 128 { |
| 129 m_channel->flushProtocolNotifications(); |
| 130 } |
| 131 |
| 114 void V8InspectorSessionImpl::reset() | 132 void V8InspectorSessionImpl::reset() |
| 115 { | 133 { |
| 116 m_debuggerAgent->reset(); | 134 m_debuggerAgent->reset(); |
| 117 m_runtimeAgent->reset(); | 135 m_runtimeAgent->reset(); |
| 118 discardInjectedScripts(); | 136 discardInjectedScripts(); |
| 119 } | 137 } |
| 120 | 138 |
| 121 void V8InspectorSessionImpl::discardInjectedScripts() | 139 void V8InspectorSessionImpl::discardInjectedScripts() |
| 122 { | 140 { |
| 123 m_inspectedObjects.clear(); | 141 m_inspectedObjects.clear(); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 continue; | 214 continue; |
| 197 auto contextsIt = contexts->find(key); | 215 auto contextsIt = contexts->find(key); |
| 198 if (contextsIt == contexts->end()) | 216 if (contextsIt == contexts->end()) |
| 199 continue; | 217 continue; |
| 200 InjectedScript* injectedScript = contextsIt->second->getInjectedScript()
; | 218 InjectedScript* injectedScript = contextsIt->second->getInjectedScript()
; |
| 201 if (injectedScript) | 219 if (injectedScript) |
| 202 injectedScript->releaseObjectGroup(objectGroup); // This may destroy
some contexts. | 220 injectedScript->releaseObjectGroup(objectGroup); // This may destroy
some contexts. |
| 203 } | 221 } |
| 204 } | 222 } |
| 205 | 223 |
| 206 bool V8InspectorSessionImpl::unwrapObject(ErrorString* errorString, const String
View& objectId, v8::Local<v8::Value>* object, v8::Local<v8::Context>* context, s
td::unique_ptr<StringBuffer>* objectGroup) | 224 bool V8InspectorSessionImpl::unwrapObject(std::unique_ptr<StringBuffer>* error,
const StringView& objectId, v8::Local<v8::Value>* object, v8::Local<v8::Context>
* context, std::unique_ptr<StringBuffer>* objectGroup) |
| 207 { | 225 { |
| 208 std::unique_ptr<RemoteObjectId> remoteId = RemoteObjectId::parse(errorString
, toString16(objectId)); | 226 ErrorString errorString; |
| 227 String16 objectGroupString; |
| 228 bool result = unwrapObject(&errorString, toString16(objectId), object, conte
xt, objectGroup ? &objectGroupString : nullptr); |
| 229 if (error) |
| 230 *error = StringBufferImpl::adopt(errorString); |
| 231 if (objectGroup) |
| 232 *objectGroup = StringBufferImpl::adopt(objectGroupString); |
| 233 return result; |
| 234 } |
| 235 |
| 236 bool V8InspectorSessionImpl::unwrapObject(ErrorString* errorString, const String
16& objectId, v8::Local<v8::Value>* object, v8::Local<v8::Context>* context, Str
ing16* objectGroup) |
| 237 { |
| 238 std::unique_ptr<RemoteObjectId> remoteId = RemoteObjectId::parse(errorString
, objectId); |
| 209 if (!remoteId) | 239 if (!remoteId) |
| 210 return false; | 240 return false; |
| 211 InjectedScript* injectedScript = findInjectedScript(errorString, remoteId.ge
t()); | 241 InjectedScript* injectedScript = findInjectedScript(errorString, remoteId.ge
t()); |
| 212 if (!injectedScript) | 242 if (!injectedScript) |
| 213 return false; | 243 return false; |
| 214 if (!injectedScript->findObject(errorString, *remoteId, object)) | 244 if (!injectedScript->findObject(errorString, *remoteId, object)) |
| 215 return false; | 245 return false; |
| 216 *context = injectedScript->context()->context(); | 246 *context = injectedScript->context()->context(); |
| 217 if (objectGroup) { | 247 if (objectGroup) |
| 218 String16 group = injectedScript->objectGroupName(*remoteId); | 248 *objectGroup = injectedScript->objectGroupName(*remoteId); |
| 219 *objectGroup = StringBufferImpl::adopt(group); | |
| 220 } | |
| 221 return true; | 249 return true; |
| 222 } | 250 } |
| 223 | 251 |
| 224 std::unique_ptr<protocol::Runtime::API::RemoteObject> V8InspectorSessionImpl::wr
apObject(v8::Local<v8::Context> context, v8::Local<v8::Value> value, const Strin
gView& groupName) | 252 std::unique_ptr<protocol::Runtime::API::RemoteObject> V8InspectorSessionImpl::wr
apObject(v8::Local<v8::Context> context, v8::Local<v8::Value> value, const Strin
gView& groupName) |
| 225 { | 253 { |
| 226 return wrapObject(context, value, toString16(groupName), false); | 254 return wrapObject(context, value, toString16(groupName), false); |
| 227 } | 255 } |
| 228 | 256 |
| 229 std::unique_ptr<protocol::Runtime::RemoteObject> V8InspectorSessionImpl::wrapObj
ect(v8::Local<v8::Context> context, v8::Local<v8::Value> value, const String16&
groupName, bool generatePreview) | 257 std::unique_ptr<protocol::Runtime::RemoteObject> V8InspectorSessionImpl::wrapObj
ect(v8::Local<v8::Context> context, v8::Local<v8::Value> value, const String16&
groupName, bool generatePreview) |
| 230 { | 258 { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 261 { | 289 { |
| 262 const V8InspectorImpl::ContextByIdMap* contexts = m_inspector->contextGroup(
m_contextGroupId); | 290 const V8InspectorImpl::ContextByIdMap* contexts = m_inspector->contextGroup(
m_contextGroupId); |
| 263 if (!contexts) | 291 if (!contexts) |
| 264 return; | 292 return; |
| 265 for (auto& idContext : *contexts) | 293 for (auto& idContext : *contexts) |
| 266 agent->reportExecutionContextCreated(idContext.second.get()); | 294 agent->reportExecutionContextCreated(idContext.second.get()); |
| 267 } | 295 } |
| 268 | 296 |
| 269 void V8InspectorSessionImpl::dispatchProtocolMessage(const StringView& message) | 297 void V8InspectorSessionImpl::dispatchProtocolMessage(const StringView& message) |
| 270 { | 298 { |
| 271 m_dispatcher.dispatch(parseJSON(message)); | 299 m_dispatcher.dispatch(protocol::parseJSON(message)); |
| 272 } | 300 } |
| 273 | 301 |
| 274 std::unique_ptr<StringBuffer> V8InspectorSessionImpl::stateJSON() | 302 std::unique_ptr<StringBuffer> V8InspectorSessionImpl::stateJSON() |
| 275 { | 303 { |
| 276 String16 json = m_state->toJSONString(); | 304 String16 json = m_state->toJSONString(); |
| 277 return StringBufferImpl::adopt(json); | 305 return StringBufferImpl::adopt(json); |
| 278 } | 306 } |
| 279 | 307 |
| 280 std::unique_ptr<protocol::Array<protocol::Schema::API::Domain>> V8InspectorSessi
onImpl::supportedDomains() | 308 std::vector<std::unique_ptr<protocol::Schema::API::Domain>> V8InspectorSessionIm
pl::supportedDomains() |
| 281 { | 309 { |
| 282 std::vector<std::unique_ptr<protocol::Schema::Domain>> domains = supportedDo
mainsImpl(); | 310 std::vector<std::unique_ptr<protocol::Schema::Domain>> domains = supportedDo
mainsImpl(); |
| 283 std::unique_ptr<protocol::Array<protocol::Schema::API::Domain>> result = pro
tocol::Array<protocol::Schema::API::Domain>::create(); | 311 std::vector<std::unique_ptr<protocol::Schema::API::Domain>> result; |
| 284 for (size_t i = 0; i < domains.size(); ++i) | 312 for (size_t i = 0; i < domains.size(); ++i) |
| 285 result->addItem(std::move(domains[i])); | 313 result.push_back(std::move(domains[i])); |
| 286 return result; | 314 return result; |
| 287 } | 315 } |
| 288 | 316 |
| 289 std::vector<std::unique_ptr<protocol::Schema::Domain>> V8InspectorSessionImpl::s
upportedDomainsImpl() | 317 std::vector<std::unique_ptr<protocol::Schema::Domain>> V8InspectorSessionImpl::s
upportedDomainsImpl() |
| 290 { | 318 { |
| 291 std::vector<std::unique_ptr<protocol::Schema::Domain>> result; | 319 std::vector<std::unique_ptr<protocol::Schema::Domain>> result; |
| 292 result.push_back(protocol::Schema::Domain::create().setName(protocol::Runtim
e::Metainfo::domainName).setVersion(protocol::Runtime::Metainfo::version).build(
)); | 320 result.push_back(protocol::Schema::Domain::create().setName(protocol::Runtim
e::Metainfo::domainName).setVersion(protocol::Runtime::Metainfo::version).build(
)); |
| 293 result.push_back(protocol::Schema::Domain::create().setName(protocol::Debugg
er::Metainfo::domainName).setVersion(protocol::Debugger::Metainfo::version).buil
d()); | 321 result.push_back(protocol::Schema::Domain::create().setName(protocol::Debugg
er::Metainfo::domainName).setVersion(protocol::Debugger::Metainfo::version).buil
d()); |
| 294 result.push_back(protocol::Schema::Domain::create().setName(protocol::Profil
er::Metainfo::domainName).setVersion(protocol::Profiler::Metainfo::version).buil
d()); | 322 result.push_back(protocol::Schema::Domain::create().setName(protocol::Profil
er::Metainfo::domainName).setVersion(protocol::Profiler::Metainfo::version).buil
d()); |
| 295 result.push_back(protocol::Schema::Domain::create().setName(protocol::HeapPr
ofiler::Metainfo::domainName).setVersion(protocol::HeapProfiler::Metainfo::versi
on).build()); | 323 result.push_back(protocol::Schema::Domain::create().setName(protocol::HeapPr
ofiler::Metainfo::domainName).setVersion(protocol::HeapProfiler::Metainfo::versi
on).build()); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 306 | 334 |
| 307 V8InspectorSession::Inspectable* V8InspectorSessionImpl::inspectedObject(unsigne
d num) | 335 V8InspectorSession::Inspectable* V8InspectorSessionImpl::inspectedObject(unsigne
d num) |
| 308 { | 336 { |
| 309 if (num >= m_inspectedObjects.size()) | 337 if (num >= m_inspectedObjects.size()) |
| 310 return nullptr; | 338 return nullptr; |
| 311 return m_inspectedObjects[num].get(); | 339 return m_inspectedObjects[num].get(); |
| 312 } | 340 } |
| 313 | 341 |
| 314 void V8InspectorSessionImpl::schedulePauseOnNextStatement(const StringView& brea
kReason, const StringView& breakDetails) | 342 void V8InspectorSessionImpl::schedulePauseOnNextStatement(const StringView& brea
kReason, const StringView& breakDetails) |
| 315 { | 343 { |
| 316 m_debuggerAgent->schedulePauseOnNextStatement(toString16(breakReason), proto
col::DictionaryValue::cast(parseJSON(breakDetails))); | 344 m_debuggerAgent->schedulePauseOnNextStatement(toString16(breakReason), proto
col::DictionaryValue::cast(protocol::parseJSON(breakDetails))); |
| 317 } | 345 } |
| 318 | 346 |
| 319 void V8InspectorSessionImpl::cancelPauseOnNextStatement() | 347 void V8InspectorSessionImpl::cancelPauseOnNextStatement() |
| 320 { | 348 { |
| 321 m_debuggerAgent->cancelPauseOnNextStatement(); | 349 m_debuggerAgent->cancelPauseOnNextStatement(); |
| 322 } | 350 } |
| 323 | 351 |
| 324 void V8InspectorSessionImpl::breakProgram(const StringView& breakReason, const S
tringView& breakDetails) | 352 void V8InspectorSessionImpl::breakProgram(const StringView& breakReason, const S
tringView& breakDetails) |
| 325 { | 353 { |
| 326 m_debuggerAgent->breakProgram(toString16(breakReason), protocol::DictionaryV
alue::cast(parseJSON(breakDetails))); | 354 m_debuggerAgent->breakProgram(toString16(breakReason), protocol::DictionaryV
alue::cast(protocol::parseJSON(breakDetails))); |
| 327 } | 355 } |
| 328 | 356 |
| 329 void V8InspectorSessionImpl::setSkipAllPauses(bool skip) | 357 void V8InspectorSessionImpl::setSkipAllPauses(bool skip) |
| 330 { | 358 { |
| 331 ErrorString errorString; | 359 ErrorString errorString; |
| 332 m_debuggerAgent->setSkipAllPauses(&errorString, skip); | 360 m_debuggerAgent->setSkipAllPauses(&errorString, skip); |
| 333 } | 361 } |
| 334 | 362 |
| 335 void V8InspectorSessionImpl::resume() | 363 void V8InspectorSessionImpl::resume() |
| 336 { | 364 { |
| 337 ErrorString errorString; | 365 ErrorString errorString; |
| 338 m_debuggerAgent->resume(&errorString); | 366 m_debuggerAgent->resume(&errorString); |
| 339 } | 367 } |
| 340 | 368 |
| 341 void V8InspectorSessionImpl::stepOver() | 369 void V8InspectorSessionImpl::stepOver() |
| 342 { | 370 { |
| 343 ErrorString errorString; | 371 ErrorString errorString; |
| 344 m_debuggerAgent->stepOver(&errorString); | 372 m_debuggerAgent->stepOver(&errorString); |
| 345 } | 373 } |
| 346 | 374 |
| 347 std::unique_ptr<protocol::Array<protocol::Debugger::API::SearchMatch>> V8Inspect
orSessionImpl::searchInTextByLines(const StringView& text, const StringView& que
ry, bool caseSensitive, bool isRegex) | 375 std::vector<std::unique_ptr<protocol::Debugger::API::SearchMatch>> V8InspectorSe
ssionImpl::searchInTextByLines(const StringView& text, const StringView& query,
bool caseSensitive, bool isRegex) |
| 348 { | 376 { |
| 349 // TODO(dgozman): search may operate on StringView and avoid copying |text|. | 377 // TODO(dgozman): search may operate on StringView and avoid copying |text|. |
| 350 std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> matches = sear
chInTextByLinesImpl(this, toString16(text), toString16(query), caseSensitive, is
Regex); | 378 std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> matches = sear
chInTextByLinesImpl(this, toString16(text), toString16(query), caseSensitive, is
Regex); |
| 351 std::unique_ptr<protocol::Array<protocol::Debugger::API::SearchMatch>> resul
t = protocol::Array<protocol::Debugger::API::SearchMatch>::create(); | 379 std::vector<std::unique_ptr<protocol::Debugger::API::SearchMatch>> result; |
| 352 for (size_t i = 0; i < matches.size(); ++i) | 380 for (size_t i = 0; i < matches.size(); ++i) |
| 353 result->addItem(std::move(matches[i])); | 381 result.push_back(std::move(matches[i])); |
| 354 return result; | 382 return result; |
| 355 } | 383 } |
| 356 | 384 |
| 357 } // namespace v8_inspector | 385 } // namespace v8_inspector |
| OLD | NEW |