@@ -328,8 +328,7 @@ class InspectorTimerHandle {
328
328
329
329
class NodeInspectorClient : public V8InspectorClient {
330
330
public:
331
- NodeInspectorClient (node::Environment* env, node::NodePlatform* platform)
332
- : env_(env), platform_(platform) {
331
+ explicit NodeInspectorClient (node::Environment* env) : env_(env) {
333
332
client_ = V8Inspector::create (env->isolate (), this );
334
333
// TODO(bnoordhuis) Make name configurable from src/node.cc.
335
334
ContextInfo info (GetHumanReadableProcessName ());
@@ -346,8 +345,9 @@ class NodeInspectorClient : public V8InspectorClient {
346
345
return ;
347
346
terminated_ = false ;
348
347
running_nested_loop_ = true ;
348
+ MultiIsolatePlatform* platform = env_->isolate_data ()->platform ();
349
349
while ((ignore_terminated || !terminated_) && waitForFrontendEvent ()) {
350
- while (platform_ ->FlushForegroundTasks (env_->isolate ())) {}
350
+ while (platform ->FlushForegroundTasks (env_->isolate ())) {}
351
351
}
352
352
terminated_ = false ;
353
353
running_nested_loop_ = false ;
@@ -514,7 +514,6 @@ class NodeInspectorClient : public V8InspectorClient {
514
514
515
515
private:
516
516
node::Environment* env_;
517
- node::NodePlatform* platform_;
518
517
bool terminated_ = false ;
519
518
bool running_nested_loop_ = false ;
520
519
std::unique_ptr<V8Inspector> client_;
@@ -524,25 +523,17 @@ class NodeInspectorClient : public V8InspectorClient {
524
523
bool events_dispatched_ = false ;
525
524
};
526
525
527
- Agent::Agent (Environment* env) : parent_env_(env),
528
- client_ (nullptr ),
529
- platform_(nullptr ),
530
- pending_enable_async_hook_(false ),
531
- pending_disable_async_hook_(false ) {}
526
+ Agent::Agent (Environment* env) : parent_env_(env) {}
532
527
533
528
// Destructor needs to be defined here in implementation file as the header
534
529
// does not have full definition of some classes.
535
530
Agent::~Agent () {
536
531
}
537
532
538
- bool Agent::Start (node::NodePlatform* platform, const char * path,
539
- const DebugOptions& options) {
533
+ bool Agent::Start (const char * path, const DebugOptions& options) {
540
534
path_ = path == nullptr ? " " : path;
541
535
debug_options_ = options;
542
- client_ =
543
- std::shared_ptr<NodeInspectorClient>(
544
- new NodeInspectorClient (parent_env_, platform));
545
- platform_ = platform;
536
+ client_ = std::make_shared<NodeInspectorClient>(parent_env_);
546
537
CHECK_EQ (0 , uv_async_init (uv_default_loop (),
547
538
&start_io_thread_async,
548
539
StartIoThreadAsyncCallback));
@@ -565,8 +556,7 @@ bool Agent::StartIoThread(bool wait_for_connect) {
565
556
CHECK_NOT_NULL (client_);
566
557
567
558
io_ = std::unique_ptr<InspectorIo>(
568
- new InspectorIo (parent_env_, platform_, path_, debug_options_,
569
- wait_for_connect));
559
+ new InspectorIo (parent_env_, path_, debug_options_, wait_for_connect));
570
560
if (!io_->Start ()) {
571
561
client_.reset ();
572
562
return false ;
@@ -716,7 +706,8 @@ void Agent::RequestIoThreadStart() {
716
706
// for IO events)
717
707
uv_async_send (&start_io_thread_async);
718
708
v8::Isolate* isolate = parent_env_->isolate ();
719
- platform_->CallOnForegroundThread (isolate, new StartIoTask (this ));
709
+ v8::Platform* platform = parent_env_->isolate_data ()->platform ();
710
+ platform->CallOnForegroundThread (isolate, new StartIoTask (this ));
720
711
isolate->RequestInterrupt (StartIoInterrupt, this );
721
712
uv_async_send (&start_io_thread_async);
722
713
}
0 commit comments