Skip to content

Commit 58be6ef

Browse files
addaleaxMylesBorins
authored andcommitted
src: avoid std::make_unique
Work around nodejs/build#1254, which effectively breaks stress test CI and CITGM, by avoiding `std::make_unique` for now. This workaround should be reverted once that issue is resolved. Refs: nodejs/build#1254 PR-URL: #20386 Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Matheus Marchini <[email protected]>
1 parent de9d1f1 commit 58be6ef

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/inspector_agent.cc

+5-3
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,9 @@ class NodeInspectorClient : public V8InspectorClient {
367367
int connectFrontend(std::unique_ptr<InspectorSessionDelegate> delegate) {
368368
events_dispatched_ = true;
369369
int session_id = next_session_id_++;
370-
channels_[session_id] =
371-
std::make_unique<ChannelImpl>(client_, std::move(delegate));
370+
// TODO(addaleax): Revert back to using make_unique once we get issues
371+
// with CI resolved (i.e. revert the patch that added this comment).
372+
channels_[session_id].reset(new ChannelImpl(client_, std::move(delegate)));
372373
return session_id;
373374
}
374375

@@ -569,7 +570,8 @@ void Agent::Stop() {
569570
std::unique_ptr<InspectorSession> Agent::Connect(
570571
std::unique_ptr<InspectorSessionDelegate> delegate) {
571572
int session_id = client_->connectFrontend(std::move(delegate));
572-
return std::make_unique<InspectorSession>(session_id, client_);
573+
return std::unique_ptr<InspectorSession>(
574+
new InspectorSession(session_id, client_));
573575
}
574576

575577
void Agent::WaitForDisconnect() {

src/inspector_io.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,8 @@ std::vector<std::string> InspectorIo::GetTargetIds() const {
357357
TransportAction InspectorIo::Attach(int session_id) {
358358
Agent* agent = parent_env_->inspector_agent();
359359
fprintf(stderr, "Debugger attached.\n");
360-
sessions_[session_id] =
361-
agent->Connect(std::make_unique<IoSessionDelegate>(this, session_id));
360+
sessions_[session_id] = agent->Connect(std::unique_ptr<IoSessionDelegate>(
361+
new IoSessionDelegate(this, session_id)));
362362
return TransportAction::kAcceptSession;
363363
}
364364

src/inspector_js_api.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ class JSBindingsConnection : public AsyncWrap {
6666
callback_(env->isolate(), callback) {
6767
Wrap(wrap, this);
6868
Agent* inspector = env->inspector_agent();
69-
session_ = inspector->Connect(
70-
std::make_unique<JSBindingsSessionDelegate>(env, this));
69+
session_ = inspector->Connect(std::unique_ptr<JSBindingsSessionDelegate>(
70+
new JSBindingsSessionDelegate(env, this)));
7171
}
7272

7373
void OnMessage(Local<Value> value) {

0 commit comments

Comments
 (0)