Chromium Code Reviews| 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 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 729 return takeCoverage(m_inspector->isolate(), false, out_result); | 729 return takeCoverage(m_inspector->isolate(), false, out_result); |
| 730 } | 730 } |
| 731 | 731 |
| 732 void V8RuntimeAgentImpl::restore() { | 732 void V8RuntimeAgentImpl::restore() { |
| 733 if (!m_state->booleanProperty(V8RuntimeAgentImplState::runtimeEnabled, false)) | 733 if (!m_state->booleanProperty(V8RuntimeAgentImplState::runtimeEnabled, false)) |
| 734 return; | 734 return; |
| 735 m_frontend.executionContextsCleared(); | 735 m_frontend.executionContextsCleared(); |
| 736 enable(); | 736 enable(); |
| 737 if (m_state->booleanProperty( | 737 if (m_state->booleanProperty( |
| 738 V8RuntimeAgentImplState::customObjectFormatterEnabled, false)) | 738 V8RuntimeAgentImplState::customObjectFormatterEnabled, false)) |
| 739 m_session->setCustomObjectFormatterEnabled(true); | 739 m_session->setCustomObjectFormatterEnabled(true); |
|
dgozman
2017/02/27 18:44:56
Looks like we already restore it properly.
| |
| 740 if (m_state->booleanProperty(V8RuntimeAgentImplState::preciseCoverageStarted, | 740 if (m_state->booleanProperty(V8RuntimeAgentImplState::preciseCoverageStarted, |
| 741 false)) | 741 false)) |
| 742 startPreciseCoverage(); | 742 startPreciseCoverage(); |
| 743 } | 743 } |
| 744 | 744 |
| 745 Response V8RuntimeAgentImpl::enable() { | 745 Response V8RuntimeAgentImpl::enable() { |
| 746 if (m_enabled) return Response::OK(); | 746 if (m_enabled) return Response::OK(); |
| 747 m_inspector->client()->beginEnsureAllContextsInGroup( | 747 m_inspector->client()->beginEnsureAllContextsInGroup( |
| 748 m_session->contextGroupId()); | 748 m_session->contextGroupId()); |
| 749 m_enabled = true; | 749 m_enabled = true; |
| 750 m_state->setBoolean(V8RuntimeAgentImplState::runtimeEnabled, true); | 750 m_state->setBoolean(V8RuntimeAgentImplState::runtimeEnabled, true); |
| 751 m_inspector->enableStackCapturingIfNeeded(); | 751 m_inspector->enableStackCapturingIfNeeded(); |
| 752 m_session->reportAllContexts(this); | 752 m_session->reportAllContexts(this); |
| 753 m_session->setCustomObjectFormatterEnabled(m_state->booleanProperty( | |
|
dgozman
2017/02/27 18:44:56
And we should not restore anything in enable. It j
kozy
2017/02/27 19:57:13
Ok, then we should forbid this method on disabled
| |
| 754 V8RuntimeAgentImplState::customObjectFormatterEnabled, false)); | |
| 755 | |
| 753 V8ConsoleMessageStorage* storage = | 756 V8ConsoleMessageStorage* storage = |
| 754 m_inspector->ensureConsoleMessageStorage(m_session->contextGroupId()); | 757 m_inspector->ensureConsoleMessageStorage(m_session->contextGroupId()); |
| 755 for (const auto& message : storage->messages()) { | 758 for (const auto& message : storage->messages()) { |
| 756 if (!reportMessage(message.get(), false)) break; | 759 if (!reportMessage(message.get(), false)) break; |
| 757 } | 760 } |
| 758 return Response::OK(); | 761 return Response::OK(); |
| 759 } | 762 } |
| 760 | 763 |
| 761 Response V8RuntimeAgentImpl::disable() { | 764 Response V8RuntimeAgentImpl::disable() { |
| 762 if (!m_enabled) return Response::OK(); | 765 if (!m_enabled) return Response::OK(); |
| 763 m_enabled = false; | 766 m_enabled = false; |
| 764 m_state->setBoolean(V8RuntimeAgentImplState::runtimeEnabled, false); | 767 m_state->setBoolean(V8RuntimeAgentImplState::runtimeEnabled, false); |
| 765 m_inspector->disableStackCapturingIfNeeded(); | 768 m_inspector->disableStackCapturingIfNeeded(); |
| 766 m_session->discardInjectedScripts(); | 769 m_session->discardInjectedScripts(); |
| 770 m_session->setCustomObjectFormatterEnabled(false); | |
| 767 reset(); | 771 reset(); |
| 768 m_inspector->client()->endEnsureAllContextsInGroup( | 772 m_inspector->client()->endEnsureAllContextsInGroup( |
| 769 m_session->contextGroupId()); | 773 m_session->contextGroupId()); |
| 770 stopPreciseCoverage(); | 774 stopPreciseCoverage(); |
| 771 return Response::OK(); | 775 return Response::OK(); |
| 772 } | 776 } |
| 773 | 777 |
| 774 void V8RuntimeAgentImpl::reset() { | 778 void V8RuntimeAgentImpl::reset() { |
| 775 m_compiledScripts.clear(); | 779 m_compiledScripts.clear(); |
| 776 if (m_enabled) { | 780 if (m_enabled) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 818 } | 822 } |
| 819 | 823 |
| 820 bool V8RuntimeAgentImpl::reportMessage(V8ConsoleMessage* message, | 824 bool V8RuntimeAgentImpl::reportMessage(V8ConsoleMessage* message, |
| 821 bool generatePreview) { | 825 bool generatePreview) { |
| 822 message->reportToFrontend(&m_frontend, m_session, generatePreview); | 826 message->reportToFrontend(&m_frontend, m_session, generatePreview); |
| 823 m_frontend.flush(); | 827 m_frontend.flush(); |
| 824 return m_inspector->hasConsoleMessageStorage(m_session->contextGroupId()); | 828 return m_inspector->hasConsoleMessageStorage(m_session->contextGroupId()); |
| 825 } | 829 } |
| 826 | 830 |
| 827 } // namespace v8_inspector | 831 } // namespace v8_inspector |
| OLD | NEW |