Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6902)

Unified Diff: chrome/service/service_ipc_server.cc

Issue 2802973003: Remove ScopedVector from chrome/ (Closed)
Patch Set: Address comments from sky@ Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/service/service_ipc_server.h ('k') | chrome/utility/chrome_content_utility_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/service/service_ipc_server.cc
diff --git a/chrome/service/service_ipc_server.cc b/chrome/service/service_ipc_server.cc
index bcd3726080471a16f18a783504d2776ebecf2cd0..b8e81ea3838f3b67850e2ef7ab7fcc924cb87585 100644
--- a/chrome/service/service_ipc_server.cc
+++ b/chrome/service/service_ipc_server.cc
@@ -4,6 +4,8 @@
#include "chrome/service/service_ipc_server.h"
+#include <algorithm>
+
#include "base/metrics/histogram_delta_serialization.h"
#include "build/build_config.h"
#include "chrome/common/service_messages.h"
@@ -75,7 +77,7 @@ bool ServiceIPCServer::Send(IPC::Message* msg) {
void ServiceIPCServer::AddMessageHandler(
std::unique_ptr<MessageHandler> handler) {
- message_handlers_.push_back(handler.release());
+ message_handlers_.push_back(std::move(handler));
}
bool ServiceIPCServer::OnMessageReceived(const IPC::Message& msg) {
@@ -90,7 +92,11 @@ bool ServiceIPCServer::OnMessageReceived(const IPC::Message& msg) {
if (!handled) {
// Make a copy of the handlers to prevent modification during iteration.
- std::vector<MessageHandler*> temp_handlers = message_handlers_.get();
+ std::vector<MessageHandler*> temp_handlers;
+ temp_handlers.reserve(message_handlers_.size());
+ for (const auto& handler : message_handlers_)
+ temp_handlers.push_back(handler.get());
+
for (auto* handler : temp_handlers) {
handled = handler->HandleMessage(msg);
if (handled)
« no previous file with comments | « chrome/service/service_ipc_server.h ('k') | chrome/utility/chrome_content_utility_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698