Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: Source/core/inspector/PageDebuggerAgent.cpp

Issue 300393002: Merge DevTools Refactor CL to Blink36 (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/1985
Patch Set: PTAL Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/inspector/PageDebuggerAgent.h ('k') | Source/core/inspector/PageRuntimeAgent.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 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. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
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/dart/DartScriptDebugServer.h"
34 #include "bindings/v8/DOMWrapperWorld.h" 35 #include "bindings/v8/DOMWrapperWorld.h"
35 #include "bindings/v8/ScriptController.h" 36 #include "bindings/v8/ScriptController.h"
36 #include "bindings/v8/ScriptSourceCode.h" 37 #include "bindings/v8/ScriptSourceCode.h"
37 #include "core/frame/FrameConsole.h" 38 #include "core/frame/FrameConsole.h"
38 #include "core/frame/LocalFrame.h" 39 #include "core/frame/LocalFrame.h"
39 #include "core/inspector/InspectorOverlay.h" 40 #include "core/inspector/InspectorOverlay.h"
40 #include "core/inspector/InspectorPageAgent.h" 41 #include "core/inspector/InspectorPageAgent.h"
41 #include "core/inspector/InstrumentingAgents.h" 42 #include "core/inspector/InstrumentingAgents.h"
42 #include "core/loader/DocumentLoader.h" 43 #include "core/loader/DocumentLoader.h"
43 #include "core/page/Page.h" 44 #include "core/page/Page.h"
44 45
45 namespace WebCore { 46 namespace WebCore {
46 47
47 PassOwnPtr<PageDebuggerAgent> PageDebuggerAgent::create(PageScriptDebugServer* p ageScriptDebugServer, InspectorPageAgent* pageAgent, InjectedScriptManager* inje ctedScriptManager, InspectorOverlay* overlay) 48 PassOwnPtr<PageDebuggerAgent> PageDebuggerAgent::create(UnifiedScriptDebugServer * unifiedScriptDebugServer, InspectorPageAgent* pageAgent, InjectedScriptManager * injectedScriptManager, InspectorOverlay* overlay)
48 { 49 {
49 return adoptPtr(new PageDebuggerAgent(pageScriptDebugServer, pageAgent, inje ctedScriptManager, overlay)); 50 return adoptPtr(new PageDebuggerAgent(unifiedScriptDebugServer, pageAgent, i njectedScriptManager, overlay));
50 } 51 }
51 52
52 PageDebuggerAgent::PageDebuggerAgent(PageScriptDebugServer* pageScriptDebugServe r, InspectorPageAgent* pageAgent, InjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay) 53 PageDebuggerAgent::PageDebuggerAgent(UnifiedScriptDebugServer* unifiedScriptDebu gServer, InspectorPageAgent* pageAgent, InjectedScriptManager* injectedScriptMan ager, InspectorOverlay* overlay)
53 : InspectorDebuggerAgent(injectedScriptManager) 54 : InspectorDebuggerAgent(injectedScriptManager)
54 , m_pageScriptDebugServer(pageScriptDebugServer) 55 , m_unifiedScriptDebugServer(unifiedScriptDebugServer)
55 , m_pageAgent(pageAgent) 56 , m_pageAgent(pageAgent)
56 , m_overlay(overlay) 57 , m_overlay(overlay)
57 { 58 {
59 ASSERT(m_unifiedScriptDebugServer);
58 m_overlay->overlayHost()->setListener(this); 60 m_overlay->overlayHost()->setListener(this);
59 } 61 }
60 62
61 PageDebuggerAgent::~PageDebuggerAgent() 63 PageDebuggerAgent::~PageDebuggerAgent()
62 { 64 {
63 } 65 }
64 66
65 void PageDebuggerAgent::enable() 67 void PageDebuggerAgent::enable()
66 { 68 {
67 InspectorDebuggerAgent::enable(); 69 InspectorDebuggerAgent::enable();
68 m_instrumentingAgents->setPageDebuggerAgent(this); 70 m_instrumentingAgents->setPageDebuggerAgent(this);
69 } 71 }
70 72
71 void PageDebuggerAgent::disable() 73 void PageDebuggerAgent::disable()
72 { 74 {
73 InspectorDebuggerAgent::disable(); 75 InspectorDebuggerAgent::disable();
74 m_instrumentingAgents->setPageDebuggerAgent(0); 76 m_instrumentingAgents->setPageDebuggerAgent(0);
75 } 77 }
76 78
77 void PageDebuggerAgent::startListeningScriptDebugServer() 79 void PageDebuggerAgent::startListeningScriptDebugServer()
78 { 80 {
79 scriptDebugServer().addListener(this, m_pageAgent->page()); 81 m_unifiedScriptDebugServer->addListener(this, m_pageAgent->page());
80 } 82 }
81 83
82 void PageDebuggerAgent::stopListeningScriptDebugServer() 84 void PageDebuggerAgent::stopListeningScriptDebugServer()
83 { 85 {
84 scriptDebugServer().removeListener(this, m_pageAgent->page()); 86 m_unifiedScriptDebugServer->removeListener(this, m_pageAgent->page());
85 } 87 }
86 88
87 PageScriptDebugServer& PageDebuggerAgent::scriptDebugServer() 89 ScriptDebugServerBase& PageDebuggerAgent::scriptDebugServer()
88 { 90 {
89 return *m_pageScriptDebugServer; 91 return *m_unifiedScriptDebugServer;
90 } 92 }
91 93
92 void PageDebuggerAgent::muteConsole() 94 void PageDebuggerAgent::muteConsole()
93 { 95 {
94 FrameConsole::mute(); 96 FrameConsole::mute();
95 } 97 }
96 98
97 void PageDebuggerAgent::unmuteConsole() 99 void PageDebuggerAgent::unmuteConsole()
98 { 100 {
99 FrameConsole::unmute(); 101 FrameConsole::unmute();
100 } 102 }
101 103
102 void PageDebuggerAgent::overlayResumed() 104 void PageDebuggerAgent::overlayResumed()
103 { 105 {
104 ErrorString error; 106 ErrorString error;
105 resume(&error); 107 resume(&error);
106 } 108 }
107 109
108 void PageDebuggerAgent::overlaySteppedOver() 110 void PageDebuggerAgent::overlaySteppedOver()
109 { 111 {
110 ErrorString error; 112 ErrorString error;
111 stepOver(&error, 0); 113 stepOver(&error, 0);
112 } 114 }
113 115
114 InjectedScript PageDebuggerAgent::injectedScriptForEval(ErrorString* errorString , const int* executionContextId) 116 InjectedScript& PageDebuggerAgent::injectedScriptForEval(ErrorString* errorStrin g, const int* executionContextId)
115 { 117 {
116 if (!executionContextId) { 118 if (!executionContextId) {
117 ScriptState* scriptState = V8ScriptState::forMainWorld(m_pageAgent->main Frame()); 119 ScriptState* scriptState = V8ScriptState::forMainWorld(m_pageAgent->main Frame());
118 return injectedScriptManager()->injectedScriptFor(scriptState); 120 return injectedScriptManager()->injectedScriptFor(scriptState);
119 } 121 }
120 InjectedScript injectedScript = injectedScriptManager()->injectedScriptForId (*executionContextId); 122 InjectedScript& injectedScript = injectedScriptManager()->injectedScriptForI d(*executionContextId);
121 if (injectedScript.isEmpty()) 123 if (injectedScript.isEmpty())
122 *errorString = "Execution context with given id not found."; 124 *errorString = "Execution context with given id not found.";
123 return injectedScript; 125 return injectedScript;
124 } 126 }
125 127
126 void PageDebuggerAgent::setOverlayMessage(ErrorString*, const String* message) 128 void PageDebuggerAgent::setOverlayMessage(ErrorString*, const String* message)
127 { 129 {
128 m_overlay->setPausedInDebuggerMessage(message); 130 m_overlay->setPausedInDebuggerMessage(message);
129 } 131 }
130 132
131 void PageDebuggerAgent::didClearDocumentOfWindowObject(LocalFrame* frame) 133 void PageDebuggerAgent::didClearDocumentOfWindowObject(LocalFrame* frame)
132 { 134 {
133 if (frame != m_pageAgent->mainFrame()) 135 if (frame != m_pageAgent->mainFrame())
134 return; 136 return;
135 137
136 reset(); 138 reset();
137 139
138 scriptDebugServer().setPreprocessorSource(String()); 140 scriptDebugServer().setPreprocessorSource(String());
139 ASSERT(m_pageAgent); 141 ASSERT(m_pageAgent);
140 if (!m_pageAgent->scriptPreprocessorSource().isEmpty()) 142 if (!m_pageAgent->scriptPreprocessorSource().isEmpty())
141 scriptDebugServer().setPreprocessorSource(m_pageAgent->scriptPreprocesso rSource()); 143 scriptDebugServer().setPreprocessorSource(m_pageAgent->scriptPreprocesso rSource());
142 } 144 }
143 145
144 String PageDebuggerAgent::preprocessEventListener(LocalFrame* frame, const Strin g& source, const String& url, const String& functionName) 146 String PageDebuggerAgent::preprocessEventListener(LocalFrame* frame, const Strin g& source, const String& url, const String& functionName)
145 { 147 {
146 ASSERT(frame); 148 ASSERT(frame);
147 ASSERT(m_pageScriptDebugServer); 149 return m_unifiedScriptDebugServer->preprocessEventListener(frame, source, ur l, functionName);
148 return m_pageScriptDebugServer->preprocessEventListener(frame, source, url, functionName);
149 } 150 }
150 151
151 PassOwnPtr<ScriptSourceCode> PageDebuggerAgent::preprocess(LocalFrame* frame, co nst ScriptSourceCode& sourceCode) 152 PassOwnPtr<ScriptSourceCode> PageDebuggerAgent::preprocess(LocalFrame* frame, co nst ScriptSourceCode& sourceCode)
152 { 153 {
153 ASSERT(m_pageScriptDebugServer);
154 ASSERT(frame); 154 ASSERT(frame);
155 return m_pageScriptDebugServer->preprocess(frame, sourceCode); 155 return m_unifiedScriptDebugServer->preprocess(frame, sourceCode);
156 } 156 }
157 157
158 void PageDebuggerAgent::didCommitLoad(LocalFrame* frame, DocumentLoader* loader) 158 void PageDebuggerAgent::didCommitLoad(LocalFrame* frame, DocumentLoader* loader)
159 { 159 {
160 LocalFrame* mainFrame = frame->page()->mainFrame(); 160 LocalFrame* mainFrame = frame->page()->mainFrame();
161 if (loader->frame() == mainFrame) 161 if (loader->frame() == mainFrame)
162 pageDidCommitLoad(); 162 pageDidCommitLoad();
163 } 163 }
164 164
165 } // namespace WebCore 165 } // namespace WebCore
166 166
OLDNEW
« no previous file with comments | « Source/core/inspector/PageDebuggerAgent.h ('k') | Source/core/inspector/PageRuntimeAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698