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

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

Issue 1286343003: DevTools: make InspectorDebuggerAgent aggregate V8DebuggerAgent instead of inheriting (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed dgozman's comments Created 5 years, 4 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
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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 void PageDebuggerAgent::overlaySteppedOver() 130 void PageDebuggerAgent::overlaySteppedOver()
131 { 131 {
132 ErrorString error; 132 ErrorString error;
133 stepOver(&error); 133 stepOver(&error);
134 } 134 }
135 135
136 InjectedScript PageDebuggerAgent::defaultInjectedScript() 136 InjectedScript PageDebuggerAgent::defaultInjectedScript()
137 { 137 {
138 ScriptState* scriptState = ScriptState::forMainWorld(m_pageAgent->inspectedF rame()); 138 ScriptState* scriptState = ScriptState::forMainWorld(m_pageAgent->inspectedF rame());
139 return injectedScriptManager()->injectedScriptFor(scriptState); 139 return m_v8DebuggerAgent->injectedScriptManager()->injectedScriptFor(scriptS tate);
140 } 140 }
141 141
142 void PageDebuggerAgent::didStartProvisionalLoad(LocalFrame* frame) 142 void PageDebuggerAgent::didStartProvisionalLoad(LocalFrame* frame)
143 { 143 {
144 if (frame == m_pageAgent->inspectedFrame()) { 144 if (frame == m_pageAgent->inspectedFrame()) {
145 ErrorString error; 145 ErrorString error;
146 resume(&error); 146 resume(&error);
147 } 147 }
148 } 148 }
149 149
150 void PageDebuggerAgent::didClearDocumentOfWindowObject(LocalFrame* frame) 150 void PageDebuggerAgent::didClearDocumentOfWindowObject(LocalFrame* frame)
151 { 151 {
152 // FIXME: what about nested objects? 152 // FIXME: what about nested objects?
153 if (frame != m_pageAgent->inspectedFrame()) 153 if (frame != m_pageAgent->inspectedFrame())
154 return; 154 return;
155 reset(); 155 m_v8DebuggerAgent->reset();
156 } 156 }
157 157
158 void PageDebuggerAgent::compileScript(ErrorString* errorString, const String& ex pression, const String& sourceURL, bool persistScript, const int* executionConte xtId, TypeBuilder::OptOutput<ScriptId>* scriptId, RefPtr<ExceptionDetails>& exce ptionDetails) 158 void PageDebuggerAgent::compileScript(ErrorString* errorString, const String& ex pression, const String& sourceURL, bool persistScript, const int* executionConte xtId, TypeBuilder::OptOutput<ScriptId>* scriptId, RefPtr<ExceptionDetails>& exce ptionDetails)
159 { 159 {
160 InjectedScript injectedScript = injectedScriptForEval(errorString, execution ContextId); 160 InjectedScript injectedScript = m_v8DebuggerAgent->injectedScriptForEval(err orString, executionContextId);
161 if (injectedScript.isEmpty()) { 161 if (injectedScript.isEmpty()) {
162 *errorString = "Inspected frame has gone"; 162 *errorString = "Inspected frame has gone";
163 return; 163 return;
164 } 164 }
165 ExecutionContext* executionContext = injectedScript.scriptState()->execution Context(); 165 ExecutionContext* executionContext = injectedScript.scriptState()->execution Context();
166 RefPtrWillBeRawPtr<LocalFrame> protect(toDocument(executionContext)->frame() ); 166 RefPtrWillBeRawPtr<LocalFrame> protect(toDocument(executionContext)->frame() );
167 InspectorDebuggerAgent::compileScript(errorString, expression, sourceURL, pe rsistScript, executionContextId, scriptId, exceptionDetails); 167 InspectorDebuggerAgent::compileScript(errorString, expression, sourceURL, pe rsistScript, executionContextId, scriptId, exceptionDetails);
168 if (!scriptId->isAssigned()) 168 if (!scriptId->isAssigned())
169 return; 169 return;
170 170
171 String scriptIdValue = scriptId->getValue(); 171 String scriptIdValue = scriptId->getValue();
172 if (!scriptIdValue.isEmpty()) 172 if (!scriptIdValue.isEmpty())
173 m_compiledScriptURLs.set(scriptId->getValue(), sourceURL); 173 m_compiledScriptURLs.set(scriptId->getValue(), sourceURL);
174 } 174 }
175 175
176 void PageDebuggerAgent::runScript(ErrorString* errorString, const ScriptId& scri ptId, const int* executionContextId, const String* const objectGroup, const bool * const doNotPauseOnExceptionsAndMuteConsole, RefPtr<RemoteObject>& result, RefP tr<ExceptionDetails>& exceptionDetails) 176 void PageDebuggerAgent::runScript(ErrorString* errorString, const ScriptId& scri ptId, const int* executionContextId, const String* const objectGroup, const bool * const doNotPauseOnExceptionsAndMuteConsole, RefPtr<RemoteObject>& result, RefP tr<ExceptionDetails>& exceptionDetails)
177 { 177 {
178 InjectedScript injectedScript = injectedScriptForEval(errorString, execution ContextId); 178 InjectedScript injectedScript = m_v8DebuggerAgent->injectedScriptForEval(err orString, executionContextId);
179 if (injectedScript.isEmpty()) { 179 if (injectedScript.isEmpty()) {
180 *errorString = "Inspected frame has gone"; 180 *errorString = "Inspected frame has gone";
181 return; 181 return;
182 } 182 }
183 ExecutionContext* executionContext = injectedScript.scriptState()->execution Context(); 183 ExecutionContext* executionContext = injectedScript.scriptState()->execution Context();
184 184
185 String sourceURL = m_compiledScriptURLs.take(scriptId); 185 String sourceURL = m_compiledScriptURLs.take(scriptId);
186 LocalFrame* frame = toDocument(executionContext)->frame(); 186 LocalFrame* frame = toDocument(executionContext)->frame();
187 TRACE_EVENT1("devtools.timeline", "EvaluateScript", "data", InspectorEvaluat eScriptEvent::data(frame, sourceURL, TextPosition::minimumPosition().m_line.oneB asedInt())); 187 TRACE_EVENT1("devtools.timeline", "EvaluateScript", "data", InspectorEvaluat eScriptEvent::data(frame, sourceURL, TextPosition::minimumPosition().m_line.oneB asedInt()));
188 InspectorInstrumentationCookie cookie; 188 InspectorInstrumentationCookie cookie;
189 if (frame) 189 if (frame)
190 cookie = InspectorInstrumentation::willEvaluateScript(frame, sourceURL, TextPosition::minimumPosition().m_line.oneBasedInt()); 190 cookie = InspectorInstrumentation::willEvaluateScript(frame);
191 191
192 RefPtrWillBeRawPtr<LocalFrame> protect(frame); 192 RefPtrWillBeRawPtr<LocalFrame> protect(frame);
193 InspectorDebuggerAgent::runScript(errorString, scriptId, executionContextId, objectGroup, doNotPauseOnExceptionsAndMuteConsole, result, exceptionDetails); 193 InspectorDebuggerAgent::runScript(errorString, scriptId, executionContextId, objectGroup, doNotPauseOnExceptionsAndMuteConsole, result, exceptionDetails);
194 194
195 if (frame) 195 if (frame)
196 InspectorInstrumentation::didEvaluateScript(cookie); 196 InspectorInstrumentation::didEvaluateScript(cookie);
197 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data( )); 197 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data( ));
198 198
199 } 199 }
200 200
201 } // namespace blink 201 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorInstrumentation.idl ('k') | Source/core/inspector/V8DebuggerAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698