| 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 "chrome/common/service_messages.h" | 9 #include "chrome/common/service_messages.h" |
| 9 #include "ipc/ipc_logging.h" | 10 #include "ipc/ipc_logging.h" |
| 10 | 11 |
| 11 ServiceIPCServer::ServiceIPCServer( | 12 ServiceIPCServer::ServiceIPCServer( |
| 12 Client* client, | 13 Client* client, |
| 13 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, | 14 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, |
| 14 const IPC::ChannelHandle& channel_handle, | 15 const IPC::ChannelHandle& channel_handle, |
| 15 base::WaitableEvent* shutdown_event) | 16 base::WaitableEvent* shutdown_event) |
| 16 : client_(client), | 17 : client_(client), |
| 17 io_task_runner_(io_task_runner), | 18 io_task_runner_(io_task_runner), |
| (...skipping 22 matching lines...) Expand all Loading... |
| 40 true /* create_pipe_now */, | 41 true /* create_pipe_now */, |
| 41 shutdown_event_); | 42 shutdown_event_); |
| 42 } | 43 } |
| 43 | 44 |
| 44 ServiceIPCServer::~ServiceIPCServer() { | 45 ServiceIPCServer::~ServiceIPCServer() { |
| 45 #ifdef IPC_MESSAGE_LOG_ENABLED | 46 #ifdef IPC_MESSAGE_LOG_ENABLED |
| 46 IPC::Logging::GetInstance()->SetIPCSender(NULL); | 47 IPC::Logging::GetInstance()->SetIPCSender(NULL); |
| 47 #endif | 48 #endif |
| 48 } | 49 } |
| 49 | 50 |
| 50 void ServiceIPCServer::OnChannelConnected(int32 peer_pid) { | 51 void ServiceIPCServer::OnChannelConnected(int32_t peer_pid) { |
| 51 DCHECK(!ipc_client_connected_); | 52 DCHECK(!ipc_client_connected_); |
| 52 ipc_client_connected_ = true; | 53 ipc_client_connected_ = true; |
| 53 } | 54 } |
| 54 | 55 |
| 55 void ServiceIPCServer::OnChannelError() { | 56 void ServiceIPCServer::OnChannelError() { |
| 56 // When an IPC client (typically a browser process) disconnects, the pipe is | 57 // When an IPC client (typically a browser process) disconnects, the pipe is |
| 57 // closed and we get an OnChannelError. If we want to keep servicing requests, | 58 // closed and we get an OnChannelError. If we want to keep servicing requests, |
| 58 // we will recreate the channel if necessary. | 59 // we will recreate the channel if necessary. |
| 59 bool client_was_connected = ipc_client_connected_; | 60 bool client_was_connected = ipc_client_connected_; |
| 60 ipc_client_connected_ = false; | 61 ipc_client_connected_ = false; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 channel_->Send(new ServiceHostMsg_Histograms(deltas)); | 127 channel_->Send(new ServiceHostMsg_Histograms(deltas)); |
| 127 } | 128 } |
| 128 | 129 |
| 129 void ServiceIPCServer::OnShutdown() { | 130 void ServiceIPCServer::OnShutdown() { |
| 130 client_->OnShutdown(); | 131 client_->OnShutdown(); |
| 131 } | 132 } |
| 132 | 133 |
| 133 void ServiceIPCServer::OnUpdateAvailable() { | 134 void ServiceIPCServer::OnUpdateAvailable() { |
| 134 client_->OnUpdateAvailable(); | 135 client_->OnUpdateAvailable(); |
| 135 } | 136 } |
| OLD | NEW |