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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 } | 514 } |
515 | 515 |
516 Response V8RuntimeAgentImpl::runIfWaitingForDebugger() { | 516 Response V8RuntimeAgentImpl::runIfWaitingForDebugger() { |
517 m_inspector->client()->runIfWaitingForDebugger(m_session->contextGroupId()); | 517 m_inspector->client()->runIfWaitingForDebugger(m_session->contextGroupId()); |
518 return Response::OK(); | 518 return Response::OK(); |
519 } | 519 } |
520 | 520 |
521 Response V8RuntimeAgentImpl::setCustomObjectFormatterEnabled(bool enabled) { | 521 Response V8RuntimeAgentImpl::setCustomObjectFormatterEnabled(bool enabled) { |
522 m_state->setBoolean(V8RuntimeAgentImplState::customObjectFormatterEnabled, | 522 m_state->setBoolean(V8RuntimeAgentImplState::customObjectFormatterEnabled, |
523 enabled); | 523 enabled); |
| 524 if (!m_enabled) return Response::Error("Runtime agent is not enabled"); |
524 m_session->setCustomObjectFormatterEnabled(enabled); | 525 m_session->setCustomObjectFormatterEnabled(enabled); |
525 return Response::OK(); | 526 return Response::OK(); |
526 } | 527 } |
527 | 528 |
528 Response V8RuntimeAgentImpl::discardConsoleEntries() { | 529 Response V8RuntimeAgentImpl::discardConsoleEntries() { |
529 V8ConsoleMessageStorage* storage = | 530 V8ConsoleMessageStorage* storage = |
530 m_inspector->ensureConsoleMessageStorage(m_session->contextGroupId()); | 531 m_inspector->ensureConsoleMessageStorage(m_session->contextGroupId()); |
531 storage->clear(); | 532 storage->clear(); |
532 return Response::OK(); | 533 return Response::OK(); |
533 } | 534 } |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 } | 672 } |
672 return Response::OK(); | 673 return Response::OK(); |
673 } | 674 } |
674 | 675 |
675 Response V8RuntimeAgentImpl::disable() { | 676 Response V8RuntimeAgentImpl::disable() { |
676 if (!m_enabled) return Response::OK(); | 677 if (!m_enabled) return Response::OK(); |
677 m_enabled = false; | 678 m_enabled = false; |
678 m_state->setBoolean(V8RuntimeAgentImplState::runtimeEnabled, false); | 679 m_state->setBoolean(V8RuntimeAgentImplState::runtimeEnabled, false); |
679 m_inspector->disableStackCapturingIfNeeded(); | 680 m_inspector->disableStackCapturingIfNeeded(); |
680 m_session->discardInjectedScripts(); | 681 m_session->discardInjectedScripts(); |
| 682 m_session->setCustomObjectFormatterEnabled(false); |
681 reset(); | 683 reset(); |
682 m_inspector->client()->endEnsureAllContextsInGroup( | 684 m_inspector->client()->endEnsureAllContextsInGroup( |
683 m_session->contextGroupId()); | 685 m_session->contextGroupId()); |
684 return Response::OK(); | 686 return Response::OK(); |
685 } | 687 } |
686 | 688 |
687 void V8RuntimeAgentImpl::reset() { | 689 void V8RuntimeAgentImpl::reset() { |
688 m_compiledScripts.clear(); | 690 m_compiledScripts.clear(); |
689 if (m_enabled) { | 691 if (m_enabled) { |
690 if (const V8InspectorImpl::ContextByIdMap* contexts = | 692 if (const V8InspectorImpl::ContextByIdMap* contexts = |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 } | 733 } |
732 | 734 |
733 bool V8RuntimeAgentImpl::reportMessage(V8ConsoleMessage* message, | 735 bool V8RuntimeAgentImpl::reportMessage(V8ConsoleMessage* message, |
734 bool generatePreview) { | 736 bool generatePreview) { |
735 message->reportToFrontend(&m_frontend, m_session, generatePreview); | 737 message->reportToFrontend(&m_frontend, m_session, generatePreview); |
736 m_frontend.flush(); | 738 m_frontend.flush(); |
737 return m_inspector->hasConsoleMessageStorage(m_session->contextGroupId()); | 739 return m_inspector->hasConsoleMessageStorage(m_session->contextGroupId()); |
738 } | 740 } |
739 | 741 |
740 } // namespace v8_inspector | 742 } // namespace v8_inspector |
OLD | NEW |