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: 381082168d

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}
This commit is contained in:
yangguo 2016-12-23 01:15:15 -08:00 committed by Commit bot
parent 6983fe497c
commit f85678159d
3 changed files with 26 additions and 6 deletions

View File

@ -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

View File

@ -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,

View File

@ -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);