OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/service/service_ipc_server.h" | 5 #include "chrome/service/service_ipc_server.h" |
6 | 6 |
7 #include "base/metrics/histogram_delta_serialization.h" | 7 #include "base/metrics/histogram_delta_serialization.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "chrome/common/service_messages.h" | 9 #include "chrome/common/service_messages.h" |
10 #include "ipc/ipc_logging.h" | 10 #include "ipc/ipc_logging.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 bool ServiceIPCServer::Send(IPC::Message* msg) { | 80 bool ServiceIPCServer::Send(IPC::Message* msg) { |
81 if (!channel_.get()) { | 81 if (!channel_.get()) { |
82 delete msg; | 82 delete msg; |
83 return false; | 83 return false; |
84 } | 84 } |
85 | 85 |
86 return channel_->Send(msg); | 86 return channel_->Send(msg); |
87 } | 87 } |
88 | 88 |
89 void ServiceIPCServer::AddMessageHandler(scoped_ptr<MessageHandler> handler) { | 89 void ServiceIPCServer::AddMessageHandler( |
| 90 std::unique_ptr<MessageHandler> handler) { |
90 message_handlers_.push_back(handler.release()); | 91 message_handlers_.push_back(handler.release()); |
91 } | 92 } |
92 | 93 |
93 bool ServiceIPCServer::OnMessageReceived(const IPC::Message& msg) { | 94 bool ServiceIPCServer::OnMessageReceived(const IPC::Message& msg) { |
94 bool handled = true; | 95 bool handled = true; |
95 // When we get a message, always mark the IPC client as connected. The | 96 // When we get a message, always mark the IPC client as connected. The |
96 // ChannelProxy::Context is only letting OnChannelConnected get called once, | 97 // ChannelProxy::Context is only letting OnChannelConnected get called once, |
97 // so on Mac and Linux, we never would set ipc_client_connected_ to true | 98 // so on Mac and Linux, we never would set ipc_client_connected_ to true |
98 // again on subsequent connections. | 99 // again on subsequent connections. |
99 ipc_client_connected_ = true; | 100 ipc_client_connected_ = true; |
(...skipping 30 matching lines...) Expand all Loading... |
130 channel_->Send(new ServiceHostMsg_Histograms(deltas)); | 131 channel_->Send(new ServiceHostMsg_Histograms(deltas)); |
131 } | 132 } |
132 | 133 |
133 void ServiceIPCServer::OnShutdown() { | 134 void ServiceIPCServer::OnShutdown() { |
134 client_->OnShutdown(); | 135 client_->OnShutdown(); |
135 } | 136 } |
136 | 137 |
137 void ServiceIPCServer::OnUpdateAvailable() { | 138 void ServiceIPCServer::OnUpdateAvailable() { |
138 client_->OnUpdateAvailable(); | 139 client_->OnUpdateAvailable(); |
139 } | 140 } |
OLD | NEW |