| 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 20 matching lines...) Expand all Loading... |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "core/inspector/PageConsoleAgent.h" | 32 #include "core/inspector/PageConsoleAgent.h" |
| 33 | 33 |
| 34 #include "bindings/core/v8/ScriptController.h" | 34 #include "bindings/core/v8/ScriptController.h" |
| 35 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
| 36 #include "core/frame/FrameConsole.h" | 36 #include "core/frame/FrameConsole.h" |
| 37 #include "core/frame/FrameHost.h" | 37 #include "core/frame/FrameHost.h" |
| 38 #include "core/inspector/ConsoleMessage.h" | 38 #include "core/inspector/ConsoleMessage.h" |
| 39 #include "core/inspector/ConsoleMessageStorage.h" | 39 #include "core/inspector/ConsoleMessageStorage.h" |
| 40 #include "core/inspector/InspectorDOMAgent.h" | 40 #include "core/inspector/InspectorDOMAgent.h" |
| 41 #include "core/inspector/InspectorPageAgent.h" |
| 41 #include "core/workers/WorkerInspectorProxy.h" | 42 #include "core/workers/WorkerInspectorProxy.h" |
| 42 | 43 |
| 43 namespace blink { | 44 namespace blink { |
| 44 | 45 |
| 45 int PageConsoleAgent::s_enabledAgentCount = 0; | 46 int PageConsoleAgent::s_enabledAgentCount = 0; |
| 46 | 47 |
| 47 PageConsoleAgent::PageConsoleAgent(LocalFrame* inspectedFrame, InjectedScriptMan
ager* injectedScriptManager, InspectorDOMAgent* domAgent) | 48 PageConsoleAgent::PageConsoleAgent(InjectedScriptManager* injectedScriptManager,
InspectorDOMAgent* domAgent, InspectorPageAgent* pageAgent) |
| 48 : InspectorConsoleAgent(injectedScriptManager) | 49 : InspectorConsoleAgent(injectedScriptManager) |
| 49 , m_inspectedFrame(inspectedFrame) | |
| 50 , m_inspectorDOMAgent(domAgent) | 50 , m_inspectorDOMAgent(domAgent) |
| 51 , m_pageAgent(pageAgent) |
| 51 { | 52 { |
| 52 } | 53 } |
| 53 | 54 |
| 54 PageConsoleAgent::~PageConsoleAgent() | 55 PageConsoleAgent::~PageConsoleAgent() |
| 55 { | 56 { |
| 56 #if !ENABLE(OILPAN) | 57 #if !ENABLE(OILPAN) |
| 57 m_inspectorDOMAgent = nullptr; | 58 m_inspectorDOMAgent = nullptr; |
| 58 m_instrumentingAgents->setPageConsoleAgent(nullptr); | 59 m_instrumentingAgents->setPageConsoleAgent(nullptr); |
| 59 #endif | 60 #endif |
| 60 } | 61 } |
| 61 | 62 |
| 62 DEFINE_TRACE(PageConsoleAgent) | 63 DEFINE_TRACE(PageConsoleAgent) |
| 63 { | 64 { |
| 64 visitor->trace(m_inspectedFrame); | |
| 65 visitor->trace(m_inspectorDOMAgent); | 65 visitor->trace(m_inspectorDOMAgent); |
| 66 visitor->trace(m_pageAgent); |
| 66 InspectorConsoleAgent::trace(visitor); | 67 InspectorConsoleAgent::trace(visitor); |
| 67 } | 68 } |
| 68 | 69 |
| 69 void PageConsoleAgent::enable(ErrorString* errorString) | 70 void PageConsoleAgent::enable(ErrorString* errorString) |
| 70 { | 71 { |
| 71 InspectorConsoleAgent::enable(errorString); | 72 InspectorConsoleAgent::enable(errorString); |
| 72 m_workersWithEnabledConsole.clear(); | 73 m_workersWithEnabledConsole.clear(); |
| 73 m_instrumentingAgents->setPageConsoleAgent(this); | 74 m_instrumentingAgents->setPageConsoleAgent(this); |
| 74 } | 75 } |
| 75 | 76 |
| 76 void PageConsoleAgent::disable(ErrorString* errorString) | 77 void PageConsoleAgent::disable(ErrorString* errorString) |
| 77 { | 78 { |
| 78 m_instrumentingAgents->setPageConsoleAgent(nullptr); | 79 m_instrumentingAgents->setPageConsoleAgent(nullptr); |
| 79 InspectorConsoleAgent::disable(errorString); | 80 InspectorConsoleAgent::disable(errorString); |
| 80 } | 81 } |
| 81 | 82 |
| 82 void PageConsoleAgent::clearMessages(ErrorString* errorString) | 83 void PageConsoleAgent::clearMessages(ErrorString* errorString) |
| 83 { | 84 { |
| 84 m_inspectorDOMAgent->releaseDanglingNodes(); | 85 m_inspectorDOMAgent->releaseDanglingNodes(); |
| 85 messageStorage()->clear(m_inspectedFrame->document()); | 86 messageStorage()->clear(m_pageAgent->inspectedFrame()->document()); |
| 86 } | 87 } |
| 87 | 88 |
| 88 void PageConsoleAgent::workerConsoleAgentEnabled(WorkerGlobalScopeProxy* proxy) | 89 void PageConsoleAgent::workerConsoleAgentEnabled(WorkerGlobalScopeProxy* proxy) |
| 89 { | 90 { |
| 90 m_workersWithEnabledConsole.add(proxy); | 91 m_workersWithEnabledConsole.add(proxy); |
| 91 } | 92 } |
| 92 | 93 |
| 93 ConsoleMessageStorage* PageConsoleAgent::messageStorage() | 94 ConsoleMessageStorage* PageConsoleAgent::messageStorage() |
| 94 { | 95 { |
| 95 return &m_inspectedFrame->host()->consoleMessageStorage(); | 96 return &m_pageAgent->frameHost()->consoleMessageStorage(); |
| 96 } | 97 } |
| 97 | 98 |
| 98 void PageConsoleAgent::workerTerminated(WorkerInspectorProxy* workerInspectorPro
xy) | 99 void PageConsoleAgent::workerTerminated(WorkerInspectorProxy* workerInspectorPro
xy) |
| 99 { | 100 { |
| 100 WorkerGlobalScopeProxy* proxy = workerInspectorProxy->workerGlobalScopeProxy
(); | 101 WorkerGlobalScopeProxy* proxy = workerInspectorProxy->workerGlobalScopeProxy
(); |
| 101 if (!proxy) | 102 if (!proxy) |
| 102 return; | 103 return; |
| 103 | 104 |
| 104 HashSet<WorkerGlobalScopeProxy*>::iterator iterator = m_workersWithEnabledCo
nsole.find(proxy); | 105 HashSet<WorkerGlobalScopeProxy*>::iterator iterator = m_workersWithEnabledCo
nsole.find(proxy); |
| 105 bool workerAgentWasEnabled = iterator != m_workersWithEnabledConsole.end(); | 106 bool workerAgentWasEnabled = iterator != m_workersWithEnabledConsole.end(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 124 ++s_enabledAgentCount; | 125 ++s_enabledAgentCount; |
| 125 } | 126 } |
| 126 | 127 |
| 127 void PageConsoleAgent::disableStackCapturingIfNeeded() | 128 void PageConsoleAgent::disableStackCapturingIfNeeded() |
| 128 { | 129 { |
| 129 if (!(--s_enabledAgentCount)) | 130 if (!(--s_enabledAgentCount)) |
| 130 ScriptController::setCaptureCallStackForUncaughtExceptions(false); | 131 ScriptController::setCaptureCallStackForUncaughtExceptions(false); |
| 131 } | 132 } |
| 132 | 133 |
| 133 } // namespace blink | 134 } // namespace blink |
| OLD | NEW |