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

Side by Side Diff: sky/engine/v8_inspector/PageScriptDebugServer.cpp

Issue 764573002: Parametrize PageScriptDebugServer with v8::Context -> InspectorHost resolver (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Removed Page::m_inspectorHost Created 6 years 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 void PageScriptDebugServer::interruptAndRun(PassOwnPtr<Task> task) 154 void PageScriptDebugServer::interruptAndRun(PassOwnPtr<Task> task)
155 { 155 {
156 ScriptDebugServer::interruptAndRun(task, s_mainThreadIsolate); 156 ScriptDebugServer::interruptAndRun(task, s_mainThreadIsolate);
157 } 157 }
158 158
159 void PageScriptDebugServer::setClientMessageLoop(PassOwnPtr<ClientMessageLoop> c lientMessageLoop) 159 void PageScriptDebugServer::setClientMessageLoop(PassOwnPtr<ClientMessageLoop> c lientMessageLoop)
160 { 160 {
161 m_clientMessageLoop = clientMessageLoop; 161 m_clientMessageLoop = clientMessageLoop;
162 } 162 }
163 163
164 void PageScriptDebugServer::setInspectorHostResolver(PassOwnPtr<InspectorHostRes olver> resolver)
165 {
166 m_inspectorHostResolver = resolver;
167 }
168
164 void PageScriptDebugServer::compileScript(ScriptState* scriptState, const String & expression, const String& sourceURL, String* scriptId, String* exceptionDetail sText, int* lineNumber, int* columnNumber, RefPtr<ScriptCallStack>* stackTrace) 169 void PageScriptDebugServer::compileScript(ScriptState* scriptState, const String & expression, const String& sourceURL, String* scriptId, String* exceptionDetail sText, int* lineNumber, int* columnNumber, RefPtr<ScriptCallStack>* stackTrace)
165 { 170 {
166 ExecutionContext* executionContext = scriptState->executionContext(); 171 ExecutionContext* executionContext = scriptState->executionContext();
167 RefPtr<LocalFrame> protect = executionContext->executingWindow()->frame(); 172 RefPtr<LocalFrame> protect = executionContext->executingWindow()->frame();
168 ScriptDebugServer::compileScript(scriptState, expression, sourceURL, scriptI d, exceptionDetailsText, lineNumber, columnNumber, stackTrace); 173 ScriptDebugServer::compileScript(scriptState, expression, sourceURL, scriptI d, exceptionDetailsText, lineNumber, columnNumber, stackTrace);
169 if (!scriptId->isNull()) 174 if (!scriptId->isNull())
170 m_compiledScriptURLs.set(*scriptId, sourceURL); 175 m_compiledScriptURLs.set(*scriptId, sourceURL);
171 } 176 }
172 177
173 void PageScriptDebugServer::clearCompiledScripts() 178 void PageScriptDebugServer::clearCompiledScripts()
(...skipping 12 matching lines...) Expand all
186 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current CallStack()); 191 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current CallStack());
187 192
188 RefPtr<LocalFrame> protect = frame; 193 RefPtr<LocalFrame> protect = frame;
189 ScriptDebugServer::runScript(scriptState, scriptId, result, wasThrown, excep tionDetailsText, lineNumber, columnNumber, stackTrace); 194 ScriptDebugServer::runScript(scriptState, scriptId, result, wasThrown, excep tionDetailsText, lineNumber, columnNumber, stackTrace);
190 195
191 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update Counters", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorUpdateCountersEvent::data ()); 196 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update Counters", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorUpdateCountersEvent::data ());
192 } 197 }
193 198
194 ScriptDebugListener* PageScriptDebugServer::getDebugListenerForContext(v8::Handl e<v8::Context> context) 199 ScriptDebugListener* PageScriptDebugServer::getDebugListenerForContext(v8::Handl e<v8::Context> context)
195 { 200 {
196 v8::HandleScope scope(m_isolate); 201 inspector::InspectorHost* inspectorHost = m_inspectorHostResolver->inspector HostFor(context);
197 LocalFrame* frame = retrieveFrameWithGlobalObjectCheck(context); 202 if (!inspectorHost)
198 if (!frame)
199 return 0; 203 return 0;
200 return m_listenersMap.get(frame->page()->inspectorHost()); 204 return m_listenersMap.get(inspectorHost);
201 } 205 }
202 206
203 void PageScriptDebugServer::runMessageLoopOnPause(v8::Handle<v8::Context> contex t) 207 void PageScriptDebugServer::runMessageLoopOnPause(v8::Handle<v8::Context> contex t)
204 { 208 {
205 v8::HandleScope scope(m_isolate); 209 m_pausedHost = m_inspectorHostResolver->inspectorHostFor(context);
206 LocalFrame* frame = retrieveFrameWithGlobalObjectCheck(context); 210 ASSERT(m_pausedHost);
207 m_pausedHost = frame->page()->inspectorHost();
208 211
209 // Wait for continue or step command. 212 // Wait for continue or step command.
210 m_clientMessageLoop->run(m_pausedHost); 213 m_clientMessageLoop->run(m_pausedHost);
211 214
212 // The listener may have been removed in the nested loop. 215 // The listener may have been removed in the nested loop.
213 if (ScriptDebugListener* listener = m_listenersMap.get(m_pausedHost)) 216 if (ScriptDebugListener* listener = m_listenersMap.get(m_pausedHost))
214 listener->didContinue(); 217 listener->didContinue();
215 218
216 m_pausedHost = 0; 219 m_pausedHost = 0;
217 } 220 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 UseCounter::muteForInspector(); 309 UseCounter::muteForInspector();
307 } 310 }
308 311
309 void PageScriptDebugServer::unmuteWarningsAndDeprecations() 312 void PageScriptDebugServer::unmuteWarningsAndDeprecations()
310 { 313 {
311 FrameConsole::unmute(); 314 FrameConsole::unmute();
312 UseCounter::unmuteForInspector(); 315 UseCounter::unmuteForInspector();
313 } 316 }
314 317
315 } // namespace blink 318 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/v8_inspector/PageScriptDebugServer.h ('k') | sky/engine/v8_inspector/inspector_backend_mojo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698