OLD | NEW |
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 |
11 #include "include/libplatform/libplatform.h" | 11 #include "include/libplatform/libplatform.h" |
12 #include "include/v8.h" | 12 #include "include/v8.h" |
13 | 13 |
14 #include "src/base/platform/platform.h" | 14 #include "src/base/platform/platform.h" |
15 #include "src/flags.h" | 15 #include "src/flags.h" |
16 #include "src/inspector/test-interface.h" | 16 #include "src/inspector/test-interface.h" |
17 #include "src/utils.h" | 17 #include "src/utils.h" |
18 #include "src/vector.h" | 18 #include "src/vector.h" |
19 | 19 |
20 #include "test/inspector/inspector-impl.h" | 20 #include "test/inspector/isolate-data.h" |
21 #include "test/inspector/task-runner.h" | 21 #include "test/inspector/task-runner.h" |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
25 std::vector<TaskRunner*> task_runners; | 25 std::vector<TaskRunner*> task_runners; |
26 | 26 |
27 void Terminate() { | 27 void Terminate() { |
28 for (size_t i = 0; i < task_runners.size(); ++i) { | 28 for (size_t i = 0; i < task_runners.size(); ++i) { |
29 task_runners[i]->Terminate(); | 29 task_runners[i]->Terminate(); |
30 task_runners[i]->Join(); | 30 task_runners[i]->Join(); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 : ready_semaphore_(ready_semaphore), | 91 : ready_semaphore_(ready_semaphore), |
92 context_group_id_(context_group_id), | 92 context_group_id_(context_group_id), |
93 state_(state), | 93 state_(state), |
94 session_id_(session_id) {} | 94 session_id_(session_id) {} |
95 virtual ~ConnectSessionTask() = default; | 95 virtual ~ConnectSessionTask() = default; |
96 bool is_inspector_task() final { return true; } | 96 bool is_inspector_task() final { return true; } |
97 | 97 |
98 private: | 98 private: |
99 void Run() override { | 99 void Run() override { |
100 v8_inspector::StringView state(state_.start(), state_.length()); | 100 v8_inspector::StringView state(state_.start(), state_.length()); |
101 *session_id_ = | 101 *session_id_ = data()->ConnectSession(context_group_id_, state); |
102 data()->inspector()->ConnectSession(context_group_id_, state); | |
103 if (ready_semaphore_) ready_semaphore_->Signal(); | 102 if (ready_semaphore_) ready_semaphore_->Signal(); |
104 } | 103 } |
105 | 104 |
106 v8::base::Semaphore* ready_semaphore_; | 105 v8::base::Semaphore* ready_semaphore_; |
107 int context_group_id_; | 106 int context_group_id_; |
108 const v8::internal::Vector<uint16_t>& state_; | 107 const v8::internal::Vector<uint16_t>& state_; |
109 int* session_id_; | 108 int* session_id_; |
110 }; | 109 }; |
111 | 110 |
112 class DisconnectSessionTask : public TaskRunner::Task { | 111 class DisconnectSessionTask : public TaskRunner::Task { |
113 public: | 112 public: |
114 DisconnectSessionTask(v8::base::Semaphore* ready_semaphore, int session_id, | 113 DisconnectSessionTask(v8::base::Semaphore* ready_semaphore, int session_id, |
115 v8::internal::Vector<uint16_t>* state) | 114 v8::internal::Vector<uint16_t>* state) |
116 : ready_semaphore_(ready_semaphore), | 115 : ready_semaphore_(ready_semaphore), |
117 session_id_(session_id), | 116 session_id_(session_id), |
118 state_(state) {} | 117 state_(state) {} |
119 virtual ~DisconnectSessionTask() = default; | 118 virtual ~DisconnectSessionTask() = default; |
120 bool is_inspector_task() final { return true; } | 119 bool is_inspector_task() final { return true; } |
121 | 120 |
122 private: | 121 private: |
123 void Run() override { | 122 void Run() override { |
124 std::unique_ptr<v8_inspector::StringBuffer> state = | 123 std::unique_ptr<v8_inspector::StringBuffer> state = |
125 data()->inspector()->DisconnectSession(session_id_); | 124 data()->DisconnectSession(session_id_); |
126 *state_ = ToVector(state->string()); | 125 *state_ = ToVector(state->string()); |
127 if (ready_semaphore_) ready_semaphore_->Signal(); | 126 if (ready_semaphore_) ready_semaphore_->Signal(); |
128 } | 127 } |
129 | 128 |
130 v8::base::Semaphore* ready_semaphore_; | 129 v8::base::Semaphore* ready_semaphore_; |
131 int session_id_; | 130 int session_id_; |
132 v8::internal::Vector<uint16_t>* state_; | 131 v8::internal::Vector<uint16_t>* state_; |
133 }; | 132 }; |
134 | 133 |
135 class SendMessageToBackendTask : public TaskRunner::Task { | 134 class SendMessageToBackendTask : public TaskRunner::Task { |
136 public: | 135 public: |
137 explicit SendMessageToBackendTask( | 136 explicit SendMessageToBackendTask( |
138 int session_id, const v8::internal::Vector<uint16_t>& message) | 137 int session_id, const v8::internal::Vector<uint16_t>& message) |
139 : session_id_(session_id), message_(message) {} | 138 : session_id_(session_id), message_(message) {} |
140 bool is_inspector_task() final { return true; } | 139 bool is_inspector_task() final { return true; } |
141 | 140 |
142 private: | 141 private: |
143 void Run() override { | 142 void Run() override { |
144 v8_inspector::StringView message_view(message_.start(), message_.length()); | 143 v8_inspector::StringView message_view(message_.start(), message_.length()); |
145 data()->inspector()->SendMessage(session_id_, message_view); | 144 data()->SendMessage(session_id_, message_view); |
146 } | 145 } |
147 | 146 |
148 int session_id_; | 147 int session_id_; |
149 v8::internal::Vector<uint16_t> message_; | 148 v8::internal::Vector<uint16_t> message_; |
150 }; | 149 }; |
151 | 150 |
152 class SchedulePauseOnNextStatementTask : public TaskRunner::Task { | 151 class SchedulePauseOnNextStatementTask : public TaskRunner::Task { |
153 public: | 152 public: |
154 SchedulePauseOnNextStatementTask( | 153 SchedulePauseOnNextStatementTask( |
155 v8::base::Semaphore* ready_semaphore, int context_group_id, | 154 v8::base::Semaphore* ready_semaphore, int context_group_id, |
156 const v8::internal::Vector<uint16_t>& reason, | 155 const v8::internal::Vector<uint16_t>& reason, |
157 const v8::internal::Vector<uint16_t>& details) | 156 const v8::internal::Vector<uint16_t>& details) |
158 : ready_semaphore_(ready_semaphore), | 157 : ready_semaphore_(ready_semaphore), |
159 context_group_id_(context_group_id), | 158 context_group_id_(context_group_id), |
160 reason_(reason), | 159 reason_(reason), |
161 details_(details) {} | 160 details_(details) {} |
162 virtual ~SchedulePauseOnNextStatementTask() = default; | 161 virtual ~SchedulePauseOnNextStatementTask() = default; |
163 bool is_inspector_task() final { return true; } | 162 bool is_inspector_task() final { return true; } |
164 | 163 |
165 private: | 164 private: |
166 void Run() override { | 165 void Run() override { |
167 v8_inspector::StringView reason(reason_.start(), reason_.length()); | 166 v8_inspector::StringView reason(reason_.start(), reason_.length()); |
168 v8_inspector::StringView details(details_.start(), details_.length()); | 167 v8_inspector::StringView details(details_.start(), details_.length()); |
169 data()->inspector()->SchedulePauseOnNextStatement(context_group_id_, reason, | 168 data()->SchedulePauseOnNextStatement(context_group_id_, reason, details); |
170 details); | |
171 if (ready_semaphore_) ready_semaphore_->Signal(); | 169 if (ready_semaphore_) ready_semaphore_->Signal(); |
172 } | 170 } |
173 | 171 |
174 v8::base::Semaphore* ready_semaphore_; | 172 v8::base::Semaphore* ready_semaphore_; |
175 int context_group_id_; | 173 int context_group_id_; |
176 const v8::internal::Vector<uint16_t>& reason_; | 174 const v8::internal::Vector<uint16_t>& reason_; |
177 const v8::internal::Vector<uint16_t>& details_; | 175 const v8::internal::Vector<uint16_t>& details_; |
178 }; | 176 }; |
179 | 177 |
180 class CancelPauseOnNextStatementTask : public TaskRunner::Task { | 178 class CancelPauseOnNextStatementTask : public TaskRunner::Task { |
181 public: | 179 public: |
182 CancelPauseOnNextStatementTask(v8::base::Semaphore* ready_semaphore, | 180 CancelPauseOnNextStatementTask(v8::base::Semaphore* ready_semaphore, |
183 int context_group_id) | 181 int context_group_id) |
184 : ready_semaphore_(ready_semaphore), | 182 : ready_semaphore_(ready_semaphore), |
185 context_group_id_(context_group_id) {} | 183 context_group_id_(context_group_id) {} |
186 virtual ~CancelPauseOnNextStatementTask() = default; | 184 virtual ~CancelPauseOnNextStatementTask() = default; |
187 bool is_inspector_task() final { return true; } | 185 bool is_inspector_task() final { return true; } |
188 | 186 |
189 private: | 187 private: |
190 void Run() override { | 188 void Run() override { |
191 data()->inspector()->CancelPauseOnNextStatement(context_group_id_); | 189 data()->CancelPauseOnNextStatement(context_group_id_); |
192 if (ready_semaphore_) ready_semaphore_->Signal(); | 190 if (ready_semaphore_) ready_semaphore_->Signal(); |
193 } | 191 } |
194 | 192 |
195 v8::base::Semaphore* ready_semaphore_; | 193 v8::base::Semaphore* ready_semaphore_; |
196 int context_group_id_; | 194 int context_group_id_; |
197 }; | 195 }; |
198 | 196 |
199 class SendMessageToFrontendTask : public TaskRunner::Task { | 197 class SendMessageToFrontendTask : public TaskRunner::Task { |
200 public: | 198 public: |
201 SendMessageToFrontendTask(int context_group_id, int session_id, | 199 SendMessageToFrontendTask(int context_group_id, int session_id, |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 args[3].As<v8::Int32>(), args[4].As<v8::Int32>(), | 403 args[3].As<v8::Int32>(), args[4].As<v8::Int32>(), |
406 args[5].As<v8::Boolean>())); | 404 args[5].As<v8::Boolean>())); |
407 } | 405 } |
408 | 406 |
409 static void SetCurrentTimeMSForTest( | 407 static void SetCurrentTimeMSForTest( |
410 const v8::FunctionCallbackInfo<v8::Value>& args) { | 408 const v8::FunctionCallbackInfo<v8::Value>& args) { |
411 if (args.Length() != 1 || !args[0]->IsNumber()) { | 409 if (args.Length() != 1 || !args[0]->IsNumber()) { |
412 fprintf(stderr, "Internal error: setCurrentTimeMSForTest(time)."); | 410 fprintf(stderr, "Internal error: setCurrentTimeMSForTest(time)."); |
413 Exit(); | 411 Exit(); |
414 } | 412 } |
415 backend_runner_->data()->inspector()->SetCurrentTimeMSForTest( | 413 backend_runner_->data()->SetCurrentTimeMS( |
416 args[0].As<v8::Number>()->Value()); | 414 args[0].As<v8::Number>()->Value()); |
417 } | 415 } |
418 | 416 |
419 static void SetMemoryInfoForTest( | 417 static void SetMemoryInfoForTest( |
420 const v8::FunctionCallbackInfo<v8::Value>& args) { | 418 const v8::FunctionCallbackInfo<v8::Value>& args) { |
421 if (args.Length() != 1) { | 419 if (args.Length() != 1) { |
422 fprintf(stderr, "Internal error: setMemoryInfoForTest(value)."); | 420 fprintf(stderr, "Internal error: setMemoryInfoForTest(value)."); |
423 Exit(); | 421 Exit(); |
424 } | 422 } |
425 backend_runner_->data()->inspector()->SetMemoryInfoForTest(args[0]); | 423 backend_runner_->data()->SetMemoryInfo(args[0]); |
426 } | 424 } |
427 | 425 |
428 static void SchedulePauseOnNextStatement( | 426 static void SchedulePauseOnNextStatement( |
429 const v8::FunctionCallbackInfo<v8::Value>& args) { | 427 const v8::FunctionCallbackInfo<v8::Value>& args) { |
430 if (args.Length() != 3 || !args[0]->IsInt32() || !args[1]->IsString() || | 428 if (args.Length() != 3 || !args[0]->IsInt32() || !args[1]->IsString() || |
431 !args[2]->IsString()) { | 429 !args[2]->IsString()) { |
432 fprintf(stderr, | 430 fprintf(stderr, |
433 "Internal error: schedulePauseOnNextStatement(context_group_id, " | 431 "Internal error: schedulePauseOnNextStatement(context_group_id, " |
434 "'reason', 'details')."); | 432 "'reason', 'details')."); |
435 Exit(); | 433 Exit(); |
(...skipping 18 matching lines...) Expand all Loading... |
454 &ready_semaphore, args[0].As<v8::Int32>()->Value())); | 452 &ready_semaphore, args[0].As<v8::Int32>()->Value())); |
455 ready_semaphore.Wait(); | 453 ready_semaphore.Wait(); |
456 } | 454 } |
457 | 455 |
458 static void SetLogConsoleApiMessageCalls( | 456 static void SetLogConsoleApiMessageCalls( |
459 const v8::FunctionCallbackInfo<v8::Value>& args) { | 457 const v8::FunctionCallbackInfo<v8::Value>& args) { |
460 if (args.Length() != 1 || !args[0]->IsBoolean()) { | 458 if (args.Length() != 1 || !args[0]->IsBoolean()) { |
461 fprintf(stderr, "Internal error: setLogConsoleApiMessageCalls(bool)."); | 459 fprintf(stderr, "Internal error: setLogConsoleApiMessageCalls(bool)."); |
462 Exit(); | 460 Exit(); |
463 } | 461 } |
464 backend_runner_->data()->inspector()->SetLogConsoleApiMessageCalls( | 462 backend_runner_->data()->SetLogConsoleApiMessageCalls( |
465 args[0].As<v8::Boolean>()->Value()); | 463 args[0].As<v8::Boolean>()->Value()); |
466 } | 464 } |
467 | 465 |
468 static void CreateContextGroup( | 466 static void CreateContextGroup( |
469 const v8::FunctionCallbackInfo<v8::Value>& args) { | 467 const v8::FunctionCallbackInfo<v8::Value>& args) { |
470 if (args.Length() != 0) { | 468 if (args.Length() != 0) { |
471 fprintf(stderr, "Internal error: createContextGroup()."); | 469 fprintf(stderr, "Internal error: createContextGroup()."); |
472 Exit(); | 470 Exit(); |
473 } | 471 } |
474 v8::base::Semaphore ready_semaphore(0); | 472 v8::base::Semaphore ready_semaphore(0); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 v8::FunctionTemplate::New( | 638 v8::FunctionTemplate::New( |
641 isolate, &InspectorExtension::AllowAccessorFormatting)); | 639 isolate, &InspectorExtension::AllowAccessorFormatting)); |
642 global->Set(ToV8String(isolate, "inspector"), inspector); | 640 global->Set(ToV8String(isolate, "inspector"), inspector); |
643 } | 641 } |
644 | 642 |
645 private: | 643 private: |
646 static void FireContextCreated( | 644 static void FireContextCreated( |
647 const v8::FunctionCallbackInfo<v8::Value>& args) { | 645 const v8::FunctionCallbackInfo<v8::Value>& args) { |
648 v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext(); | 646 v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext(); |
649 IsolateData* data = IsolateData::FromContext(context); | 647 IsolateData* data = IsolateData::FromContext(context); |
650 data->inspector()->ContextCreated(context, | 648 data->FireContextCreated(context, data->GetContextGroupId(context)); |
651 data->GetContextGroupId(context)); | |
652 } | 649 } |
653 | 650 |
654 static void FireContextDestroyed( | 651 static void FireContextDestroyed( |
655 const v8::FunctionCallbackInfo<v8::Value>& args) { | 652 const v8::FunctionCallbackInfo<v8::Value>& args) { |
656 v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext(); | 653 v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext(); |
657 IsolateData* data = IsolateData::FromContext(context); | 654 IsolateData* data = IsolateData::FromContext(context); |
658 data->inspector()->ContextDestroyed(context); | 655 data->FireContextDestroyed(context); |
659 } | 656 } |
660 | 657 |
661 static void SetMaxAsyncTaskStacks( | 658 static void SetMaxAsyncTaskStacks( |
662 const v8::FunctionCallbackInfo<v8::Value>& args) { | 659 const v8::FunctionCallbackInfo<v8::Value>& args) { |
663 if (args.Length() != 1 || !args[0]->IsInt32()) { | 660 if (args.Length() != 1 || !args[0]->IsInt32()) { |
664 fprintf(stderr, "Internal error: setMaxAsyncTaskStacks(max)."); | 661 fprintf(stderr, "Internal error: setMaxAsyncTaskStacks(max)."); |
665 Exit(); | 662 Exit(); |
666 } | 663 } |
667 v8_inspector::SetMaxAsyncTaskStacksForTest( | 664 v8_inspector::SetMaxAsyncTaskStacksForTest( |
668 IsolateData::FromContext(args.GetIsolate()->GetCurrentContext()) | 665 IsolateData::FromContext(args.GetIsolate()->GetCurrentContext()) |
669 ->inspector() | |
670 ->inspector(), | 666 ->inspector(), |
671 args[0].As<v8::Int32>()->Value()); | 667 args[0].As<v8::Int32>()->Value()); |
672 } | 668 } |
673 | 669 |
674 static void DumpAsyncTaskStacksStateForTest( | 670 static void DumpAsyncTaskStacksStateForTest( |
675 const v8::FunctionCallbackInfo<v8::Value>& args) { | 671 const v8::FunctionCallbackInfo<v8::Value>& args) { |
676 if (args.Length() != 0) { | 672 if (args.Length() != 0) { |
677 fprintf(stderr, "Internal error: dumpAsyncTaskStacksStateForTest()."); | 673 fprintf(stderr, "Internal error: dumpAsyncTaskStacksStateForTest()."); |
678 Exit(); | 674 Exit(); |
679 } | 675 } |
680 v8_inspector::DumpAsyncTaskStacksStateForTest( | 676 v8_inspector::DumpAsyncTaskStacksStateForTest( |
681 IsolateData::FromContext(args.GetIsolate()->GetCurrentContext()) | 677 IsolateData::FromContext(args.GetIsolate()->GetCurrentContext()) |
682 ->inspector() | |
683 ->inspector()); | 678 ->inspector()); |
684 } | 679 } |
685 | 680 |
686 static void BreakProgram(const v8::FunctionCallbackInfo<v8::Value>& args) { | 681 static void BreakProgram(const v8::FunctionCallbackInfo<v8::Value>& args) { |
687 if (args.Length() != 2 || !args[0]->IsString() || !args[1]->IsString()) { | 682 if (args.Length() != 2 || !args[0]->IsString() || !args[1]->IsString()) { |
688 fprintf(stderr, "Internal error: breakProgram('reason', 'details')."); | 683 fprintf(stderr, "Internal error: breakProgram('reason', 'details')."); |
689 Exit(); | 684 Exit(); |
690 } | 685 } |
691 v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext(); | 686 v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext(); |
692 IsolateData* data = IsolateData::FromContext(context); | 687 IsolateData* data = IsolateData::FromContext(context); |
693 v8::internal::Vector<uint16_t> reason = ToVector(args[0].As<v8::String>()); | 688 v8::internal::Vector<uint16_t> reason = ToVector(args[0].As<v8::String>()); |
694 v8_inspector::StringView reason_view(reason.start(), reason.length()); | 689 v8_inspector::StringView reason_view(reason.start(), reason.length()); |
695 v8::internal::Vector<uint16_t> details = ToVector(args[1].As<v8::String>()); | 690 v8::internal::Vector<uint16_t> details = ToVector(args[1].As<v8::String>()); |
696 v8_inspector::StringView details_view(details.start(), details.length()); | 691 v8_inspector::StringView details_view(details.start(), details.length()); |
697 data->inspector()->BreakProgram(data->GetContextGroupId(context), | 692 data->BreakProgram(data->GetContextGroupId(context), reason_view, |
698 reason_view, details_view); | 693 details_view); |
699 } | 694 } |
700 | 695 |
701 static void CreateObjectWithStrictCheck( | 696 static void CreateObjectWithStrictCheck( |
702 const v8::FunctionCallbackInfo<v8::Value>& args) { | 697 const v8::FunctionCallbackInfo<v8::Value>& args) { |
703 if (args.Length() != 0) { | 698 if (args.Length() != 0) { |
704 fprintf(stderr, "Internal error: createObjectWithStrictCheck()."); | 699 fprintf(stderr, "Internal error: createObjectWithStrictCheck()."); |
705 Exit(); | 700 Exit(); |
706 } | 701 } |
707 v8::Local<v8::ObjectTemplate> templ = | 702 v8::Local<v8::ObjectTemplate> templ = |
708 v8::ObjectTemplate::New(args.GetIsolate()); | 703 v8::ObjectTemplate::New(args.GetIsolate()); |
(...skipping 11 matching lines...) Expand all Loading... |
720 "Internal error: callWithScheduledBreak('reason', 'details')."); | 715 "Internal error: callWithScheduledBreak('reason', 'details')."); |
721 Exit(); | 716 Exit(); |
722 } | 717 } |
723 v8::internal::Vector<uint16_t> reason = ToVector(args[1].As<v8::String>()); | 718 v8::internal::Vector<uint16_t> reason = ToVector(args[1].As<v8::String>()); |
724 v8_inspector::StringView reason_view(reason.start(), reason.length()); | 719 v8_inspector::StringView reason_view(reason.start(), reason.length()); |
725 v8::internal::Vector<uint16_t> details = ToVector(args[2].As<v8::String>()); | 720 v8::internal::Vector<uint16_t> details = ToVector(args[2].As<v8::String>()); |
726 v8_inspector::StringView details_view(details.start(), details.length()); | 721 v8_inspector::StringView details_view(details.start(), details.length()); |
727 v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext(); | 722 v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext(); |
728 IsolateData* data = IsolateData::FromContext(context); | 723 IsolateData* data = IsolateData::FromContext(context); |
729 int context_group_id = data->GetContextGroupId(context); | 724 int context_group_id = data->GetContextGroupId(context); |
730 data->inspector()->SchedulePauseOnNextStatement(context_group_id, | 725 data->SchedulePauseOnNextStatement(context_group_id, reason_view, |
731 reason_view, details_view); | 726 details_view); |
732 v8::MaybeLocal<v8::Value> result; | 727 v8::MaybeLocal<v8::Value> result; |
733 result = args[0].As<v8::Function>()->Call(context, context->Global(), 0, | 728 result = args[0].As<v8::Function>()->Call(context, context->Global(), 0, |
734 nullptr); | 729 nullptr); |
735 data->inspector()->CancelPauseOnNextStatement(context_group_id); | 730 data->CancelPauseOnNextStatement(context_group_id); |
736 } | 731 } |
737 | 732 |
738 static void AllowAccessorFormatting( | 733 static void AllowAccessorFormatting( |
739 const v8::FunctionCallbackInfo<v8::Value>& args) { | 734 const v8::FunctionCallbackInfo<v8::Value>& args) { |
740 if (args.Length() != 1 || !args[0]->IsObject()) { | 735 if (args.Length() != 1 || !args[0]->IsObject()) { |
741 fprintf(stderr, "Internal error: allowAccessorFormatting('object')."); | 736 fprintf(stderr, "Internal error: allowAccessorFormatting('object')."); |
742 Exit(); | 737 Exit(); |
743 } | 738 } |
744 v8::Local<v8::Object> object = args[0].As<v8::Object>(); | 739 v8::Local<v8::Object> object = args[0].As<v8::Object>(); |
745 v8::Isolate* isolate = args.GetIsolate(); | 740 v8::Isolate* isolate = args.GetIsolate(); |
746 v8::Local<v8::Private> shouldFormatAccessorsPrivate = v8::Private::ForApi( | 741 v8::Local<v8::Private> shouldFormatAccessorsPrivate = v8::Private::ForApi( |
747 isolate, v8::String::NewFromUtf8(isolate, "allowAccessorFormatting", | 742 isolate, v8::String::NewFromUtf8(isolate, "allowAccessorFormatting", |
748 v8::NewStringType::kNormal) | 743 v8::NewStringType::kNormal) |
749 .ToLocalChecked()); | 744 .ToLocalChecked()); |
750 object | 745 object |
751 ->SetPrivate(isolate->GetCurrentContext(), shouldFormatAccessorsPrivate, | 746 ->SetPrivate(isolate->GetCurrentContext(), shouldFormatAccessorsPrivate, |
752 v8::Null(isolate)) | 747 v8::Null(isolate)) |
753 .ToChecked(); | 748 .ToChecked(); |
754 } | 749 } |
755 }; | 750 }; |
756 | 751 |
757 class FrontendChannelImpl : public InspectorClientImpl::FrontendChannel { | 752 class FrontendChannelImpl : public IsolateData::FrontendChannel { |
758 public: | 753 public: |
759 FrontendChannelImpl(TaskRunner* frontend_task_runner, int context_group_id) | 754 FrontendChannelImpl(TaskRunner* frontend_task_runner, int context_group_id) |
760 : frontend_task_runner_(frontend_task_runner), | 755 : frontend_task_runner_(frontend_task_runner), |
761 context_group_id_(context_group_id) {} | 756 context_group_id_(context_group_id) {} |
762 virtual ~FrontendChannelImpl() {} | 757 virtual ~FrontendChannelImpl() {} |
763 | 758 |
764 void SendMessageToFrontend(int session_id, | 759 void SendMessageToFrontend(int session_id, |
765 const v8_inspector::StringView& message) final { | 760 const v8_inspector::StringView& message) final { |
766 frontend_task_runner_->Append(new SendMessageToFrontendTask( | 761 frontend_task_runner_->Append(new SendMessageToFrontendTask( |
767 context_group_id_, session_id, ToVector(message))); | 762 context_group_id_, session_id, ToVector(message))); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 frontend_runner.Append( | 829 frontend_runner.Append( |
835 new ExecuteStringTask(chars, frontend_context_group_id)); | 830 new ExecuteStringTask(chars, frontend_context_group_id)); |
836 } | 831 } |
837 | 832 |
838 frontend_runner.Join(); | 833 frontend_runner.Join(); |
839 backend_runner.Join(); | 834 backend_runner.Join(); |
840 | 835 |
841 delete startup_data.data; | 836 delete startup_data.data; |
842 return 0; | 837 return 0; |
843 } | 838 } |
OLD | NEW |