| 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/PageDebuggerAgent.h" | 32 #include "core/inspector/PageDebuggerAgent.h" |
| 33 | 33 |
| 34 #include "bindings/core/v8/DOMWrapperWorld.h" | 34 #include "bindings/core/v8/DOMWrapperWorld.h" |
| 35 #include "bindings/core/v8/ScriptController.h" | 35 #include "bindings/core/v8/ScriptController.h" |
| 36 #include "bindings/core/v8/ScriptSourceCode.h" | 36 #include "bindings/core/v8/ScriptSourceCode.h" |
| 37 #include "core/frame/FrameConsole.h" | 37 #include "core/frame/FrameConsole.h" |
| 38 #include "core/frame/LocalFrame.h" | 38 #include "core/frame/LocalFrame.h" |
| 39 #include "core/inspector/InjectedScript.h" | 39 #include "core/inspector/InjectedScript.h" |
| 40 #include "core/inspector/InspectorOverlay.h" | 40 #include "core/inspector/InspectorOverlay.h" |
| 41 #include "core/inspector/InspectorPageAgent.h" | |
| 42 #include "core/inspector/InstrumentingAgents.h" | 41 #include "core/inspector/InstrumentingAgents.h" |
| 43 #include "core/loader/DocumentLoader.h" | 42 #include "core/loader/DocumentLoader.h" |
| 44 #include "core/page/Page.h" | 43 #include "core/page/Page.h" |
| 45 | 44 |
| 46 namespace blink { | 45 namespace blink { |
| 47 | 46 |
| 48 PassOwnPtrWillBeRawPtr<PageDebuggerAgent> PageDebuggerAgent::create(PageScriptDe
bugServer* pageScriptDebugServer, InspectorPageAgent* pageAgent, InjectedScriptM
anager* injectedScriptManager, InspectorOverlay* overlay, int debuggerId) | 47 PassOwnPtrWillBeRawPtr<PageDebuggerAgent> PageDebuggerAgent::create(LocalFrame*
inspectedFrame, PageScriptDebugServer* pageScriptDebugServer, InjectedScriptMana
ger* injectedScriptManager, InspectorOverlay* overlay, int debuggerId) |
| 49 { | 48 { |
| 50 return adoptPtrWillBeNoop(new PageDebuggerAgent(pageScriptDebugServer, pageA
gent, injectedScriptManager, overlay, debuggerId)); | 49 return adoptPtrWillBeNoop(new PageDebuggerAgent(inspectedFrame, pageScriptDe
bugServer, injectedScriptManager, overlay, debuggerId)); |
| 51 } | 50 } |
| 52 | 51 |
| 53 PageDebuggerAgent::PageDebuggerAgent(PageScriptDebugServer* pageScriptDebugServe
r, InspectorPageAgent* pageAgent, InjectedScriptManager* injectedScriptManager,
InspectorOverlay* overlay, int debuggerId) | 52 PageDebuggerAgent::PageDebuggerAgent(LocalFrame* inspectedFrame, PageScriptDebug
Server* pageScriptDebugServer, InjectedScriptManager* injectedScriptManager, Ins
pectorOverlay* overlay, int debuggerId) |
| 54 : InspectorDebuggerAgent(injectedScriptManager) | 53 : InspectorDebuggerAgent(injectedScriptManager) |
| 54 , m_inspectedFrame(inspectedFrame) |
| 55 , m_pageScriptDebugServer(pageScriptDebugServer) | 55 , m_pageScriptDebugServer(pageScriptDebugServer) |
| 56 , m_pageAgent(pageAgent) | |
| 57 , m_overlay(overlay) | 56 , m_overlay(overlay) |
| 58 , m_debuggerId(debuggerId) | 57 , m_debuggerId(debuggerId) |
| 59 { | 58 { |
| 60 m_overlay->setListener(this); | 59 m_overlay->setListener(this); |
| 61 } | 60 } |
| 62 | 61 |
| 63 PageDebuggerAgent::~PageDebuggerAgent() | 62 PageDebuggerAgent::~PageDebuggerAgent() |
| 64 { | 63 { |
| 65 } | 64 } |
| 66 | 65 |
| 67 DEFINE_TRACE(PageDebuggerAgent) | 66 DEFINE_TRACE(PageDebuggerAgent) |
| 68 { | 67 { |
| 68 visitor->trace(m_inspectedFrame); |
| 69 visitor->trace(m_pageScriptDebugServer); | 69 visitor->trace(m_pageScriptDebugServer); |
| 70 visitor->trace(m_pageAgent); | |
| 71 visitor->trace(m_overlay); | 70 visitor->trace(m_overlay); |
| 72 InspectorDebuggerAgent::trace(visitor); | 71 InspectorDebuggerAgent::trace(visitor); |
| 73 } | 72 } |
| 74 | 73 |
| 75 void PageDebuggerAgent::enable() | 74 void PageDebuggerAgent::enable() |
| 76 { | 75 { |
| 77 InspectorDebuggerAgent::enable(); | 76 InspectorDebuggerAgent::enable(); |
| 78 m_instrumentingAgents->setPageDebuggerAgent(this); | 77 m_instrumentingAgents->setPageDebuggerAgent(this); |
| 79 } | 78 } |
| 80 | 79 |
| 81 void PageDebuggerAgent::disable() | 80 void PageDebuggerAgent::disable() |
| 82 { | 81 { |
| 83 InspectorDebuggerAgent::disable(); | 82 InspectorDebuggerAgent::disable(); |
| 84 m_instrumentingAgents->setPageDebuggerAgent(0); | 83 m_instrumentingAgents->setPageDebuggerAgent(0); |
| 85 } | 84 } |
| 86 | 85 |
| 87 void PageDebuggerAgent::startListeningScriptDebugServer() | 86 void PageDebuggerAgent::startListeningScriptDebugServer() |
| 88 { | 87 { |
| 89 scriptDebugServer().addListener(this, m_pageAgent->inspectedFrame(), m_debug
gerId); | 88 scriptDebugServer().addListener(this, m_inspectedFrame, m_debuggerId); |
| 90 } | 89 } |
| 91 | 90 |
| 92 void PageDebuggerAgent::stopListeningScriptDebugServer() | 91 void PageDebuggerAgent::stopListeningScriptDebugServer() |
| 93 { | 92 { |
| 94 scriptDebugServer().removeListener(this, m_pageAgent->inspectedFrame()); | 93 scriptDebugServer().removeListener(this, m_inspectedFrame); |
| 95 } | 94 } |
| 96 | 95 |
| 97 PageScriptDebugServer& PageDebuggerAgent::scriptDebugServer() | 96 PageScriptDebugServer& PageDebuggerAgent::scriptDebugServer() |
| 98 { | 97 { |
| 99 return *m_pageScriptDebugServer; | 98 return *m_pageScriptDebugServer; |
| 100 } | 99 } |
| 101 | 100 |
| 102 void PageDebuggerAgent::muteConsole() | 101 void PageDebuggerAgent::muteConsole() |
| 103 { | 102 { |
| 104 FrameConsole::mute(); | 103 FrameConsole::mute(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 117 | 116 |
| 118 void PageDebuggerAgent::overlaySteppedOver() | 117 void PageDebuggerAgent::overlaySteppedOver() |
| 119 { | 118 { |
| 120 ErrorString error; | 119 ErrorString error; |
| 121 stepOver(&error); | 120 stepOver(&error); |
| 122 } | 121 } |
| 123 | 122 |
| 124 InjectedScript PageDebuggerAgent::injectedScriptForEval(ErrorString* errorString
, const int* executionContextId) | 123 InjectedScript PageDebuggerAgent::injectedScriptForEval(ErrorString* errorString
, const int* executionContextId) |
| 125 { | 124 { |
| 126 if (!executionContextId) { | 125 if (!executionContextId) { |
| 127 ScriptState* scriptState = ScriptState::forMainWorld(m_pageAgent->inspec
tedFrame()); | 126 ScriptState* scriptState = ScriptState::forMainWorld(m_inspectedFrame); |
| 128 InjectedScript result = injectedScriptManager()->injectedScriptFor(scrip
tState); | 127 InjectedScript result = injectedScriptManager()->injectedScriptFor(scrip
tState); |
| 129 if (result.isEmpty()) | 128 if (result.isEmpty()) |
| 130 *errorString = "Internal error: main world execution context not fou
nd."; | 129 *errorString = "Internal error: main world execution context not fou
nd."; |
| 131 return result; | 130 return result; |
| 132 } | 131 } |
| 133 InjectedScript injectedScript = injectedScriptManager()->injectedScriptForId
(*executionContextId); | 132 InjectedScript injectedScript = injectedScriptManager()->injectedScriptForId
(*executionContextId); |
| 134 if (injectedScript.isEmpty()) | 133 if (injectedScript.isEmpty()) |
| 135 *errorString = "Execution context with given id not found."; | 134 *errorString = "Execution context with given id not found."; |
| 136 return injectedScript; | 135 return injectedScript; |
| 137 } | 136 } |
| 138 | 137 |
| 139 void PageDebuggerAgent::didStartProvisionalLoad(LocalFrame* frame) | 138 void PageDebuggerAgent::didStartProvisionalLoad(LocalFrame* frame) |
| 140 { | 139 { |
| 141 if (frame == m_pageAgent->inspectedFrame()) { | 140 if (frame == m_inspectedFrame) { |
| 142 ErrorString error; | 141 ErrorString error; |
| 143 resume(&error); | 142 resume(&error); |
| 144 } | 143 } |
| 145 } | 144 } |
| 146 | 145 |
| 147 void PageDebuggerAgent::didClearDocumentOfWindowObject(LocalFrame* frame) | 146 void PageDebuggerAgent::didClearDocumentOfWindowObject(LocalFrame* frame) |
| 148 { | 147 { |
| 149 // FIXME: what about nested objects? | 148 // FIXME: what about nested objects? |
| 150 if (frame != m_pageAgent->inspectedFrame()) | 149 if (frame != m_inspectedFrame) |
| 151 return; | 150 return; |
| 152 reset(); | 151 reset(); |
| 153 } | 152 } |
| 154 | 153 |
| 155 void PageDebuggerAgent::didCommitLoadForLocalFrame(LocalFrame*) | 154 void PageDebuggerAgent::didCommitLoadForLocalFrame(LocalFrame*) |
| 156 { | 155 { |
| 157 resetModifiedSources(); | 156 resetModifiedSources(); |
| 158 } | 157 } |
| 159 | 158 |
| 160 } // namespace blink | 159 } // namespace blink |
| OLD | NEW |