diff --git a/shell/browser/api/message_port.cc b/shell/browser/api/message_port.cc index a81360b0f1da..a607349cbb4b 100644 --- a/shell/browser/api/message_port.cc +++ b/shell/browser/api/message_port.cc @@ -9,6 +9,7 @@ #include #include "base/containers/contains.h" +#include "base/containers/to_vector.h" #include "base/strings/string_number_conversions.h" #include "base/task/single_thread_task_runner.h" #include "gin/arguments.h" @@ -242,11 +243,7 @@ std::vector MessagePort::DisentanglePorts( } // Passed-in ports passed validity checks, so we can disentangle them. - std::vector channels; - channels.reserve(ports.size()); - for (auto port : ports) - channels.push_back(port->Disentangle()); - return channels; + return base::ToVector(ports, [](auto& port) { return port->Disentangle(); }); } void MessagePort::Pin() {