Skip to content

Commit c087502

Browse files
committed
deps: V8: backport b1cd96e from upstream
Original commit message: [inspector] added V8InspectorClient::maxAsyncCallStackDepthChanged [email protected] Bug: none Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_chromium_rel_ng Change-Id: I0fa10978266feb3c3907ce1f3386ae7a34a33582 Reviewed-on: https://chromium-review.googlesource.com/726490 Reviewed-by: Dmitry Gozman <[email protected]> Commit-Queue: Aleksey Kozyatinskiy <[email protected]> Cr-Commit-Position: refs/heads/master@{#48705} PR-URL: #16308 Refs: v8/v8@b1cd96e Reviewed-By: Eugene Ostroukhov <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Timothy Gu <[email protected]>
1 parent 88fb359 commit c087502

8 files changed

+53
-1
lines changed

common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
# Reset this number to 0 on major V8 upgrades.
2929
# Increment by one for each non-official patch applied to deps/v8.
30-
'v8_embedder_string': '-node.7',
30+
'v8_embedder_string': '-node.8',
3131

3232
# Enable disassembler for `--print-code` v8 options
3333
'v8_enable_disassembler': 1,

deps/v8/include/v8-inspector.h

+2
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ class V8_EXPORT V8InspectorClient {
211211
// TODO(dgozman): this was added to support service worker shadow page. We
212212
// should not connect at all.
213213
virtual bool canExecuteScripts(int contextGroupId) { return true; }
214+
215+
virtual void maxAsyncCallStackDepthChanged(int depth) {}
214216
};
215217

216218
class V8_EXPORT V8Inspector {

deps/v8/src/inspector/v8-debugger.cc

+2
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,8 @@ void V8Debugger::setAsyncCallStackDepth(V8DebuggerAgentImpl* agent, int depth) {
726726
if (m_maxAsyncCallStackDepth == maxAsyncCallStackDepth) return;
727727
// TODO(dgozman): ideally, this should be per context group.
728728
m_maxAsyncCallStackDepth = maxAsyncCallStackDepth;
729+
m_inspector->client()->maxAsyncCallStackDepthChanged(
730+
m_maxAsyncCallStackDepth);
729731
if (!maxAsyncCallStackDepth) allAsyncTasksCanceled();
730732
}
731733

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Tests for max async call stack depth changed.
2+
maxAsyncCallStackDepthChanged: 8
3+
maxAsyncCallStackDepthChanged: 0
4+
maxAsyncCallStackDepthChanged: 8
5+
maxAsyncCallStackDepthChanged: 0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2017 the V8 project authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
let {session, contextGroup, Protocol} =
6+
InspectorTest.start('Tests for max async call stack depth changed.');
7+
8+
(async function test(){
9+
utils.setLogMaxAsyncCallStackDepthChanged(true);
10+
await Protocol.Debugger.enable();
11+
await Protocol.Debugger.setAsyncCallStackDepth({maxDepth: 8});
12+
await Protocol.Debugger.setAsyncCallStackDepth({maxDepth: 0});
13+
await Protocol.Debugger.setAsyncCallStackDepth({maxDepth: 8});
14+
await Protocol.Debugger.disable();
15+
InspectorTest.completeTest();
16+
})();

deps/v8/test/inspector/inspector-test.cc

+15
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,10 @@ class UtilsExtension : public IsolateData::SetupGlobalTask {
299299
utils->Set(ToV8String(isolate, "setLogConsoleApiMessageCalls"),
300300
v8::FunctionTemplate::New(
301301
isolate, &UtilsExtension::SetLogConsoleApiMessageCalls));
302+
utils->Set(
303+
ToV8String(isolate, "setLogMaxAsyncCallStackDepthChanged"),
304+
v8::FunctionTemplate::New(
305+
isolate, &UtilsExtension::SetLogMaxAsyncCallStackDepthChanged));
302306
utils->Set(ToV8String(isolate, "createContextGroup"),
303307
v8::FunctionTemplate::New(isolate,
304308
&UtilsExtension::CreateContextGroup));
@@ -486,6 +490,17 @@ class UtilsExtension : public IsolateData::SetupGlobalTask {
486490
args[0].As<v8::Boolean>()->Value());
487491
}
488492

493+
static void SetLogMaxAsyncCallStackDepthChanged(
494+
const v8::FunctionCallbackInfo<v8::Value>& args) {
495+
if (args.Length() != 1 || !args[0]->IsBoolean()) {
496+
fprintf(stderr,
497+
"Internal error: setLogMaxAsyncCallStackDepthChanged(bool).");
498+
Exit();
499+
}
500+
backend_runner_->data()->SetLogMaxAsyncCallStackDepthChanged(
501+
args[0].As<v8::Boolean>()->Value());
502+
}
503+
489504
static void CreateContextGroup(
490505
const v8::FunctionCallbackInfo<v8::Value>& args) {
491506
if (args.Length() != 0) {

deps/v8/test/inspector/isolate-data.cc

+9
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,10 @@ void IsolateData::SetLogConsoleApiMessageCalls(bool log) {
370370
log_console_api_message_calls_ = log;
371371
}
372372

373+
void IsolateData::SetLogMaxAsyncCallStackDepthChanged(bool log) {
374+
log_max_async_call_stack_depth_changed_ = log;
375+
}
376+
373377
v8::MaybeLocal<v8::Value> IsolateData::memoryInfo(v8::Isolate* isolate,
374378
v8::Local<v8::Context>) {
375379
if (memory_info_.IsEmpty()) return v8::MaybeLocal<v8::Value>();
@@ -396,3 +400,8 @@ void IsolateData::consoleAPIMessage(int contextGroupId,
396400
Print(isolate_, stack->toString()->string());
397401
fprintf(stdout, "\n");
398402
}
403+
404+
void IsolateData::maxAsyncCallStackDepthChanged(int depth) {
405+
if (!log_max_async_call_stack_depth_changed_) return;
406+
fprintf(stdout, "maxAsyncCallStackDepthChanged: %d\n", depth);
407+
}

deps/v8/test/inspector/isolate-data.h

+3
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class IsolateData : public v8_inspector::V8InspectorClient {
6464
void SetCurrentTimeMS(double time);
6565
void SetMemoryInfo(v8::Local<v8::Value> memory_info);
6666
void SetLogConsoleApiMessageCalls(bool log);
67+
void SetLogMaxAsyncCallStackDepthChanged(bool log);
6768
void SetMaxAsyncTaskStacksForTest(int limit);
6869
void DumpAsyncTaskStacksStateForTest();
6970
void FireContextCreated(v8::Local<v8::Context> context, int context_group_id);
@@ -106,6 +107,7 @@ class IsolateData : public v8_inspector::V8InspectorClient {
106107
unsigned lineNumber, unsigned columnNumber,
107108
v8_inspector::V8StackTrace*) override;
108109
bool isInspectableHeapObject(v8::Local<v8::Object>) override;
110+
void maxAsyncCallStackDepthChanged(int depth) override;
109111

110112
TaskRunner* task_runner_;
111113
SetupGlobalTasks setup_global_tasks_;
@@ -123,6 +125,7 @@ class IsolateData : public v8_inspector::V8InspectorClient {
123125
bool current_time_set_ = false;
124126
double current_time_ = 0.0;
125127
bool log_console_api_message_calls_ = false;
128+
bool log_max_async_call_stack_depth_changed_ = false;
126129
v8::Global<v8::Private> not_inspectable_private_;
127130

128131
DISALLOW_COPY_AND_ASSIGN(IsolateData);

0 commit comments

Comments
 (0)