Skip to content

Commit bf2564d

Browse files
ofrobotsMylesBorins
authored andcommitted
deps: V8: backport b1cd96e from upstream
Original commit message: [inspector] added V8InspectorClient::maxAsyncCallStackDepthChanged R=dgozman@chromium.org 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 <dgozman@chromium.org> Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org> Cr-Commit-Position: refs/heads/master@{#48705} Backport-PR-URL: #16590 PR-URL: #16308 Refs: v8/v8@b1cd96e Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
1 parent ab0d7a6 commit bf2564d

8 files changed

+53
-1
lines changed

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/include/v8-version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 6
1212
#define V8_MINOR_VERSION 1
1313
#define V8_BUILD_NUMBER 534
14-
#define V8_PATCH_LEVEL 45
14+
#define V8_PATCH_LEVEL 46
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)

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

+2
Original file line numberDiff line numberDiff line change
@@ -965,6 +965,8 @@ void V8Debugger::setAsyncCallStackDepth(V8DebuggerAgentImpl* agent, int depth) {
965965
if (m_maxAsyncCallStackDepth == maxAsyncCallStackDepth) return;
966966
// TODO(dgozman): ideally, this should be per context group.
967967
m_maxAsyncCallStackDepth = maxAsyncCallStackDepth;
968+
m_inspector->client()->maxAsyncCallStackDepthChanged(
969+
m_maxAsyncCallStackDepth);
968970
if (!maxAsyncCallStackDepth) allAsyncTasksCanceled();
969971
}
970972

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));
@@ -485,6 +489,17 @@ class UtilsExtension : public IsolateData::SetupGlobalTask {
485489
args[0].As<v8::Boolean>()->Value());
486490
}
487491

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

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

+9
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,10 @@ void IsolateData::SetLogConsoleApiMessageCalls(bool log) {
355355
log_console_api_message_calls_ = log;
356356
}
357357

358+
void IsolateData::SetLogMaxAsyncCallStackDepthChanged(bool log) {
359+
log_max_async_call_stack_depth_changed_ = log;
360+
}
361+
358362
v8::MaybeLocal<v8::Value> IsolateData::memoryInfo(v8::Isolate* isolate,
359363
v8::Local<v8::Context>) {
360364
if (memory_info_.IsEmpty()) return v8::MaybeLocal<v8::Value>();
@@ -381,3 +385,8 @@ void IsolateData::consoleAPIMessage(int contextGroupId,
381385
Print(isolate_, stack->toString()->string());
382386
fprintf(stdout, "\n");
383387
}
388+
389+
void IsolateData::maxAsyncCallStackDepthChanged(int depth) {
390+
if (!log_max_async_call_stack_depth_changed_) return;
391+
fprintf(stdout, "maxAsyncCallStackDepthChanged: %d\n", depth);
392+
}

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);
@@ -105,6 +106,7 @@ class IsolateData : public v8_inspector::V8InspectorClient {
105106
const v8_inspector::StringView& url,
106107
unsigned lineNumber, unsigned columnNumber,
107108
v8_inspector::V8StackTrace*) override;
109+
void maxAsyncCallStackDepthChanged(int depth) override;
108110

109111
TaskRunner* task_runner_;
110112
SetupGlobalTasks setup_global_tasks_;
@@ -122,6 +124,7 @@ class IsolateData : public v8_inspector::V8InspectorClient {
122124
bool current_time_set_ = false;
123125
double current_time_ = 0.0;
124126
bool log_console_api_message_calls_ = false;
127+
bool log_max_async_call_stack_depth_changed_ = false;
125128

126129
DISALLOW_COPY_AND_ASSIGN(IsolateData);
127130
};

0 commit comments

Comments
 (0)