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

Side by Side Diff: Source/bindings/v8/PageScriptDebugServer.cpp

Issue 33523002: Have Frame::script() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 1 month 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/bindings/v8/NPV8Object.cpp ('k') | Source/bindings/v8/ScheduledAction.cpp » ('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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 84
85 PageScriptDebugServer::PageScriptDebugServer() 85 PageScriptDebugServer::PageScriptDebugServer()
86 : ScriptDebugServer(v8::Isolate::GetCurrent()) 86 : ScriptDebugServer(v8::Isolate::GetCurrent())
87 , m_pausedPage(0) 87 , m_pausedPage(0)
88 { 88 {
89 } 89 }
90 90
91 void PageScriptDebugServer::addListener(ScriptDebugListener* listener, Page* pag e) 91 void PageScriptDebugServer::addListener(ScriptDebugListener* listener, Page* pag e)
92 { 92 {
93 ScriptController* scriptController = page->mainFrame()->script(); 93 ScriptController& scriptController = page->mainFrame()->script();
94 if (!scriptController->canExecuteScripts(NotAboutToExecuteScript)) 94 if (!scriptController.canExecuteScripts(NotAboutToExecuteScript))
95 return; 95 return;
96 96
97 v8::HandleScope scope(m_isolate); 97 v8::HandleScope scope(m_isolate);
98 v8::Local<v8::Context> debuggerContext = v8::Debug::GetDebugContext(); 98 v8::Local<v8::Context> debuggerContext = v8::Debug::GetDebugContext();
99 v8::Context::Scope contextScope(debuggerContext); 99 v8::Context::Scope contextScope(debuggerContext);
100 100
101 v8::Local<v8::Object> debuggerScript = m_debuggerScript.newLocal(m_isolate); 101 v8::Local<v8::Object> debuggerScript = m_debuggerScript.newLocal(m_isolate);
102 if (!m_listenersMap.size()) { 102 if (!m_listenersMap.size()) {
103 ensureDebuggerScriptCompiled(); 103 ensureDebuggerScriptCompiled();
104 ASSERT(!debuggerScript->IsUndefined()); 104 ASSERT(!debuggerScript->IsUndefined());
105 v8::Debug::SetDebugEventListener2(&PageScriptDebugServer::v8DebugEventCa llback, v8::External::New(this)); 105 v8::Debug::SetDebugEventListener2(&PageScriptDebugServer::v8DebugEventCa llback, v8::External::New(this));
106 } 106 }
107 m_listenersMap.set(page, listener); 107 m_listenersMap.set(page, listener);
108 108
109 V8WindowShell* shell = scriptController->existingWindowShell(mainThreadNorma lWorld()); 109 V8WindowShell* shell = scriptController.existingWindowShell(mainThreadNormal World());
110 if (!shell || !shell->isContextInitialized()) 110 if (!shell || !shell->isContextInitialized())
111 return; 111 return;
112 v8::Local<v8::Context> context = shell->context(); 112 v8::Local<v8::Context> context = shell->context();
113 v8::Handle<v8::Function> getScriptsFunction = v8::Local<v8::Function>::Cast( debuggerScript->Get(v8::String::NewSymbol("getScripts"))); 113 v8::Handle<v8::Function> getScriptsFunction = v8::Local<v8::Function>::Cast( debuggerScript->Get(v8::String::NewSymbol("getScripts")));
114 v8::Handle<v8::Value> argv[] = { context->GetEmbedderData(0) }; 114 v8::Handle<v8::Value> argv[] = { context->GetEmbedderData(0) };
115 v8::Handle<v8::Value> value = V8ScriptRunner::callInternalFunction(getScript sFunction, debuggerScript, WTF_ARRAY_LENGTH(argv), argv, m_isolate); 115 v8::Handle<v8::Value> value = V8ScriptRunner::callInternalFunction(getScript sFunction, debuggerScript, WTF_ARRAY_LENGTH(argv), argv, m_isolate);
116 if (value.IsEmpty()) 116 if (value.IsEmpty())
117 return; 117 return;
118 ASSERT(!value->IsUndefined() && value->IsArray()); 118 ASSERT(!value->IsUndefined() && value->IsArray());
119 v8::Handle<v8::Array> scriptsArray = v8::Handle<v8::Array>::Cast(value); 119 v8::Handle<v8::Array> scriptsArray = v8::Handle<v8::Array>::Cast(value);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 271
272 String PageScriptDebugServer::preprocessEventListener(Frame* frame, const String & source, const String& url, const String& functionName) 272 String PageScriptDebugServer::preprocessEventListener(Frame* frame, const String & source, const String& url, const String& functionName)
273 { 273 {
274 if (!canPreprocess(frame)) 274 if (!canPreprocess(frame))
275 return source; 275 return source;
276 276
277 return m_scriptPreprocessor->preprocessSourceCode(source, url, functionName) ; 277 return m_scriptPreprocessor->preprocessSourceCode(source, url, functionName) ;
278 } 278 }
279 279
280 } // namespace WebCore 280 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/NPV8Object.cpp ('k') | Source/bindings/v8/ScheduledAction.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698