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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp

Issue 1807513002: [DevTools] Add missing MicrotasksScope to debugger. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« 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) 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 { 53 {
54 return value ? v8::True(isolate) : v8::False(isolate); 54 return value ? v8::True(isolate) : v8::False(isolate);
55 } 55 }
56 56
57 } 57 }
58 58
59 static bool inLiveEditScope = false; 59 static bool inLiveEditScope = false;
60 60
61 v8::MaybeLocal<v8::Value> V8DebuggerImpl::callDebuggerMethod(const char* functio nName, int argc, v8::Local<v8::Value> argv[]) 61 v8::MaybeLocal<v8::Value> V8DebuggerImpl::callDebuggerMethod(const char* functio nName, int argc, v8::Local<v8::Value> argv[])
62 { 62 {
63 v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicr otasks);
63 v8::Local<v8::Object> debuggerScript = m_debuggerScript.Get(m_isolate); 64 v8::Local<v8::Object> debuggerScript = m_debuggerScript.Get(m_isolate);
64 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(debuggerScr ipt->Get(v8InternalizedString(functionName))); 65 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(debuggerScr ipt->Get(v8InternalizedString(functionName)));
65 ASSERT(m_isolate->InContext()); 66 ASSERT(m_isolate->InContext());
66 return function->Call(m_isolate->GetCurrentContext(), debuggerScript, argc, argv); 67 return function->Call(m_isolate->GetCurrentContext(), debuggerScript, argc, argv);
67 } 68 }
68 69
69 PassOwnPtr<V8Debugger> V8Debugger::create(v8::Isolate* isolate, V8DebuggerClient * client) 70 PassOwnPtr<V8Debugger> V8Debugger::create(v8::Isolate* isolate, V8DebuggerClient * client)
70 { 71 {
71 return adoptPtr(new V8DebuggerImpl(isolate, client)); 72 return adoptPtr(new V8DebuggerImpl(isolate, client));
72 } 73 }
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 } 209 }
209 210
210 void V8DebuggerImpl::getCompiledScripts(int contextGroupId, protocol::Vector<V8D ebuggerParsedScript>& result) 211 void V8DebuggerImpl::getCompiledScripts(int contextGroupId, protocol::Vector<V8D ebuggerParsedScript>& result)
211 { 212 {
212 v8::HandleScope scope(m_isolate); 213 v8::HandleScope scope(m_isolate);
213 v8::Local<v8::Object> debuggerScript = m_debuggerScript.Get(m_isolate); 214 v8::Local<v8::Object> debuggerScript = m_debuggerScript.Get(m_isolate);
214 ASSERT(!debuggerScript->IsUndefined()); 215 ASSERT(!debuggerScript->IsUndefined());
215 v8::Local<v8::Function> getScriptsFunction = v8::Local<v8::Function>::Cast(d ebuggerScript->Get(v8InternalizedString("getScripts"))); 216 v8::Local<v8::Function> getScriptsFunction = v8::Local<v8::Function>::Cast(d ebuggerScript->Get(v8InternalizedString("getScripts")));
216 v8::Local<v8::Value> argv[] = { v8::Integer::New(m_isolate, contextGroupId) }; 217 v8::Local<v8::Value> argv[] = { v8::Integer::New(m_isolate, contextGroupId) };
217 v8::Local<v8::Value> value; 218 v8::Local<v8::Value> value;
219 v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicr otasks);
218 if (!getScriptsFunction->Call(debuggerContext(), debuggerScript, WTF_ARRAY_L ENGTH(argv), argv).ToLocal(&value)) 220 if (!getScriptsFunction->Call(debuggerContext(), debuggerScript, WTF_ARRAY_L ENGTH(argv), argv).ToLocal(&value))
219 return; 221 return;
220 ASSERT(value->IsArray()); 222 ASSERT(value->IsArray());
221 v8::Local<v8::Array> scriptsArray = v8::Local<v8::Array>::Cast(value); 223 v8::Local<v8::Array> scriptsArray = v8::Local<v8::Array>::Cast(value);
222 result.resize(scriptsArray->Length()); 224 result.resize(scriptsArray->Length());
223 for (unsigned i = 0; i < scriptsArray->Length(); ++i) 225 for (unsigned i = 0; i < scriptsArray->Length(); ++i)
224 result[i] = createParsedScript(v8::Local<v8::Object>::Cast(scriptsArray- >Get(v8::Integer::New(m_isolate, i))), true); 226 result[i] = createParsedScript(v8::Local<v8::Object>::Cast(scriptsArray- >Get(v8::Integer::New(m_isolate, i))), true);
225 } 227 }
226 228
227 String16 V8DebuggerImpl::setBreakpoint(const String16& sourceID, const ScriptBre akpoint& scriptBreakpoint, int* actualLineNumber, int* actualColumnNumber, bool interstatementLocation) 229 String16 V8DebuggerImpl::setBreakpoint(const String16& sourceID, const ScriptBre akpoint& scriptBreakpoint, int* actualLineNumber, int* actualColumnNumber, bool interstatementLocation)
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 void V8DebuggerImpl::v8DebugEventCallback(const v8::Debug::EventDetails& eventDe tails) 604 void V8DebuggerImpl::v8DebugEventCallback(const v8::Debug::EventDetails& eventDe tails)
603 { 605 {
604 V8DebuggerImpl* thisPtr = toV8DebuggerImpl(eventDetails.GetCallbackData()); 606 V8DebuggerImpl* thisPtr = toV8DebuggerImpl(eventDetails.GetCallbackData());
605 thisPtr->handleV8DebugEvent(eventDetails); 607 thisPtr->handleV8DebugEvent(eventDetails);
606 } 608 }
607 609
608 v8::Local<v8::Value> V8DebuggerImpl::callInternalGetterFunction(v8::Local<v8::Ob ject> object, const char* functionName) 610 v8::Local<v8::Value> V8DebuggerImpl::callInternalGetterFunction(v8::Local<v8::Ob ject> object, const char* functionName)
609 { 611 {
610 v8::Local<v8::Value> getterValue = object->Get(v8InternalizedString(function Name)); 612 v8::Local<v8::Value> getterValue = object->Get(v8InternalizedString(function Name));
611 ASSERT(!getterValue.IsEmpty() && getterValue->IsFunction()); 613 ASSERT(!getterValue.IsEmpty() && getterValue->IsFunction());
614 v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicr otasks);
612 return v8::Local<v8::Function>::Cast(getterValue)->Call(m_isolate->GetCurren tContext(), object, 0, 0).ToLocalChecked(); 615 return v8::Local<v8::Function>::Cast(getterValue)->Call(m_isolate->GetCurren tContext(), object, 0, 0).ToLocalChecked();
613 } 616 }
614 617
615 void V8DebuggerImpl::handleV8DebugEvent(const v8::Debug::EventDetails& eventDeta ils) 618 void V8DebuggerImpl::handleV8DebugEvent(const v8::Debug::EventDetails& eventDeta ils)
616 { 619 {
617 if (!enabled()) 620 if (!enabled())
618 return; 621 return;
619 v8::DebugEvent event = eventDetails.GetEvent(); 622 v8::DebugEvent event = eventDetails.GetEvent();
620 if (event != v8::AsyncTaskEvent && event != v8::Break && event != v8::Except ion && event != v8::AfterCompile && event != v8::BeforeCompile && event != v8::C ompileError && event != v8::PromiseEvent) 623 if (event != v8::AsyncTaskEvent && event != v8::Break && event != v8::Except ion && event != v8::AfterCompile && event != v8::BeforeCompile && event != v8::C ompileError && event != v8::PromiseEvent)
621 return; 624 return;
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 } 885 }
883 886
884 v8::Local<v8::Context> V8DebuggerImpl::regexContext() 887 v8::Local<v8::Context> V8DebuggerImpl::regexContext()
885 { 888 {
886 if (m_regexContext.IsEmpty()) 889 if (m_regexContext.IsEmpty())
887 m_regexContext.Reset(m_isolate, v8::Context::New(m_isolate)); 890 m_regexContext.Reset(m_isolate, v8::Context::New(m_isolate));
888 return m_regexContext.Get(m_isolate); 891 return m_regexContext.Get(m_isolate);
889 } 892 }
890 893
891 } // namespace blink 894 } // namespace blink
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