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

Side by Side Diff: third_party/WebKit/Source/core/inspector/PageConsoleAgent.cpp

Issue 1777323004: Revert of [DevTools] Remove extra plumbing from InspectorWorkerAgent, prepare to multi-client. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #if !ENABLE(OILPAN) 57 #if !ENABLE(OILPAN)
58 m_inspectorDOMAgent = nullptr; 58 m_inspectorDOMAgent = nullptr;
59 m_instrumentingAgents->setPageConsoleAgent(nullptr); 59 m_instrumentingAgents->setPageConsoleAgent(nullptr);
60 #endif 60 #endif
61 } 61 }
62 62
63 DEFINE_TRACE(PageConsoleAgent) 63 DEFINE_TRACE(PageConsoleAgent)
64 { 64 {
65 visitor->trace(m_inspectorDOMAgent); 65 visitor->trace(m_inspectorDOMAgent);
66 visitor->trace(m_inspectedFrames); 66 visitor->trace(m_inspectedFrames);
67 visitor->trace(m_workersWithEnabledConsole);
68 InspectorConsoleAgent::trace(visitor); 67 InspectorConsoleAgent::trace(visitor);
69 } 68 }
70 69
71 void PageConsoleAgent::enable(ErrorString* errorString) 70 void PageConsoleAgent::enable(ErrorString* errorString)
72 { 71 {
73 InspectorConsoleAgent::enable(errorString); 72 InspectorConsoleAgent::enable(errorString);
74 m_workersWithEnabledConsole.clear(); 73 m_workersWithEnabledConsole.clear();
75 m_instrumentingAgents->setPageConsoleAgent(this); 74 m_instrumentingAgents->setPageConsoleAgent(this);
76 } 75 }
77 76
78 void PageConsoleAgent::disable(ErrorString* errorString) 77 void PageConsoleAgent::disable(ErrorString* errorString)
79 { 78 {
80 m_instrumentingAgents->setPageConsoleAgent(nullptr); 79 m_instrumentingAgents->setPageConsoleAgent(nullptr);
81 InspectorConsoleAgent::disable(errorString); 80 InspectorConsoleAgent::disable(errorString);
82 } 81 }
83 82
84 void PageConsoleAgent::clearMessages(ErrorString* errorString) 83 void PageConsoleAgent::clearMessages(ErrorString* errorString)
85 { 84 {
86 m_inspectorDOMAgent->releaseDanglingNodes(); 85 m_inspectorDOMAgent->releaseDanglingNodes();
87 messageStorage()->clear(m_inspectedFrames->root()->document()); 86 messageStorage()->clear(m_inspectedFrames->root()->document());
88 } 87 }
89 88
90 void PageConsoleAgent::workerConsoleAgentEnabled(WorkerInspectorProxy* workerIns pectorProxy) 89 void PageConsoleAgent::workerConsoleAgentEnabled(WorkerGlobalScopeProxy* proxy)
91 { 90 {
92 m_workersWithEnabledConsole.add(workerInspectorProxy); 91 m_workersWithEnabledConsole.add(proxy);
93 } 92 }
94 93
95 ConsoleMessageStorage* PageConsoleAgent::messageStorage() 94 ConsoleMessageStorage* PageConsoleAgent::messageStorage()
96 { 95 {
97 return &m_inspectedFrames->root()->host()->consoleMessageStorage(); 96 return &m_inspectedFrames->root()->host()->consoleMessageStorage();
98 } 97 }
99 98
100 void PageConsoleAgent::workerTerminated(WorkerInspectorProxy* workerInspectorPro xy) 99 void PageConsoleAgent::workerTerminated(WorkerInspectorProxy* workerInspectorPro xy)
101 { 100 {
102 if (m_workersWithEnabledConsole.find(workerInspectorProxy) != m_workersWithE nabledConsole.end()) 101 WorkerGlobalScopeProxy* proxy = workerInspectorProxy->workerGlobalScopeProxy ();
102 if (!proxy)
103 return;
104
105 HashSet<WorkerGlobalScopeProxy*>::iterator iterator = m_workersWithEnabledCo nsole.find(proxy);
106 bool workerAgentWasEnabled = iterator != m_workersWithEnabledConsole.end();
107 if (workerAgentWasEnabled)
103 return; 108 return;
104 109
105 ConsoleMessageStorage* storage = messageStorage(); 110 ConsoleMessageStorage* storage = messageStorage();
106 size_t messageCount = storage->size(); 111 size_t messageCount = storage->size();
107 for (size_t i = 0; i < messageCount; ++i) { 112 for (size_t i = 0; i < messageCount; ++i) {
108 ConsoleMessage* message = storage->at(i); 113 ConsoleMessage* message = storage->at(i);
109 if (message->workerInspectorProxy() == workerInspectorProxy) { 114 if (message->workerGlobalScopeProxy() == proxy) {
110 message->setWorkerInspectorProxy(nullptr); 115 message->setWorkerGlobalScopeProxy(nullptr);
111 sendConsoleMessageToFrontend(message, false); 116 sendConsoleMessageToFrontend(message, false);
112 } 117 }
113 } 118 }
114 } 119 }
115 120
116 void PageConsoleAgent::enableStackCapturingIfNeeded() 121 void PageConsoleAgent::enableStackCapturingIfNeeded()
117 { 122 {
118 if (!s_enabledAgentCount) 123 if (!s_enabledAgentCount)
119 ScriptController::setCaptureCallStackForUncaughtExceptions(toIsolate(m_i nspectedFrames->root()), true); 124 ScriptController::setCaptureCallStackForUncaughtExceptions(toIsolate(m_i nspectedFrames->root()), true);
120 ++s_enabledAgentCount; 125 ++s_enabledAgentCount;
121 } 126 }
122 127
123 void PageConsoleAgent::disableStackCapturingIfNeeded() 128 void PageConsoleAgent::disableStackCapturingIfNeeded()
124 { 129 {
125 if (!(--s_enabledAgentCount)) 130 if (!(--s_enabledAgentCount))
126 ScriptController::setCaptureCallStackForUncaughtExceptions(toIsolate(m_i nspectedFrames->root()), false); 131 ScriptController::setCaptureCallStackForUncaughtExceptions(toIsolate(m_i nspectedFrames->root()), false);
127 } 132 }
128 133
129 } // namespace blink 134 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698