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

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

Issue 15806013: Use V8ScriptRunner::callInternalFunction in PageScriptDebugServer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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 | « no previous file | no next file » | 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 19 matching lines...) Expand all
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "bindings/v8/PageScriptDebugServer.h" 32 #include "bindings/v8/PageScriptDebugServer.h"
33 33
34 34
35 #include "V8DOMWindow.h" 35 #include "V8DOMWindow.h"
36 #include "bindings/v8/ScriptController.h" 36 #include "bindings/v8/ScriptController.h"
37 #include "bindings/v8/V8Binding.h" 37 #include "bindings/v8/V8Binding.h"
38 #include "bindings/v8/V8DOMWindowShell.h" 38 #include "bindings/v8/V8DOMWindowShell.h"
39 #include "bindings/v8/V8RecursionScope.h" 39 #include "bindings/v8/V8RecursionScope.h"
40 #include "bindings/v8/V8ScriptRunner.h"
40 #include "core/inspector/InspectorInstrumentation.h" 41 #include "core/inspector/InspectorInstrumentation.h"
41 #include "core/inspector/ScriptDebugListener.h" 42 #include "core/inspector/ScriptDebugListener.h"
42 #include "core/page/Frame.h" 43 #include "core/page/Frame.h"
43 #include "core/page/Page.h" 44 #include "core/page/Page.h"
44 #include "wtf/OwnPtr.h" 45 #include "wtf/OwnPtr.h"
45 #include "wtf/PassOwnPtr.h" 46 #include "wtf/PassOwnPtr.h"
46 #include "wtf/StdLibExtras.h" 47 #include "wtf/StdLibExtras.h"
47 48
48 namespace WebCore { 49 namespace WebCore {
49 50
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 v8::Debug::SetDebugEventListener2(&PageScriptDebugServer::v8DebugEventCa llback, v8::External::New(this)); 93 v8::Debug::SetDebugEventListener2(&PageScriptDebugServer::v8DebugEventCa llback, v8::External::New(this));
93 } 94 }
94 m_listenersMap.set(page, listener); 95 m_listenersMap.set(page, listener);
95 96
96 V8DOMWindowShell* shell = scriptController->existingWindowShell(mainThreadNo rmalWorld()); 97 V8DOMWindowShell* shell = scriptController->existingWindowShell(mainThreadNo rmalWorld());
97 if (!shell || !shell->isContextInitialized()) 98 if (!shell || !shell->isContextInitialized())
98 return; 99 return;
99 v8::Local<v8::Context> context = shell->context(); 100 v8::Local<v8::Context> context = shell->context();
100 v8::Handle<v8::Function> getScriptsFunction = v8::Local<v8::Function>::Cast( m_debuggerScript.get()->Get(v8::String::NewSymbol("getScripts"))); 101 v8::Handle<v8::Function> getScriptsFunction = v8::Local<v8::Function>::Cast( m_debuggerScript.get()->Get(v8::String::NewSymbol("getScripts")));
101 v8::Handle<v8::Value> argv[] = { context->GetEmbedderData(0) }; 102 v8::Handle<v8::Value> argv[] = { context->GetEmbedderData(0) };
102 v8::Handle<v8::Value> value; 103 v8::Handle<v8::Value> value = V8ScriptRunner::callInternalFunction(getScript sFunction, context, m_debuggerScript.get(), 1, argv, m_isolate);
abarth-chromium 2013/05/28 17:47:08 I'd use WTF_ARRAY_LENGTH macro rather than hard-co
103 {
104 V8RecursionScope::MicrotaskSuppression scope;
105 value = getScriptsFunction->Call(m_debuggerScript.get(), 1, argv);
106 }
107 if (value.IsEmpty()) 104 if (value.IsEmpty())
108 return; 105 return;
109 ASSERT(!value->IsUndefined() && value->IsArray()); 106 ASSERT(!value->IsUndefined() && value->IsArray());
110 v8::Handle<v8::Array> scriptsArray = v8::Handle<v8::Array>::Cast(value); 107 v8::Handle<v8::Array> scriptsArray = v8::Handle<v8::Array>::Cast(value);
111 for (unsigned i = 0; i < scriptsArray->Length(); ++i) 108 for (unsigned i = 0; i < scriptsArray->Length(); ++i)
112 dispatchDidParseSource(listener, v8::Handle<v8::Object>::Cast(scriptsArr ay->Get(v8Integer(i, context->GetIsolate())))); 109 dispatchDidParseSource(listener, v8::Handle<v8::Object>::Cast(scriptsArr ay->Get(v8Integer(i, context->GetIsolate()))));
113 } 110 }
114 111
115 void PageScriptDebugServer::removeListener(ScriptDebugListener* listener, Page* page) 112 void PageScriptDebugServer::removeListener(ScriptDebugListener* listener, Page* page)
116 { 113 {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 185
189 m_pausedPage = 0; 186 m_pausedPage = 0;
190 } 187 }
191 188
192 void PageScriptDebugServer::quitMessageLoopOnPause() 189 void PageScriptDebugServer::quitMessageLoopOnPause()
193 { 190 {
194 m_clientMessageLoop->quitNow(); 191 m_clientMessageLoop->quitNow();
195 } 192 }
196 193
197 } // namespace WebCore 194 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698