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

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

Issue 1622213002: DevTools: make InjectedScript heap-allocated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed protocol tests. Created 4 years, 10 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 { 125 {
126 // FIXME: what about nested objects? 126 // FIXME: what about nested objects?
127 if (frame != m_inspectedFrames->root()) 127 if (frame != m_inspectedFrames->root())
128 return; 128 return;
129 m_asyncCallTracker->resetAsyncOperations(); 129 m_asyncCallTracker->resetAsyncOperations();
130 m_v8DebuggerAgent->reset(); 130 m_v8DebuggerAgent->reset();
131 } 131 }
132 132
133 void PageDebuggerAgent::compileScript(ErrorString* errorString, const String& ex pression, const String& sourceURL, bool persistScript, int executionContextId, T ypeBuilder::OptOutput<ScriptId>* scriptId, RefPtr<ExceptionDetails>& exceptionDe tails) 133 void PageDebuggerAgent::compileScript(ErrorString* errorString, const String& ex pression, const String& sourceURL, bool persistScript, int executionContextId, T ypeBuilder::OptOutput<ScriptId>* scriptId, RefPtr<ExceptionDetails>& exceptionDe tails)
134 { 134 {
135 InjectedScript injectedScript = m_injectedScriptManager->findInjectedScript( executionContextId); 135 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (executionContextId);
136 if (injectedScript.isEmpty()) { 136 if (!injectedScript) {
137 *errorString = "Inspected frame has gone"; 137 *errorString = "Inspected frame has gone";
138 return; 138 return;
139 } 139 }
140 ExecutionContext* executionContext = injectedScript.scriptState()->execution Context(); 140 ExecutionContext* executionContext = injectedScript->scriptState()->executio nContext();
141 RefPtrWillBeRawPtr<LocalFrame> protect(toDocument(executionContext)->frame() ); 141 RefPtrWillBeRawPtr<LocalFrame> protect(toDocument(executionContext)->frame() );
142 InspectorDebuggerAgent::compileScript(errorString, expression, sourceURL, pe rsistScript, executionContextId, scriptId, exceptionDetails); 142 InspectorDebuggerAgent::compileScript(errorString, expression, sourceURL, pe rsistScript, executionContextId, scriptId, exceptionDetails);
143 if (!scriptId->isAssigned()) 143 if (!scriptId->isAssigned())
144 return; 144 return;
145 145
146 String scriptIdValue = scriptId->getValue(); 146 String scriptIdValue = scriptId->getValue();
147 if (!scriptIdValue.isEmpty()) 147 if (!scriptIdValue.isEmpty())
148 m_compiledScriptURLs.set(scriptId->getValue(), sourceURL); 148 m_compiledScriptURLs.set(scriptId->getValue(), sourceURL);
149 } 149 }
150 150
151 void PageDebuggerAgent::runScript(ErrorString* errorString, const ScriptId& scri ptId, int executionContextId, const String* const objectGroup, const bool* const doNotPauseOnExceptionsAndMuteConsole, RefPtr<RemoteObject>& result, RefPtr<Exce ptionDetails>& exceptionDetails) 151 void PageDebuggerAgent::runScript(ErrorString* errorString, const ScriptId& scri ptId, int executionContextId, const String* const objectGroup, const bool* const doNotPauseOnExceptionsAndMuteConsole, RefPtr<RemoteObject>& result, RefPtr<Exce ptionDetails>& exceptionDetails)
152 { 152 {
153 InjectedScript injectedScript = m_injectedScriptManager->findInjectedScript( executionContextId); 153 InjectedScript* injectedScript = m_injectedScriptManager->findInjectedScript (executionContextId);
154 if (injectedScript.isEmpty()) { 154 if (!injectedScript) {
155 *errorString = "Inspected frame has gone"; 155 *errorString = "Inspected frame has gone";
156 return; 156 return;
157 } 157 }
158 ExecutionContext* executionContext = injectedScript.scriptState()->execution Context(); 158 ExecutionContext* executionContext = injectedScript->scriptState()->executio nContext();
159 159
160 String sourceURL = m_compiledScriptURLs.take(scriptId); 160 String sourceURL = m_compiledScriptURLs.take(scriptId);
161 LocalFrame* frame = toDocument(executionContext)->frame(); 161 LocalFrame* frame = toDocument(executionContext)->frame();
162 TRACE_EVENT1("devtools.timeline", "EvaluateScript", "data", InspectorEvaluat eScriptEvent::data(frame, sourceURL, TextPosition::minimumPosition())); 162 TRACE_EVENT1("devtools.timeline", "EvaluateScript", "data", InspectorEvaluat eScriptEvent::data(frame, sourceURL, TextPosition::minimumPosition()));
163 163
164 RefPtrWillBeRawPtr<LocalFrame> protect(frame); 164 RefPtrWillBeRawPtr<LocalFrame> protect(frame);
165 InspectorDebuggerAgent::runScript(errorString, scriptId, executionContextId, objectGroup, doNotPauseOnExceptionsAndMuteConsole, result, exceptionDetails); 165 InspectorDebuggerAgent::runScript(errorString, scriptId, executionContextId, objectGroup, doNotPauseOnExceptionsAndMuteConsole, result, exceptionDetails);
166 166
167 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data( )); 167 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data( ));
168 } 168 }
169 169
170 } // namespace blink 170 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698