OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 ErrorString error; | 356 ErrorString error; |
357 enable(&error); | 357 enable(&error); |
358 if (m_state->booleanProperty(V8RuntimeAgentImplState::customObjectFormatterE
nabled, false)) | 358 if (m_state->booleanProperty(V8RuntimeAgentImplState::customObjectFormatterE
nabled, false)) |
359 m_session->setCustomObjectFormatterEnabled(true); | 359 m_session->setCustomObjectFormatterEnabled(true); |
360 } | 360 } |
361 | 361 |
362 void V8RuntimeAgentImpl::enable(ErrorString* errorString) | 362 void V8RuntimeAgentImpl::enable(ErrorString* errorString) |
363 { | 363 { |
364 if (m_enabled) | 364 if (m_enabled) |
365 return; | 365 return; |
366 m_session->changeInstrumentationCounter(+1); | 366 m_session->client()->runtimeEnabled(); |
367 m_enabled = true; | 367 m_enabled = true; |
368 m_state->setBoolean(V8RuntimeAgentImplState::runtimeEnabled, true); | 368 m_state->setBoolean(V8RuntimeAgentImplState::runtimeEnabled, true); |
369 m_session->debugger()->enableStackCapturingIfNeeded(); | 369 m_session->debugger()->enableStackCapturingIfNeeded(); |
370 m_session->reportAllContexts(this); | 370 m_session->reportAllContexts(this); |
371 V8ConsoleMessageStorage* storage = m_session->debugger()->ensureConsoleMessa
geStorage(m_session->contextGroupId()); | 371 V8ConsoleMessageStorage* storage = m_session->debugger()->ensureConsoleMessa
geStorage(m_session->contextGroupId()); |
372 for (const auto& message : storage->messages()) { | 372 for (const auto& message : storage->messages()) { |
373 if (message->origin() == V8MessageOrigin::kException || message->origin(
) == V8MessageOrigin::kRevokedException) | 373 if (message->origin() == V8MessageOrigin::kException || message->origin(
) == V8MessageOrigin::kRevokedException) |
374 reportMessage(message.get(), false); | 374 reportMessage(message.get(), false); |
375 } | 375 } |
376 } | 376 } |
377 | 377 |
378 void V8RuntimeAgentImpl::disable(ErrorString* errorString) | 378 void V8RuntimeAgentImpl::disable(ErrorString* errorString) |
379 { | 379 { |
380 if (!m_enabled) | 380 if (!m_enabled) |
381 return; | 381 return; |
382 m_enabled = false; | 382 m_enabled = false; |
383 m_state->setBoolean(V8RuntimeAgentImplState::runtimeEnabled, false); | 383 m_state->setBoolean(V8RuntimeAgentImplState::runtimeEnabled, false); |
384 m_session->debugger()->disableStackCapturingIfNeeded(); | 384 m_session->debugger()->disableStackCapturingIfNeeded(); |
385 m_session->discardInjectedScripts(); | 385 m_session->discardInjectedScripts(); |
386 reset(); | 386 reset(); |
387 m_session->changeInstrumentationCounter(-1); | 387 m_session->client()->runtimeDisabled(); |
388 } | 388 } |
389 | 389 |
390 void V8RuntimeAgentImpl::reset() | 390 void V8RuntimeAgentImpl::reset() |
391 { | 391 { |
392 m_compiledScripts.clear(); | 392 m_compiledScripts.clear(); |
393 if (m_enabled) { | 393 if (m_enabled) { |
394 if (const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->context
Group(m_session->contextGroupId())) { | 394 if (const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->context
Group(m_session->contextGroupId())) { |
395 for (auto& idContext : *contexts) | 395 for (auto& idContext : *contexts) |
396 idContext.second->setReported(false); | 396 idContext.second->setReported(false); |
397 } | 397 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 } | 434 } |
435 | 435 |
436 void V8RuntimeAgentImpl::reportMessage(V8ConsoleMessage* message, bool generateP
review) | 436 void V8RuntimeAgentImpl::reportMessage(V8ConsoleMessage* message, bool generateP
review) |
437 { | 437 { |
438 DCHECK(message->origin() == V8MessageOrigin::kException || message->origin()
== V8MessageOrigin::kRevokedException); | 438 DCHECK(message->origin() == V8MessageOrigin::kException || message->origin()
== V8MessageOrigin::kRevokedException); |
439 message->reportToFrontend(&m_frontend, m_session, generatePreview); | 439 message->reportToFrontend(&m_frontend, m_session, generatePreview); |
440 m_frontend.flush(); | 440 m_frontend.flush(); |
441 } | 441 } |
442 | 442 |
443 } // namespace blink | 443 } // namespace blink |
OLD | NEW |