| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 #if ENABLE(OILPAN) | |
| 68 visitor->trace(m_workersWithEnabledConsole); | |
| 69 #endif | |
| 70 InspectorConsoleAgent::trace(visitor); | 67 InspectorConsoleAgent::trace(visitor); |
| 71 } | 68 } |
| 72 | 69 |
| 73 void PageConsoleAgent::enable(ErrorString* errorString) | 70 void PageConsoleAgent::enable(ErrorString* errorString) |
| 74 { | 71 { |
| 75 InspectorConsoleAgent::enable(errorString); | 72 InspectorConsoleAgent::enable(errorString); |
| 76 m_workersWithEnabledConsole.clear(); | 73 m_workersWithEnabledConsole.clear(); |
| 77 m_instrumentingAgents->setPageConsoleAgent(this); | 74 m_instrumentingAgents->setPageConsoleAgent(this); |
| 78 } | 75 } |
| 79 | 76 |
| 80 void PageConsoleAgent::disable(ErrorString* errorString) | 77 void PageConsoleAgent::disable(ErrorString* errorString) |
| 81 { | 78 { |
| 82 m_instrumentingAgents->setPageConsoleAgent(nullptr); | 79 m_instrumentingAgents->setPageConsoleAgent(nullptr); |
| 83 InspectorConsoleAgent::disable(errorString); | 80 InspectorConsoleAgent::disable(errorString); |
| 84 } | 81 } |
| 85 | 82 |
| 86 void PageConsoleAgent::clearMessages(ErrorString* errorString) | 83 void PageConsoleAgent::clearMessages(ErrorString* errorString) |
| 87 { | 84 { |
| 88 m_inspectorDOMAgent->releaseDanglingNodes(); | 85 m_inspectorDOMAgent->releaseDanglingNodes(); |
| 89 messageStorage()->clear(m_inspectedFrames->root()->document()); | 86 messageStorage()->clear(m_inspectedFrames->root()->document()); |
| 90 } | 87 } |
| 91 | 88 |
| 92 void PageConsoleAgent::workerConsoleAgentEnabled(WorkerInspectorProxy* workerIns
pectorProxy) | 89 void PageConsoleAgent::workerConsoleAgentEnabled(WorkerGlobalScopeProxy* proxy) |
| 93 { | 90 { |
| 94 m_workersWithEnabledConsole.add(workerInspectorProxy); | 91 m_workersWithEnabledConsole.add(proxy); |
| 95 } | 92 } |
| 96 | 93 |
| 97 ConsoleMessageStorage* PageConsoleAgent::messageStorage() | 94 ConsoleMessageStorage* PageConsoleAgent::messageStorage() |
| 98 { | 95 { |
| 99 return &m_inspectedFrames->root()->host()->consoleMessageStorage(); | 96 return &m_inspectedFrames->root()->host()->consoleMessageStorage(); |
| 100 } | 97 } |
| 101 | 98 |
| 102 void PageConsoleAgent::workerTerminated(WorkerInspectorProxy* workerInspectorPro
xy) | 99 void PageConsoleAgent::workerTerminated(WorkerInspectorProxy* workerInspectorPro
xy) |
| 103 { | 100 { |
| 104 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) |
| 105 return; | 108 return; |
| 106 | 109 |
| 107 ConsoleMessageStorage* storage = messageStorage(); | 110 ConsoleMessageStorage* storage = messageStorage(); |
| 108 size_t messageCount = storage->size(); | 111 size_t messageCount = storage->size(); |
| 109 for (size_t i = 0; i < messageCount; ++i) { | 112 for (size_t i = 0; i < messageCount; ++i) { |
| 110 ConsoleMessage* message = storage->at(i); | 113 ConsoleMessage* message = storage->at(i); |
| 111 if (message->workerInspectorProxy() == workerInspectorProxy) { | 114 if (message->workerGlobalScopeProxy() == proxy) { |
| 112 message->setWorkerInspectorProxy(nullptr); | 115 message->setWorkerGlobalScopeProxy(nullptr); |
| 113 sendConsoleMessageToFrontend(message, false); | 116 sendConsoleMessageToFrontend(message, false); |
| 114 } | 117 } |
| 115 } | 118 } |
| 116 } | 119 } |
| 117 | 120 |
| 118 void PageConsoleAgent::enableStackCapturingIfNeeded() | 121 void PageConsoleAgent::enableStackCapturingIfNeeded() |
| 119 { | 122 { |
| 120 if (!s_enabledAgentCount) | 123 if (!s_enabledAgentCount) |
| 121 ScriptController::setCaptureCallStackForUncaughtExceptions(toIsolate(m_i
nspectedFrames->root()), true); | 124 ScriptController::setCaptureCallStackForUncaughtExceptions(toIsolate(m_i
nspectedFrames->root()), true); |
| 122 ++s_enabledAgentCount; | 125 ++s_enabledAgentCount; |
| 123 } | 126 } |
| 124 | 127 |
| 125 void PageConsoleAgent::disableStackCapturingIfNeeded() | 128 void PageConsoleAgent::disableStackCapturingIfNeeded() |
| 126 { | 129 { |
| 127 if (!(--s_enabledAgentCount)) | 130 if (!(--s_enabledAgentCount)) |
| 128 ScriptController::setCaptureCallStackForUncaughtExceptions(toIsolate(m_i
nspectedFrames->root()), false); | 131 ScriptController::setCaptureCallStackForUncaughtExceptions(toIsolate(m_i
nspectedFrames->root()), false); |
| 129 } | 132 } |
| 130 | 133 |
| 131 } // namespace blink | 134 } // namespace blink |
| OLD | NEW |