Pass explicit Isolate parameter to v8::Debug methods that need it
BUG=v8:2487 LOG=n R=vogelheim@chromium.org Review URL: https://codereview.chromium.org/1496493002 Cr-Commit-Position: refs/heads/master@{#32509}
This commit is contained in:
parent
3e7e3ed726
commit
6c0d1a1100
@ -155,8 +155,12 @@ class V8_EXPORT Debug {
|
||||
*/
|
||||
typedef void (*DebugMessageDispatchHandler)();
|
||||
|
||||
static bool SetDebugEventListener(EventCallback that,
|
||||
static bool SetDebugEventListener(Isolate* isolate, EventCallback that,
|
||||
Local<Value> data = Local<Value>());
|
||||
V8_DEPRECATE_SOON(
|
||||
"Use version with an Isolate",
|
||||
static bool SetDebugEventListener(EventCallback that,
|
||||
Local<Value> data = Local<Value>()));
|
||||
|
||||
// Schedule a debugger break to happen when JavaScript code is run
|
||||
// in the given isolate.
|
||||
@ -170,7 +174,9 @@ class V8_EXPORT Debug {
|
||||
static bool CheckDebugBreak(Isolate* isolate);
|
||||
|
||||
// Message based interface. The message protocol is JSON.
|
||||
static void SetMessageHandler(MessageHandler handler);
|
||||
static void SetMessageHandler(Isolate* isolate, MessageHandler handler);
|
||||
V8_DEPRECATE_SOON("Use version with an Isolate",
|
||||
static void SetMessageHandler(MessageHandler handler));
|
||||
|
||||
static void SendCommand(Isolate* isolate,
|
||||
const uint16_t* command, int length,
|
||||
@ -242,7 +248,9 @@ class V8_EXPORT Debug {
|
||||
* "Evaluate" debug command behavior currently is not specified in scope
|
||||
* of this method.
|
||||
*/
|
||||
static void ProcessDebugMessages();
|
||||
static void ProcessDebugMessages(Isolate* isolate);
|
||||
V8_DEPRECATE_SOON("Use version with an Isolate",
|
||||
static void ProcessDebugMessages());
|
||||
|
||||
/**
|
||||
* Debugger is running in its own context which is entered while debugger
|
||||
@ -251,7 +259,9 @@ class V8_EXPORT Debug {
|
||||
* to change. The Context exists only when the debugger is active, i.e. at
|
||||
* least one DebugEventListener or MessageHandler is set.
|
||||
*/
|
||||
static Local<Context> GetDebugContext();
|
||||
static Local<Context> GetDebugContext(Isolate* isolate);
|
||||
V8_DEPRECATE_SOON("Use version with an Isolate",
|
||||
static Local<Context> GetDebugContext());
|
||||
|
||||
|
||||
/**
|
||||
|
52
src/api.cc
52
src/api.cc
@ -7727,20 +7727,26 @@ Local<StackTrace> Exception::GetStackTrace(Local<Value> exception) {
|
||||
|
||||
// --- D e b u g S u p p o r t ---
|
||||
|
||||
bool Debug::SetDebugEventListener(EventCallback that, Local<Value> data) {
|
||||
i::Isolate* isolate = i::Isolate::Current();
|
||||
ENTER_V8(isolate);
|
||||
i::HandleScope scope(isolate);
|
||||
i::Handle<i::Object> foreign = isolate->factory()->undefined_value();
|
||||
bool Debug::SetDebugEventListener(Isolate* isolate, EventCallback that,
|
||||
Local<Value> data) {
|
||||
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
||||
ENTER_V8(i_isolate);
|
||||
i::HandleScope scope(i_isolate);
|
||||
i::Handle<i::Object> foreign = i_isolate->factory()->undefined_value();
|
||||
if (that != NULL) {
|
||||
foreign = isolate->factory()->NewForeign(FUNCTION_ADDR(that));
|
||||
foreign = i_isolate->factory()->NewForeign(FUNCTION_ADDR(that));
|
||||
}
|
||||
isolate->debug()->SetEventListener(foreign,
|
||||
Utils::OpenHandle(*data, true));
|
||||
i_isolate->debug()->SetEventListener(foreign, Utils::OpenHandle(*data, true));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Debug::SetDebugEventListener(EventCallback that, Local<Value> data) {
|
||||
return SetDebugEventListener(
|
||||
reinterpret_cast<Isolate*>(i::Isolate::Current()), that, data);
|
||||
}
|
||||
|
||||
|
||||
void Debug::DebugBreak(Isolate* isolate) {
|
||||
reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->RequestDebugBreak();
|
||||
}
|
||||
@ -7758,10 +7764,16 @@ bool Debug::CheckDebugBreak(Isolate* isolate) {
|
||||
}
|
||||
|
||||
|
||||
void Debug::SetMessageHandler(Isolate* isolate,
|
||||
v8::Debug::MessageHandler handler) {
|
||||
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
||||
ENTER_V8(i_isolate);
|
||||
i_isolate->debug()->SetMessageHandler(handler);
|
||||
}
|
||||
|
||||
|
||||
void Debug::SetMessageHandler(v8::Debug::MessageHandler handler) {
|
||||
i::Isolate* isolate = i::Isolate::Current();
|
||||
ENTER_V8(isolate);
|
||||
isolate->debug()->SetMessageHandler(handler);
|
||||
SetMessageHandler(reinterpret_cast<Isolate*>(i::Isolate::Current()), handler);
|
||||
}
|
||||
|
||||
|
||||
@ -7827,15 +7839,25 @@ Local<Value> Debug::GetMirror(v8::Local<v8::Value> obj) {
|
||||
}
|
||||
|
||||
|
||||
void Debug::ProcessDebugMessages(Isolate* isolate) {
|
||||
reinterpret_cast<i::Isolate*>(isolate)->debug()->ProcessDebugMessages(true);
|
||||
}
|
||||
|
||||
|
||||
void Debug::ProcessDebugMessages() {
|
||||
i::Isolate::Current()->debug()->ProcessDebugMessages(true);
|
||||
ProcessDebugMessages(reinterpret_cast<Isolate*>(i::Isolate::Current()));
|
||||
}
|
||||
|
||||
|
||||
Local<Context> Debug::GetDebugContext(Isolate* isolate) {
|
||||
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
|
||||
ENTER_V8(i_isolate);
|
||||
return Utils::ToLocal(i_isolate->debug()->GetDebugContext());
|
||||
}
|
||||
|
||||
|
||||
Local<Context> Debug::GetDebugContext() {
|
||||
i::Isolate* isolate = i::Isolate::Current();
|
||||
ENTER_V8(isolate);
|
||||
return Utils::ToLocal(isolate->debug()->GetDebugContext());
|
||||
return GetDebugContext(reinterpret_cast<Isolate*>(i::Isolate::Current()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -679,12 +679,14 @@ static void DummyDebugEventListener(
|
||||
const v8::Debug::EventDetails& event_details) {}
|
||||
|
||||
|
||||
static inline void EnableDebugger() {
|
||||
v8::Debug::SetDebugEventListener(&DummyDebugEventListener);
|
||||
static inline void EnableDebugger(v8::Isolate* isolate) {
|
||||
v8::Debug::SetDebugEventListener(isolate, &DummyDebugEventListener);
|
||||
}
|
||||
|
||||
|
||||
static inline void DisableDebugger() { v8::Debug::SetDebugEventListener(NULL); }
|
||||
static inline void DisableDebugger(v8::Isolate* isolate) {
|
||||
v8::Debug::SetDebugEventListener(isolate, nullptr);
|
||||
}
|
||||
|
||||
|
||||
static inline void EmptyMessageQueues(v8::Isolate* isolate) {
|
||||
|
@ -20145,7 +20145,7 @@ TEST(Regress385349) {
|
||||
HandleScope handle_scope(isolate);
|
||||
isolate->SetAutorunMicrotasks(false);
|
||||
Local<Context> context = Context::New(isolate);
|
||||
v8::Debug::SetDebugEventListener(DebugEventInObserver);
|
||||
v8::Debug::SetDebugEventListener(isolate, DebugEventInObserver);
|
||||
{
|
||||
Context::Scope context_scope(context);
|
||||
CompileRun("var obj = {};"
|
||||
@ -20154,7 +20154,7 @@ TEST(Regress385349) {
|
||||
}
|
||||
isolate->RunMicrotasks();
|
||||
isolate->SetAutorunMicrotasks(true);
|
||||
v8::Debug::SetDebugEventListener(NULL);
|
||||
v8::Debug::SetDebugEventListener(isolate, nullptr);
|
||||
}
|
||||
|
||||
|
||||
@ -22690,7 +22690,7 @@ TEST(StreamingWithDebuggingEnabledLate) {
|
||||
v8::ScriptOrigin origin(v8_str("http://foo.com"));
|
||||
char* full_source = TestSourceStream::FullSourceString(chunks);
|
||||
|
||||
EnableDebugger();
|
||||
EnableDebugger(isolate);
|
||||
|
||||
v8::Local<Script> script = v8::ScriptCompiler::Compile(
|
||||
isolate, &source, v8_str(full_source), origin);
|
||||
@ -22701,7 +22701,7 @@ TEST(StreamingWithDebuggingEnabledLate) {
|
||||
|
||||
delete[] full_source;
|
||||
|
||||
DisableDebugger();
|
||||
DisableDebugger(isolate);
|
||||
}
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1500,10 +1500,10 @@ TEST(TestCodeFlushingIncrementalAbort) {
|
||||
// disabled.
|
||||
int position = 0;
|
||||
Handle<Object> breakpoint_object(Smi::FromInt(0), isolate);
|
||||
EnableDebugger();
|
||||
EnableDebugger(CcTest::isolate());
|
||||
isolate->debug()->SetBreakPoint(function, breakpoint_object, &position);
|
||||
isolate->debug()->ClearAllBreakPoints();
|
||||
DisableDebugger();
|
||||
DisableDebugger(CcTest::isolate());
|
||||
|
||||
// Force optimization now that code flushing is disabled.
|
||||
{ v8::HandleScope scope(CcTest::isolate());
|
||||
|
Loading…
Reference in New Issue
Block a user