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

[debugger] deprecate v8::Debug:GetDebugContext.

R=jgruber@chromium.org
BUG=v8:5530

Review-Url: https://codereview.chromium.org/2589203002
Cr-Original-Commit-Position: refs/heads/master@{#41911}
Committed: https://chromium.googlesource.com/v8/v8/+/381082168d37d4f2794360ae31dc078f2a350113
Review-Url: https://codereview.chromium.org/2589203002
Cr-Commit-Position: refs/heads/master@{#42220}
parent 93a357c7
......@@ -248,7 +248,8 @@ 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(Isolate* isolate);
V8_DEPRECATED("Use v8-inspector",
static Local<Context> GetDebugContext(Isolate* isolate));
/**
* While in the debug context, this method returns the top-most non-debug
......
......@@ -8900,9 +8900,7 @@ void Debug::ProcessDebugMessages(Isolate* isolate) {
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);
}
......@@ -8955,7 +8953,9 @@ bool debug::SetDebugEventListener(Isolate* isolate, debug::EventCallback that,
}
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());
}
MaybeLocal<Value> debug::Call(Local<Context> context,
......
......@@ -486,7 +486,7 @@ void V8Debugger::handleProgramBreak(v8::Local<v8::Context> pausedContext,
v8::Context::Scope scope(pausedContext);
v8::Local<v8::Context> context = m_isolate->GetCurrentContext();
CHECK(!context.IsEmpty() &&
context != v8::Debug::GetDebugContext(m_isolate));
context != v8::debug::GetDebugContext(m_isolate));
m_inspector->client()->runMessageLoopOnPause(groupId);
// The agent may have been removed in the nested loop.
agent = m_inspector->enabledDebuggerAgentForGroup(
......
......@@ -5663,27 +5663,6 @@ 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