Commit f8567815 authored by yangguo's avatar yangguo Committed by Commit bot

Revert of [debugger] deprecate v8::Debug:GetDebugContext. (patchset #2...

Revert of [debugger] deprecate v8::Debug:GetDebugContext. (patchset #2 id:20001 of https://codereview.chromium.org/2589203002/ )

Reason for revert:
crbug/676749

Original issue's description:
> [debugger] deprecate v8::Debug:GetDebugContext.
>
> R=jgruber@chromium.org
> BUG=v8:5530
>
> Review-Url: https://codereview.chromium.org/2589203002
> Cr-Commit-Position: refs/heads/master@{#41911}
> Committed: https://chromium.googlesource.com/v8/v8/+/381082168d37d4f2794360ae31dc078f2a350113

TBR=jgruber@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=v8:5530, chromium:676749

Review-Url: https://codereview.chromium.org/2595413003
Cr-Commit-Position: refs/heads/master@{#41935}
parent 6983fe49
......@@ -248,8 +248,7 @@ 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.
*/
V8_DEPRECATED("Use v8-inspector",
static Local<Context> GetDebugContext(Isolate* isolate));
static Local<Context> GetDebugContext(Isolate* isolate);
/**
* While in the debug context, this method returns the top-most non-debug
......
......@@ -8845,7 +8845,9 @@ void Debug::ProcessDebugMessages(Isolate* isolate) {
Local<Context> Debug::GetDebugContext(Isolate* isolate) {
return debug::GetDebugContext(isolate);
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
ENTER_V8(i_isolate);
return Utils::ToLocal(i_isolate->debug()->GetDebugContext());
}
......@@ -8898,9 +8900,7 @@ bool debug::SetDebugEventListener(Isolate* isolate, debug::EventCallback that,
}
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());
return Debug::GetDebugContext(isolate);
}
MaybeLocal<Value> debug::Call(Local<Context> context,
......
......@@ -5663,6 +5663,27 @@ TEST(CallingContextIsNotDebugContext) {
}
TEST(DebugContextIsPreservedBetweenAccesses) {
v8::HandleScope scope(CcTest::isolate());
v8::Debug::SetDebugEventListener(CcTest::isolate(),
DebugEventBreakPointHitCount);
v8::Local<v8::Context> context1 =
v8::Debug::GetDebugContext(CcTest::isolate());
v8::Local<v8::Context> context2 =
v8::Debug::GetDebugContext(CcTest::isolate());
CHECK(v8::Utils::OpenHandle(*context1).is_identical_to(
v8::Utils::OpenHandle(*context2)));
v8::Debug::SetDebugEventListener(CcTest::isolate(), nullptr);
}
TEST(NoDebugContextWhenDebuggerDisabled) {
v8::HandleScope scope(CcTest::isolate());
v8::Local<v8::Context> context =
v8::Debug::GetDebugContext(CcTest::isolate());
CHECK(context.IsEmpty());
}
static v8::Local<v8::Value> expected_callback_data;
static void DebugEventContextChecker(const v8::Debug::EventDetails& details) {
CHECK(details.GetEventContext() == expected_context);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment