Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(818)

Side by Side Diff: src/inspector/v8-runtime-agent-impl.cc

Issue 2713023004: [inspector] added reconnect method for tests (Closed)
Patch Set: addressed comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 } 658 }
658 659
659 Response V8RuntimeAgentImpl::enable() { 660 Response V8RuntimeAgentImpl::enable() {
660 if (m_enabled) return Response::OK(); 661 if (m_enabled) return Response::OK();
661 m_inspector->client()->beginEnsureAllContextsInGroup( 662 m_inspector->client()->beginEnsureAllContextsInGroup(
662 m_session->contextGroupId()); 663 m_session->contextGroupId());
663 m_enabled = true; 664 m_enabled = true;
664 m_state->setBoolean(V8RuntimeAgentImplState::runtimeEnabled, true); 665 m_state->setBoolean(V8RuntimeAgentImplState::runtimeEnabled, true);
665 m_inspector->enableStackCapturingIfNeeded(); 666 m_inspector->enableStackCapturingIfNeeded();
666 m_session->reportAllContexts(this); 667 m_session->reportAllContexts(this);
668
667 V8ConsoleMessageStorage* storage = 669 V8ConsoleMessageStorage* storage =
668 m_inspector->ensureConsoleMessageStorage(m_session->contextGroupId()); 670 m_inspector->ensureConsoleMessageStorage(m_session->contextGroupId());
669 for (const auto& message : storage->messages()) { 671 for (const auto& message : storage->messages()) {
670 if (!reportMessage(message.get(), false)) break; 672 if (!reportMessage(message.get(), false)) break;
671 } 673 }
672 return Response::OK(); 674 return Response::OK();
673 } 675 }
674 676
675 Response V8RuntimeAgentImpl::disable() { 677 Response V8RuntimeAgentImpl::disable() {
676 if (!m_enabled) return Response::OK(); 678 if (!m_enabled) return Response::OK();
677 m_enabled = false; 679 m_enabled = false;
678 m_state->setBoolean(V8RuntimeAgentImplState::runtimeEnabled, false); 680 m_state->setBoolean(V8RuntimeAgentImplState::runtimeEnabled, false);
679 m_inspector->disableStackCapturingIfNeeded(); 681 m_inspector->disableStackCapturingIfNeeded();
680 m_session->discardInjectedScripts(); 682 m_session->discardInjectedScripts();
683 m_session->setCustomObjectFormatterEnabled(false);
dgozman 2017/02/28 19:46:40 Nice one!
681 reset(); 684 reset();
682 m_inspector->client()->endEnsureAllContextsInGroup( 685 m_inspector->client()->endEnsureAllContextsInGroup(
683 m_session->contextGroupId()); 686 m_session->contextGroupId());
684 return Response::OK(); 687 return Response::OK();
685 } 688 }
686 689
687 void V8RuntimeAgentImpl::reset() { 690 void V8RuntimeAgentImpl::reset() {
688 m_compiledScripts.clear(); 691 m_compiledScripts.clear();
689 if (m_enabled) { 692 if (m_enabled) {
690 if (const V8InspectorImpl::ContextByIdMap* contexts = 693 if (const V8InspectorImpl::ContextByIdMap* contexts =
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 } 734 }
732 735
733 bool V8RuntimeAgentImpl::reportMessage(V8ConsoleMessage* message, 736 bool V8RuntimeAgentImpl::reportMessage(V8ConsoleMessage* message,
734 bool generatePreview) { 737 bool generatePreview) {
735 message->reportToFrontend(&m_frontend, m_session, generatePreview); 738 message->reportToFrontend(&m_frontend, m_session, generatePreview);
736 m_frontend.flush(); 739 m_frontend.flush();
737 return m_inspector->hasConsoleMessageStorage(m_session->contextGroupId()); 740 return m_inspector->hasConsoleMessageStorage(m_session->contextGroupId());
738 } 741 }
739 742
740 } // namespace v8_inspector 743 } // namespace v8_inspector
OLDNEW
« no previous file with comments | « no previous file | test/inspector/console/memory-setter-in-strict-mode.js » ('j') | test/inspector/runtime/runtime-restore.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698