Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: avoid std::make_unique #20386

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/inspector_agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,9 @@ class NodeInspectorClient : public V8InspectorClient {
int connectFrontend(std::unique_ptr<InspectorSessionDelegate> delegate) {
events_dispatched_ = true;
int session_id = next_session_id_++;
channels_[session_id] =
std::make_unique<ChannelImpl>(client_, std::move(delegate));
// TODO(addaleax): Revert back to using make_unique once we get issues
// with CI resolved (i.e. revert the patch that added this comment).
channels_[session_id].reset(new ChannelImpl(client_, std::move(delegate)));
return session_id;
}

Expand Down Expand Up @@ -569,7 +570,8 @@ void Agent::Stop() {
std::unique_ptr<InspectorSession> Agent::Connect(
std::unique_ptr<InspectorSessionDelegate> delegate) {
int session_id = client_->connectFrontend(std::move(delegate));
return std::make_unique<InspectorSession>(session_id, client_);
return std::unique_ptr<InspectorSession>(
new InspectorSession(session_id, client_));
}

void Agent::WaitForDisconnect() {
Expand Down
4 changes: 2 additions & 2 deletions src/inspector_io.cc
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,8 @@ std::vector<std::string> InspectorIo::GetTargetIds() const {
TransportAction InspectorIo::Attach(int session_id) {
Agent* agent = parent_env_->inspector_agent();
fprintf(stderr, "Debugger attached.\n");
sessions_[session_id] =
agent->Connect(std::make_unique<IoSessionDelegate>(this, session_id));
sessions_[session_id] = agent->Connect(std::unique_ptr<IoSessionDelegate>(
new IoSessionDelegate(this, session_id)));
return TransportAction::kAcceptSession;
}

Expand Down
4 changes: 2 additions & 2 deletions src/inspector_js_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ class JSBindingsConnection : public AsyncWrap {
callback_(env->isolate(), callback) {
Wrap(wrap, this);
Agent* inspector = env->inspector_agent();
session_ = inspector->Connect(
std::make_unique<JSBindingsSessionDelegate>(env, this));
session_ = inspector->Connect(std::unique_ptr<JSBindingsSessionDelegate>(
new JSBindingsSessionDelegate(env, this)));
}

void OnMessage(Local<Value> value) {
Expand Down