| 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 24 matching lines...) Expand all Loading... |
| 35 #include "core/dom/Node.h" | 35 #include "core/dom/Node.h" |
| 36 #include "core/dom/NodeTraversal.h" | 36 #include "core/dom/NodeTraversal.h" |
| 37 #include "core/dom/shadow/ShadowRoot.h" | 37 #include "core/dom/shadow/ShadowRoot.h" |
| 38 #include "core/frame/FrameConsole.h" | 38 #include "core/frame/FrameConsole.h" |
| 39 #include "core/frame/FrameHost.h" | 39 #include "core/frame/FrameHost.h" |
| 40 #include "core/inspector/ConsoleMessage.h" | 40 #include "core/inspector/ConsoleMessage.h" |
| 41 #include "core/inspector/ConsoleMessageStorage.h" | 41 #include "core/inspector/ConsoleMessageStorage.h" |
| 42 #include "core/inspector/InjectedScriptHost.h" | 42 #include "core/inspector/InjectedScriptHost.h" |
| 43 #include "core/inspector/InjectedScriptManager.h" | 43 #include "core/inspector/InjectedScriptManager.h" |
| 44 #include "core/inspector/InspectorDOMAgent.h" | 44 #include "core/inspector/InspectorDOMAgent.h" |
| 45 #include "core/inspector/InspectorPageAgent.h" | 45 #include "core/page/Page.h" |
| 46 #include "core/workers/WorkerInspectorProxy.h" | 46 #include "core/workers/WorkerInspectorProxy.h" |
| 47 | 47 |
| 48 namespace blink { | 48 namespace blink { |
| 49 | 49 |
| 50 int PageConsoleAgent::s_enabledAgentCount = 0; | 50 int PageConsoleAgent::s_enabledAgentCount = 0; |
| 51 | 51 |
| 52 PageConsoleAgent::PageConsoleAgent(InjectedScriptManager* injectedScriptManager,
InspectorDOMAgent* domAgent, InspectorPageAgent* pageAgent) | 52 PageConsoleAgent::PageConsoleAgent(InjectedScriptManager* injectedScriptManager,
InspectorDOMAgent* domAgent, Page* page) |
| 53 : InspectorConsoleAgent(injectedScriptManager) | 53 : InspectorConsoleAgent(injectedScriptManager) |
| 54 , m_inspectorDOMAgent(domAgent) | 54 , m_inspectorDOMAgent(domAgent) |
| 55 , m_pageAgent(pageAgent) | 55 , m_page(page) |
| 56 { | 56 { |
| 57 } | 57 } |
| 58 | 58 |
| 59 PageConsoleAgent::~PageConsoleAgent() | 59 PageConsoleAgent::~PageConsoleAgent() |
| 60 { | 60 { |
| 61 #if !ENABLE(OILPAN) | 61 #if !ENABLE(OILPAN) |
| 62 m_inspectorDOMAgent = nullptr; | 62 m_inspectorDOMAgent = nullptr; |
| 63 m_instrumentingAgents->setPageConsoleAgent(nullptr); | 63 m_instrumentingAgents->setPageConsoleAgent(nullptr); |
| 64 #endif | 64 #endif |
| 65 } | 65 } |
| 66 | 66 |
| 67 void PageConsoleAgent::trace(Visitor* visitor) | 67 void PageConsoleAgent::trace(Visitor* visitor) |
| 68 { | 68 { |
| 69 visitor->trace(m_inspectorDOMAgent); | 69 visitor->trace(m_inspectorDOMAgent); |
| 70 visitor->trace(m_pageAgent); | 70 visitor->trace(m_page); |
| 71 InspectorConsoleAgent::trace(visitor); | 71 InspectorConsoleAgent::trace(visitor); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void PageConsoleAgent::enable(ErrorString* errorString) | 74 void PageConsoleAgent::enable(ErrorString* errorString) |
| 75 { | 75 { |
| 76 InspectorConsoleAgent::enable(errorString); | 76 InspectorConsoleAgent::enable(errorString); |
| 77 m_workersWithEnabledConsole.clear(); | 77 m_workersWithEnabledConsole.clear(); |
| 78 m_instrumentingAgents->setPageConsoleAgent(this); | 78 m_instrumentingAgents->setPageConsoleAgent(this); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void PageConsoleAgent::disable(ErrorString* errorString) | 81 void PageConsoleAgent::disable(ErrorString* errorString) |
| 82 { | 82 { |
| 83 m_instrumentingAgents->setPageConsoleAgent(nullptr); | 83 m_instrumentingAgents->setPageConsoleAgent(nullptr); |
| 84 InspectorConsoleAgent::disable(errorString); | 84 InspectorConsoleAgent::disable(errorString); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void PageConsoleAgent::clearMessages(ErrorString* errorString) | 87 void PageConsoleAgent::clearMessages(ErrorString* errorString) |
| 88 { | 88 { |
| 89 m_inspectorDOMAgent->releaseDanglingNodes(); | 89 m_inspectorDOMAgent->releaseDanglingNodes(); |
| 90 messageStorage()->clear(m_pageAgent->inspectedFrame()->document()); | 90 messageStorage()->clear(m_page->deprecatedLocalMainFrame()->document()); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void PageConsoleAgent::workerConsoleAgentEnabled(WorkerGlobalScopeProxy* proxy) | 93 void PageConsoleAgent::workerConsoleAgentEnabled(WorkerGlobalScopeProxy* proxy) |
| 94 { | 94 { |
| 95 m_workersWithEnabledConsole.add(proxy); | 95 m_workersWithEnabledConsole.add(proxy); |
| 96 } | 96 } |
| 97 | 97 |
| 98 ConsoleMessageStorage* PageConsoleAgent::messageStorage() | 98 ConsoleMessageStorage* PageConsoleAgent::messageStorage() |
| 99 { | 99 { |
| 100 return &m_pageAgent->frameHost()->consoleMessageStorage(); | 100 return &m_page->frameHost().consoleMessageStorage(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void PageConsoleAgent::workerTerminated(WorkerInspectorProxy* workerInspectorPro
xy) | 103 void PageConsoleAgent::workerTerminated(WorkerInspectorProxy* workerInspectorPro
xy) |
| 104 { | 104 { |
| 105 WorkerGlobalScopeProxy* proxy = workerInspectorProxy->workerGlobalScopeProxy
(); | 105 WorkerGlobalScopeProxy* proxy = workerInspectorProxy->workerGlobalScopeProxy
(); |
| 106 if (!proxy) | 106 if (!proxy) |
| 107 return; | 107 return; |
| 108 | 108 |
| 109 HashSet<WorkerGlobalScopeProxy*>::iterator iterator = m_workersWithEnabledCo
nsole.find(proxy); | 109 HashSet<WorkerGlobalScopeProxy*>::iterator iterator = m_workersWithEnabledCo
nsole.find(proxy); |
| 110 bool workerAgentWasEnabled = iterator != m_workersWithEnabledConsole.end(); | 110 bool workerAgentWasEnabled = iterator != m_workersWithEnabledConsole.end(); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 Node& ancestor = NodeTraversal::highestAncestorOrSelf(*node); | 157 Node& ancestor = NodeTraversal::highestAncestorOrSelf(*node); |
| 158 if (!ancestor.isShadowRoot() || toShadowRoot(ancestor).type() == ShadowR
oot::AuthorShadowRoot) | 158 if (!ancestor.isShadowRoot() || toShadowRoot(ancestor).type() == ShadowR
oot::AuthorShadowRoot) |
| 159 break; | 159 break; |
| 160 // User agent shadow root, keep climbing up. | 160 // User agent shadow root, keep climbing up. |
| 161 node = toShadowRoot(ancestor).host(); | 161 node = toShadowRoot(ancestor).host(); |
| 162 } | 162 } |
| 163 m_injectedScriptManager->injectedScriptHost()->addInspectedObject(adoptPtr(n
ew InspectableNode(node))); | 163 m_injectedScriptManager->injectedScriptHost()->addInspectedObject(adoptPtr(n
ew InspectableNode(node))); |
| 164 } | 164 } |
| 165 | 165 |
| 166 } // namespace blink | 166 } // namespace blink |
| OLD | NEW |