@@ -105,14 +105,9 @@ class CDPHandlerImpl : public message::RequestHandler,
105
105
public debugger::EventObserver,
106
106
public std::enable_shared_from_this<CDPHandlerImpl> {
107
107
public:
108
- CDPHandlerImpl (
109
- std::unique_ptr<RuntimeAdapter> adapter,
110
- const std::string &title,
111
- bool waitForDebugger);
108
+ CDPHandlerImpl (std::unique_ptr<RuntimeAdapter> adapter, bool waitForDebugger);
112
109
~CDPHandlerImpl () override ;
113
110
114
- std::string getTitle () const ;
115
-
116
111
bool registerCallbacks (
117
112
CDPMessageCallbackFunction msgCallback,
118
113
OnUnregisterFunction onUnregister);
@@ -336,7 +331,6 @@ class CDPHandlerImpl : public message::RequestHandler,
336
331
// / inside the CDP Handler without requiring \p RuntimeAdapter::getRuntime
337
332
// / to support use from arbitrary threads.
338
333
HermesRuntime &runtime_;
339
- const std::string title_;
340
334
341
335
// preparedScripts_ stores user-entered scripts that have been prepared for
342
336
// execution, and may be invoked by a later command.
@@ -428,11 +422,9 @@ class CDPHandlerImpl : public message::RequestHandler,
428
422
429
423
CDPHandlerImpl::CDPHandlerImpl (
430
424
std::unique_ptr<RuntimeAdapter> adapter,
431
- const std::string &title,
432
425
bool waitForDebugger)
433
426
: runtimeAdapter_(std::move(adapter)),
434
427
runtime_ (runtimeAdapter_->getRuntime ()),
435
- title_(title),
436
428
awaitingDebuggerOnStart_(waitForDebugger) {
437
429
// Install __tickleJs. Do this activity before the call to setEventObserver,
438
430
// so we don't get any didPause callback firings for these.
@@ -456,13 +448,6 @@ CDPHandlerImpl::~CDPHandlerImpl() {
456
448
// by other mutex
457
449
}
458
450
459
- std::string CDPHandlerImpl::getTitle () const {
460
- // This is a public function, but the mutex is not required
461
- // as we're just returning member that is unchanged for the
462
- // lifetime of this instance.
463
- return title_;
464
- }
465
-
466
451
bool CDPHandlerImpl::registerCallbacks (
467
452
CDPMessageCallbackFunction msgCallback,
468
453
OnUnregisterFunction onUnregister) {
@@ -1639,6 +1624,14 @@ bool CDPHandlerImpl::validateExecutionContext(
1639
1624
/*
1640
1625
* CDPHandler
1641
1626
*/
1627
+ std::shared_ptr<CDPHandler> CDPHandler::create (
1628
+ std::unique_ptr<RuntimeAdapter> adapter,
1629
+ bool waitForDebugger) {
1630
+ // Can't use make_shared here since the constructor is private.
1631
+ return std::shared_ptr<CDPHandler>(
1632
+ new CDPHandler (std::move (adapter), " " , waitForDebugger));
1633
+ }
1634
+
1642
1635
std::shared_ptr<CDPHandler> CDPHandler::create (
1643
1636
std::unique_ptr<RuntimeAdapter> adapter,
1644
1637
const std::string &title,
@@ -1654,15 +1647,15 @@ CDPHandler::CDPHandler(
1654
1647
bool waitForDebugger)
1655
1648
: impl_(std::make_shared<CDPHandlerImpl>(
1656
1649
std::move (adapter),
1657
- title ,
1658
- waitForDebugger) ) {
1650
+ waitForDebugger)) ,
1651
+ title_(title ) {
1659
1652
impl_->installLogHandler ();
1660
1653
}
1661
1654
1662
1655
CDPHandler::~CDPHandler () = default ;
1663
1656
1664
1657
std::string CDPHandler::getTitle () const {
1665
- return impl_-> getTitle () ;
1658
+ return title_ ;
1666
1659
}
1667
1660
1668
1661
bool CDPHandler::registerCallbacks (
0 commit comments