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

Side by Side Diff: Source/bindings/core/v8/ScriptDebugServer.cpp

Issue 1036803002: binidngs: Make callInternalFunction return MaybeLocal (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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 | « Source/bindings/core/v8/NPV8Object.cpp ('k') | Source/bindings/core/v8/ScriptRegexp.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) 2010-2011 Google Inc. All rights reserved. 2 * Copyright (c) 2010-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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 private: 74 private:
75 Mutex m_mutex; 75 Mutex m_mutex;
76 Deque<OwnPtr<Task>> m_queue; 76 Deque<OwnPtr<Task>> m_queue;
77 }; 77 };
78 78
79 v8::Local<v8::Value> ScriptDebugServer::callDebuggerMethod(const char* functionN ame, int argc, v8::Local<v8::Value> argv[]) 79 v8::Local<v8::Value> ScriptDebugServer::callDebuggerMethod(const char* functionN ame, int argc, v8::Local<v8::Value> argv[])
80 { 80 {
81 v8::Local<v8::Object> debuggerScript = debuggerScriptLocal(); 81 v8::Local<v8::Object> debuggerScript = debuggerScriptLocal();
82 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(debuggerScr ipt->Get(v8InternalizedString(functionName))); 82 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(debuggerScr ipt->Get(v8InternalizedString(functionName)));
83 ASSERT(m_isolate->InContext()); 83 ASSERT(m_isolate->InContext());
84 return V8ScriptRunner::callInternalFunction(function, debuggerScript, argc, argv, m_isolate); 84 return V8ScriptRunner::callInternalFunction(function, debuggerScript, argc, argv, m_isolate).ToLocalChecked();
85 } 85 }
86 86
87 ScriptDebugServer::ScriptDebugServer(v8::Isolate* isolate) 87 ScriptDebugServer::ScriptDebugServer(v8::Isolate* isolate)
88 : m_isolate(isolate) 88 : m_isolate(isolate)
89 , m_breakpointsActivated(true) 89 , m_breakpointsActivated(true)
90 , m_compiledScripts(isolate) 90 , m_compiledScripts(isolate)
91 , m_runningNestedMessageLoop(false) 91 , m_runningNestedMessageLoop(false)
92 , m_taskQueue(adoptPtr(new ThreadSafeTaskQueue)) 92 , m_taskQueue(adoptPtr(new ThreadSafeTaskQueue))
93 { 93 {
94 } 94 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 void ScriptDebugServer::reportCompiledScripts(const String& contextDebugDataSubs tring, ScriptDebugListener* listener) 133 void ScriptDebugServer::reportCompiledScripts(const String& contextDebugDataSubs tring, ScriptDebugListener* listener)
134 { 134 {
135 v8::HandleScope scope(m_isolate); 135 v8::HandleScope scope(m_isolate);
136 v8::Local<v8::Context> debuggerContext = v8::Debug::GetDebugContext(); 136 v8::Local<v8::Context> debuggerContext = v8::Debug::GetDebugContext();
137 v8::Context::Scope contextScope(debuggerContext); 137 v8::Context::Scope contextScope(debuggerContext);
138 138
139 v8::Local<v8::Object> debuggerScript = debuggerScriptLocal(); 139 v8::Local<v8::Object> debuggerScript = debuggerScriptLocal();
140 ASSERT(!debuggerScript->IsUndefined()); 140 ASSERT(!debuggerScript->IsUndefined());
141 v8::Local<v8::Function> getScriptsFunction = v8::Local<v8::Function>::Cast(d ebuggerScript->Get(v8InternalizedString("getScripts"))); 141 v8::Local<v8::Function> getScriptsFunction = v8::Local<v8::Function>::Cast(d ebuggerScript->Get(v8InternalizedString("getScripts")));
142 v8::Local<v8::Value> argv[] = { v8String(m_isolate, contextDebugDataSubstrin g) }; 142 v8::Local<v8::Value> argv[] = { v8String(m_isolate, contextDebugDataSubstrin g) };
143 v8::Local<v8::Value> value = V8ScriptRunner::callInternalFunction(getScripts Function, debuggerScript, WTF_ARRAY_LENGTH(argv), argv, m_isolate); 143 v8::Local<v8::Value> value;
144 if (value.IsEmpty()) 144 if (!V8ScriptRunner::callInternalFunction(getScriptsFunction, debuggerScript , WTF_ARRAY_LENGTH(argv), argv, m_isolate).ToLocal(&value))
145 return; 145 return;
146 ASSERT(value->IsArray()); 146 ASSERT(value->IsArray());
147 v8::Local<v8::Array> scriptsArray = v8::Local<v8::Array>::Cast(value); 147 v8::Local<v8::Array> scriptsArray = v8::Local<v8::Array>::Cast(value);
148 for (unsigned i = 0; i < scriptsArray->Length(); ++i) 148 for (unsigned i = 0; i < scriptsArray->Length(); ++i)
149 dispatchDidParseSource(listener, v8::Local<v8::Object>::Cast(scriptsArra y->Get(v8::Integer::New(m_isolate, i))), CompileSuccess); 149 dispatchDidParseSource(listener, v8::Local<v8::Object>::Cast(scriptsArra y->Get(v8::Integer::New(m_isolate, i))), CompileSuccess);
150 } 150 }
151 151
152 String ScriptDebugServer::setBreakpoint(const String& sourceID, const ScriptBrea kpoint& scriptBreakpoint, int* actualLineNumber, int* actualColumnNumber, bool i nterstatementLocation) 152 String ScriptDebugServer::setBreakpoint(const String& sourceID, const ScriptBrea kpoint& scriptBreakpoint, int* actualLineNumber, int* actualColumnNumber, bool i nterstatementLocation)
153 { 153 {
154 v8::HandleScope scope(m_isolate); 154 v8::HandleScope scope(m_isolate);
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 void ScriptDebugServer::v8DebugEventCallback(const v8::Debug::EventDetails& even tDetails) 573 void ScriptDebugServer::v8DebugEventCallback(const v8::Debug::EventDetails& even tDetails)
574 { 574 {
575 ScriptDebugServer* thisPtr = toScriptDebugServer(eventDetails.GetCallbackDat a()); 575 ScriptDebugServer* thisPtr = toScriptDebugServer(eventDetails.GetCallbackDat a());
576 thisPtr->handleV8DebugEvent(eventDetails); 576 thisPtr->handleV8DebugEvent(eventDetails);
577 } 577 }
578 578
579 v8::Local<v8::Value> ScriptDebugServer::callInternalGetterFunction(v8::Local<v8: :Object> object, const char* functionName) 579 v8::Local<v8::Value> ScriptDebugServer::callInternalGetterFunction(v8::Local<v8: :Object> object, const char* functionName)
580 { 580 {
581 v8::Local<v8::Value> getterValue = object->Get(v8InternalizedString(function Name)); 581 v8::Local<v8::Value> getterValue = object->Get(v8InternalizedString(function Name));
582 ASSERT(!getterValue.IsEmpty() && getterValue->IsFunction()); 582 ASSERT(!getterValue.IsEmpty() && getterValue->IsFunction());
583 return V8ScriptRunner::callInternalFunction(v8::Local<v8::Function>::Cast(ge tterValue), object, 0, 0, m_isolate); 583 return V8ScriptRunner::callInternalFunction(v8::Local<v8::Function>::Cast(ge tterValue), object, 0, 0, m_isolate).ToLocalChecked();
584 } 584 }
585 585
586 void ScriptDebugServer::handleV8DebugEvent(const v8::Debug::EventDetails& eventD etails) 586 void ScriptDebugServer::handleV8DebugEvent(const v8::Debug::EventDetails& eventD etails)
587 { 587 {
588 if (!enabled()) 588 if (!enabled())
589 return; 589 return;
590 v8::DebugEvent event = eventDetails.GetEvent(); 590 v8::DebugEvent event = eventDetails.GetEvent();
591 if (event != v8::AsyncTaskEvent && event != v8::Break && event != v8::Except ion && event != v8::AfterCompile && event != v8::BeforeCompile && event != v8::C ompileError && event != v8::PromiseEvent) 591 if (event != v8::AsyncTaskEvent && event != v8::Break && event != v8::Except ion && event != v8::AfterCompile && event != v8::BeforeCompile && event != v8::C ompileError && event != v8::PromiseEvent)
592 return; 592 return;
593 593
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 *lineNumber = message->GetLineNumber(); 814 *lineNumber = message->GetLineNumber();
815 *columnNumber = message->GetStartColumn(); 815 *columnNumber = message->GetStartColumn();
816 v8::Local<v8::StackTrace> messageStackTrace = message->GetStackTrace (); 816 v8::Local<v8::StackTrace> messageStackTrace = message->GetStackTrace ();
817 if (!messageStackTrace.IsEmpty() && messageStackTrace->GetFrameCount () > 0) 817 if (!messageStackTrace.IsEmpty() && messageStackTrace->GetFrameCount () > 0)
818 *stackTrace = createScriptCallStack(m_isolate, messageStackTrace , messageStackTrace->GetFrameCount()); 818 *stackTrace = createScriptCallStack(m_isolate, messageStackTrace , messageStackTrace->GetFrameCount());
819 } 819 }
820 } 820 }
821 } 821 }
822 822
823 } // namespace blink 823 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/NPV8Object.cpp ('k') | Source/bindings/core/v8/ScriptRegexp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698