OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 3 * |
| 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are |
| 6 * met: |
| 7 * |
| 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above |
| 11 * copyright notice, this list of conditions and the following disclaimer |
| 12 * in the documentation and/or other materials provided with the |
| 13 * distribution. |
| 14 * * Neither the name of Google Inc. nor the names of its |
| 15 * contributors may be used to endorse or promote products derived from |
| 16 * this software without specific prior written permission. |
| 17 * |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ |
| 30 |
| 31 #include "config.h" |
| 32 #include "bindings/core/dart/DartPageDebuggerAgent.h" |
| 33 |
| 34 #include "bindings/core/dart/DartScriptDebugServer.h" |
| 35 #include "bindings/core/v8/DOMWrapperWorld.h" |
| 36 #include "bindings/core/v8/ScriptController.h" |
| 37 #include "bindings/core/v8/ScriptSourceCode.h" |
| 38 #include "core/frame/FrameConsole.h" |
| 39 #include "core/frame/LocalFrame.h" |
| 40 #include "core/inspector/InspectorOverlay.h" |
| 41 #include "core/inspector/InspectorPageAgent.h" |
| 42 #include "core/inspector/InstrumentingAgents.h" |
| 43 #include "core/loader/DocumentLoader.h" |
| 44 #include "core/page/Page.h" |
| 45 |
| 46 namespace blink { |
| 47 |
| 48 PassOwnPtrWillBeRawPtr<DartPageDebuggerAgent> DartPageDebuggerAgent::create(Dart
ScriptDebugServer* scriptDebugServer, InspectorDebuggerAgent* debuggerAgent, Ins
pectorPageAgent* pageAgent, DartInjectedScriptManager* injectedScriptManager, In
spectorOverlay* overlay) |
| 49 { |
| 50 return adoptPtrWillBeNoop(new DartPageDebuggerAgent(scriptDebugServer, debug
gerAgent, pageAgent, injectedScriptManager, overlay)); |
| 51 } |
| 52 |
| 53 DartPageDebuggerAgent::DartPageDebuggerAgent(DartScriptDebugServer* scriptDebugS
erver, InspectorDebuggerAgent* debuggerAgent, InspectorPageAgent* pageAgent, Dar
tInjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay) |
| 54 : DartInspectorDebuggerAgent(injectedScriptManager, debuggerAgent, pageAgent
) |
| 55 , m_scriptDebugServer(scriptDebugServer) |
| 56 , m_overlay(overlay) |
| 57 { |
| 58 scriptDebugServer->setInjectedScriptManager(injectedScriptManager); |
| 59 ASSERT(m_scriptDebugServer); |
| 60 m_overlay->overlayHost()->setListener(this); |
| 61 } |
| 62 |
| 63 DartPageDebuggerAgent::~DartPageDebuggerAgent() |
| 64 { |
| 65 } |
| 66 |
| 67 void DartPageDebuggerAgent::startListeningScriptDebugServer() |
| 68 { |
| 69 m_scriptDebugServer->addListener(this, m_pageAgent->page()); |
| 70 } |
| 71 |
| 72 void DartPageDebuggerAgent::stopListeningScriptDebugServer() |
| 73 { |
| 74 m_scriptDebugServer->removeListener(this, m_pageAgent->page()); |
| 75 } |
| 76 |
| 77 DartScriptDebugServer& DartPageDebuggerAgent::scriptDebugServer() |
| 78 { |
| 79 return *m_scriptDebugServer; |
| 80 } |
| 81 |
| 82 void DartPageDebuggerAgent::muteConsole() |
| 83 { |
| 84 FrameConsole::mute(); |
| 85 } |
| 86 |
| 87 void DartPageDebuggerAgent::unmuteConsole() |
| 88 { |
| 89 FrameConsole::unmute(); |
| 90 } |
| 91 |
| 92 void DartPageDebuggerAgent::overlayResumed() |
| 93 { |
| 94 ErrorString error; |
| 95 resume(&error); |
| 96 } |
| 97 |
| 98 void DartPageDebuggerAgent::overlaySteppedOver() |
| 99 { |
| 100 ErrorString error; |
| 101 stepOver(&error); |
| 102 } |
| 103 |
| 104 DartInjectedScript* DartPageDebuggerAgent::injectedScriptForEval(ErrorString* er
rorString, const int* executionContextId) |
| 105 { |
| 106 ASSERT(executionContextId); |
| 107 DartInjectedScript* injectedScript = injectedScriptManager()->injectedScript
ForId(*executionContextId); |
| 108 if (!injectedScript) |
| 109 *errorString = "Execution context with given id not found."; |
| 110 return injectedScript; |
| 111 } |
| 112 |
| 113 void DartPageDebuggerAgent::setOverlayMessage(ErrorString*, const String* messag
e) |
| 114 { |
| 115 m_overlay->setPausedInDebuggerMessage(message); |
| 116 } |
| 117 |
| 118 void DartPageDebuggerAgent::didClearDocumentOfWindowObject(LocalFrame* frame) |
| 119 { |
| 120 if (frame != m_pageAgent->mainFrame()) |
| 121 return; |
| 122 |
| 123 reset(); |
| 124 } |
| 125 |
| 126 void DartPageDebuggerAgent::didCommitLoad(LocalFrame* frame, DocumentLoader* loa
der) |
| 127 { |
| 128 Frame* mainFrame = frame->page()->deprecatedLocalMainFrame(); |
| 129 if (loader->frame() == mainFrame) |
| 130 pageDidCommitLoad(); |
| 131 } |
| 132 |
| 133 } // namespace blink |
| 134 |
OLD | NEW |