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

Side by Side Diff: Source/core/inspector/InspectorDOMDebuggerAgent.cpp

Issue 1285133005: DevTools: unflake DOM debugger tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « Source/core/inspector/InspectorDOMDebuggerAgent.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 visitor->trace(m_domAgent); 114 visitor->trace(m_domAgent);
115 visitor->trace(m_debuggerAgent); 115 visitor->trace(m_debuggerAgent);
116 #if ENABLE(OILPAN) 116 #if ENABLE(OILPAN)
117 visitor->trace(m_domBreakpoints); 117 visitor->trace(m_domBreakpoints);
118 #endif 118 #endif
119 InspectorBaseAgent::trace(visitor); 119 InspectorBaseAgent::trace(visitor);
120 } 120 }
121 121
122 void InspectorDOMDebuggerAgent::disable(ErrorString*) 122 void InspectorDOMDebuggerAgent::disable(ErrorString*)
123 { 123 {
124 m_instrumentingAgents->setInspectorDOMDebuggerAgent(nullptr); 124 setEnabled(false);
125 m_domBreakpoints.clear(); 125 m_domBreakpoints.clear();
126 m_state->remove(DOMDebuggerAgentState::eventListenerBreakpoints); 126 m_state->remove(DOMDebuggerAgentState::eventListenerBreakpoints);
127 m_state->remove(DOMDebuggerAgentState::xhrBreakpoints); 127 m_state->remove(DOMDebuggerAgentState::xhrBreakpoints);
128 m_state->remove(DOMDebuggerAgentState::pauseOnAllXHRs); 128 m_state->remove(DOMDebuggerAgentState::pauseOnAllXHRs);
129 } 129 }
130 130
131 void InspectorDOMDebuggerAgent::restore() 131 void InspectorDOMDebuggerAgent::restore()
132 { 132 {
133 if (m_state->getBoolean(DOMDebuggerAgentState::enabled)) 133 if (m_state->getBoolean(DOMDebuggerAgentState::enabled))
134 m_instrumentingAgents->setInspectorDOMDebuggerAgent(this); 134 m_instrumentingAgents->setInspectorDOMDebuggerAgent(this);
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 RefPtr<JSONObject> eventData = JSONObject::create(); 627 RefPtr<JSONObject> eventData = JSONObject::create();
628 eventData->setString("breakpointURL", breakpointURL); 628 eventData->setString("breakpointURL", breakpointURL);
629 eventData->setString("url", url); 629 eventData->setString("url", url);
630 m_debuggerAgent->breakProgram(InspectorFrontend::Debugger::Reason::XHR, even tData.release()); 630 m_debuggerAgent->breakProgram(InspectorFrontend::Debugger::Reason::XHR, even tData.release());
631 } 631 }
632 632
633 void InspectorDOMDebuggerAgent::didAddBreakpoint() 633 void InspectorDOMDebuggerAgent::didAddBreakpoint()
634 { 634 {
635 if (m_state->getBoolean(DOMDebuggerAgentState::enabled)) 635 if (m_state->getBoolean(DOMDebuggerAgentState::enabled))
636 return; 636 return;
637 m_instrumentingAgents->setInspectorDOMDebuggerAgent(this); 637 setEnabled(true);
638 m_state->setBoolean(DOMDebuggerAgentState::enabled, true);
639 } 638 }
640 639
641 static bool isEmpty(PassRefPtr<JSONObject> object) 640 static bool isEmpty(PassRefPtr<JSONObject> object)
642 { 641 {
643 return object->begin() == object->end(); 642 return object->begin() == object->end();
644 } 643 }
645 644
646 void InspectorDOMDebuggerAgent::didRemoveBreakpoint() 645 void InspectorDOMDebuggerAgent::didRemoveBreakpoint()
647 { 646 {
648 if (!m_domBreakpoints.isEmpty()) 647 if (!m_domBreakpoints.isEmpty())
649 return; 648 return;
650 if (!isEmpty(m_state->getObject(DOMDebuggerAgentState::eventListenerBreakpoi nts))) 649 if (!isEmpty(m_state->getObject(DOMDebuggerAgentState::eventListenerBreakpoi nts)))
651 return; 650 return;
652 if (!isEmpty(m_state->getObject(DOMDebuggerAgentState::xhrBreakpoints))) 651 if (!isEmpty(m_state->getObject(DOMDebuggerAgentState::xhrBreakpoints)))
653 return; 652 return;
654 if (m_state->getBoolean(DOMDebuggerAgentState::pauseOnAllXHRs)) 653 if (m_state->getBoolean(DOMDebuggerAgentState::pauseOnAllXHRs))
655 return; 654 return;
656 m_state->remove(DOMDebuggerAgentState::enabled); 655 setEnabled(false);
657 m_instrumentingAgents->setInspectorDOMDebuggerAgent(nullptr); 656 }
657
658 void InspectorDOMDebuggerAgent::setEnabled(bool enabled)
659 {
660 if (enabled) {
661 m_instrumentingAgents->setInspectorDOMDebuggerAgent(this);
662 m_state->setBoolean(DOMDebuggerAgentState::enabled, true);
663 } else {
664 m_state->remove(DOMDebuggerAgentState::enabled);
665 m_instrumentingAgents->setInspectorDOMDebuggerAgent(nullptr);
666 }
658 } 667 }
659 668
660 } // namespace blink 669 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorDOMDebuggerAgent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698