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

Side by Side Diff: test/inspector/inspector-test.cc

Issue 2916803005: [inspector] Create InjectedScript per session in each context (Closed)
Patch Set: rebased Created 3 years, 6 months 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 unified diff | Download patch
« no previous file with comments | « src/inspector/v8-inspector-session-impl.cc ('k') | test/inspector/isolate-data.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if !defined(_WIN32) && !defined(_WIN64) 5 #if !defined(_WIN32) && !defined(_WIN64)
6 #include <unistd.h> // NOLINT 6 #include <unistd.h> // NOLINT
7 #endif // !defined(_WIN32) && !defined(_WIN64) 7 #endif // !defined(_WIN32) && !defined(_WIN64)
8 8
9 #include <locale.h> 9 #include <locale.h>
10 10
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 ~InspectorExtension() override = default; 635 ~InspectorExtension() override = default;
636 void Run(v8::Isolate* isolate, 636 void Run(v8::Isolate* isolate,
637 v8::Local<v8::ObjectTemplate> global) override { 637 v8::Local<v8::ObjectTemplate> global) override {
638 v8::Local<v8::ObjectTemplate> inspector = v8::ObjectTemplate::New(isolate); 638 v8::Local<v8::ObjectTemplate> inspector = v8::ObjectTemplate::New(isolate);
639 inspector->Set(ToV8String(isolate, "fireContextCreated"), 639 inspector->Set(ToV8String(isolate, "fireContextCreated"),
640 v8::FunctionTemplate::New( 640 v8::FunctionTemplate::New(
641 isolate, &InspectorExtension::FireContextCreated)); 641 isolate, &InspectorExtension::FireContextCreated));
642 inspector->Set(ToV8String(isolate, "fireContextDestroyed"), 642 inspector->Set(ToV8String(isolate, "fireContextDestroyed"),
643 v8::FunctionTemplate::New( 643 v8::FunctionTemplate::New(
644 isolate, &InspectorExtension::FireContextDestroyed)); 644 isolate, &InspectorExtension::FireContextDestroyed));
645 inspector->Set(ToV8String(isolate, "addInspectedObject"),
646 v8::FunctionTemplate::New(
647 isolate, &InspectorExtension::AddInspectedObject));
645 inspector->Set(ToV8String(isolate, "setMaxAsyncTaskStacks"), 648 inspector->Set(ToV8String(isolate, "setMaxAsyncTaskStacks"),
646 v8::FunctionTemplate::New( 649 v8::FunctionTemplate::New(
647 isolate, &InspectorExtension::SetMaxAsyncTaskStacks)); 650 isolate, &InspectorExtension::SetMaxAsyncTaskStacks));
648 inspector->Set( 651 inspector->Set(
649 ToV8String(isolate, "dumpAsyncTaskStacksStateForTest"), 652 ToV8String(isolate, "dumpAsyncTaskStacksStateForTest"),
650 v8::FunctionTemplate::New( 653 v8::FunctionTemplate::New(
651 isolate, &InspectorExtension::DumpAsyncTaskStacksStateForTest)); 654 isolate, &InspectorExtension::DumpAsyncTaskStacksStateForTest));
652 inspector->Set( 655 inspector->Set(
653 ToV8String(isolate, "breakProgram"), 656 ToV8String(isolate, "breakProgram"),
654 v8::FunctionTemplate::New(isolate, &InspectorExtension::BreakProgram)); 657 v8::FunctionTemplate::New(isolate, &InspectorExtension::BreakProgram));
(...skipping 18 matching lines...) Expand all
673 data->FireContextCreated(context, data->GetContextGroupId(context)); 676 data->FireContextCreated(context, data->GetContextGroupId(context));
674 } 677 }
675 678
676 static void FireContextDestroyed( 679 static void FireContextDestroyed(
677 const v8::FunctionCallbackInfo<v8::Value>& args) { 680 const v8::FunctionCallbackInfo<v8::Value>& args) {
678 v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext(); 681 v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext();
679 IsolateData* data = IsolateData::FromContext(context); 682 IsolateData* data = IsolateData::FromContext(context);
680 data->FireContextDestroyed(context); 683 data->FireContextDestroyed(context);
681 } 684 }
682 685
686 static void AddInspectedObject(
687 const v8::FunctionCallbackInfo<v8::Value>& args) {
688 if (args.Length() != 2 || !args[0]->IsInt32()) {
689 fprintf(stderr,
690 "Internal error: addInspectedObject(session_id, object).");
691 Exit();
692 }
693 v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext();
694 IsolateData* data = IsolateData::FromContext(context);
695 data->AddInspectedObject(args[0].As<v8::Int32>()->Value(), args[1]);
696 }
697
683 static void SetMaxAsyncTaskStacks( 698 static void SetMaxAsyncTaskStacks(
684 const v8::FunctionCallbackInfo<v8::Value>& args) { 699 const v8::FunctionCallbackInfo<v8::Value>& args) {
685 if (args.Length() != 1 || !args[0]->IsInt32()) { 700 if (args.Length() != 1 || !args[0]->IsInt32()) {
686 fprintf(stderr, "Internal error: setMaxAsyncTaskStacks(max)."); 701 fprintf(stderr, "Internal error: setMaxAsyncTaskStacks(max).");
687 Exit(); 702 Exit();
688 } 703 }
689 IsolateData::FromContext(args.GetIsolate()->GetCurrentContext()) 704 IsolateData::FromContext(args.GetIsolate()->GetCurrentContext())
690 ->SetMaxAsyncTaskStacksForTest(args[0].As<v8::Int32>()->Value()); 705 ->SetMaxAsyncTaskStacksForTest(args[0].As<v8::Int32>()->Value());
691 } 706 }
692 707
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 frontend_runner.Append( 845 frontend_runner.Append(
831 new ExecuteStringTask(chars, frontend_context_group_id)); 846 new ExecuteStringTask(chars, frontend_context_group_id));
832 } 847 }
833 848
834 frontend_runner.Join(); 849 frontend_runner.Join();
835 backend_runner.Join(); 850 backend_runner.Join();
836 851
837 delete startup_data.data; 852 delete startup_data.data;
838 return 0; 853 return 0;
839 } 854 }
OLDNEW
« no previous file with comments | « src/inspector/v8-inspector-session-impl.cc ('k') | test/inspector/isolate-data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698