Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(561)

Unified Diff: test/inspector/inspector-test.cc

Issue 2579403002: [inspector] introduce limit for amount of stored async stacks (Closed)
Patch Set: addressed comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/inspector/debugger/async-stacks-limit-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/inspector/inspector-test.cc
diff --git a/test/inspector/inspector-test.cc b/test/inspector/inspector-test.cc
index 3895fac8a0d7138efde120e78b10d09cf75b4c78..286d685d21d3dffadd8c761fc14c542e43f59ff5 100644
--- a/test/inspector/inspector-test.cc
+++ b/test/inspector/inspector-test.cc
@@ -13,6 +13,7 @@
#include "src/base/platform/platform.h"
#include "src/flags.h"
+#include "src/inspector/test-interface.h"
#include "src/utils.h"
#include "src/vector.h"
@@ -257,7 +258,8 @@ class InspectorExtension : public v8::Extension {
InspectorExtension()
: v8::Extension("v8_inspector/inspector",
"native function attachInspector();"
- "native function detachInspector();") {}
+ "native function detachInspector();"
+ "native function setMaxAsyncTaskStacks();") {}
virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate(
v8::Isolate* isolate, v8::Local<v8::String> name) {
@@ -274,6 +276,13 @@ class InspectorExtension : public v8::Extension {
.ToLocalChecked())
.FromJust()) {
return v8::FunctionTemplate::New(isolate, InspectorExtension::Detach);
+ } else if (name->Equals(context, v8::String::NewFromUtf8(
+ isolate, "setMaxAsyncTaskStacks",
+ v8::NewStringType::kNormal)
+ .ToLocalChecked())
+ .FromJust()) {
+ return v8::FunctionTemplate::New(
+ isolate, InspectorExtension::SetMaxAsyncTaskStacks);
}
return v8::Local<v8::FunctionTemplate>();
}
@@ -303,6 +312,20 @@ class InspectorExtension : public v8::Extension {
}
inspector->contextDestroyed(context);
}
+
+ static void SetMaxAsyncTaskStacks(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
+ if (args.Length() != 1 || !args[0]->IsInt32()) {
+ fprintf(stderr, "Internal error: setMaxAsyncTaskStacks(max).");
+ Exit();
+ }
+ v8_inspector::V8Inspector* inspector =
+ InspectorClientImpl::InspectorFromContext(
+ args.GetIsolate()->GetCurrentContext());
+ CHECK(inspector);
+ v8_inspector::SetMaxAsyncTaskStacksForTest(
+ inspector, args[0].As<v8::Int32>()->Value());
+ }
};
v8::Local<v8::String> ToString(v8::Isolate* isolate,
« no previous file with comments | « test/inspector/debugger/async-stacks-limit-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698