Chromium Code Reviews| 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 "chrome/common/service_messages.h" | 7 #include "chrome/common/service_messages.h" |
| 8 #include "chrome/service/cloud_print/cloud_print_proxy.h" | 8 #include "chrome/service/cloud_print/cloud_print_proxy.h" |
| 9 #include "chrome/service/service_process.h" | 9 #include "chrome/service/service_process.h" |
| 10 #include "ipc/ipc_logging.h" | 10 #include "ipc/ipc_logging.h" |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 channel_->AddFilter(sync_message_filter_.get()); | 33 channel_->AddFilter(sync_message_filter_.get()); |
| 34 } | 34 } |
| 35 | 35 |
| 36 ServiceIPCServer::~ServiceIPCServer() { | 36 ServiceIPCServer::~ServiceIPCServer() { |
| 37 #ifdef IPC_MESSAGE_LOG_ENABLED | 37 #ifdef IPC_MESSAGE_LOG_ENABLED |
| 38 IPC::Logging::GetInstance()->SetIPCSender(NULL); | 38 IPC::Logging::GetInstance()->SetIPCSender(NULL); |
| 39 #endif | 39 #endif |
| 40 | 40 |
| 41 channel_->RemoveFilter(sync_message_filter_.get()); | 41 channel_->RemoveFilter(sync_message_filter_.get()); |
| 42 | 42 |
| 43 // TODO(sergeyu): The comment below is not up to date. Figure out if | |
|
jam
2012/07/01 22:19:41
this code block got copied even though it's not ne
Sergey Ulanov
2012/07/02 18:44:34
Done.
| |
| 44 // we still need this call and update the comment or remove it. | |
| 45 // | |
| 43 // The ChannelProxy object caches a pointer to the IPC thread, so need to | 46 // The ChannelProxy object caches a pointer to the IPC thread, so need to |
| 44 // reset it as it's not guaranteed to outlive this object. | 47 // reset it as it's not guaranteed to outlive this object. |
| 45 // NOTE: this also has the side-effect of not closing the main IPC channel to | 48 // NOTE: this also has the side-effect of not closing the main IPC channel to |
| 46 // the browser process. This is needed because this is the signal that the | 49 // the browser process. This is needed because this is the signal that the |
| 47 // browser uses to know that this process has died, so we need it to be alive | 50 // browser uses to know that this process has died, so we need it to be alive |
| 48 // until this process is shut down, and the OS closes the handle | 51 // until this process is shut down, and the OS closes the handle |
| 49 // automatically. We used to watch the object handle on Windows to do this, | 52 // automatically. We used to watch the object handle on Windows to do this, |
| 50 // but it wasn't possible to do so on POSIX. | 53 // but it wasn't possible to do so on POSIX. |
| 51 channel_->ClearIPCMessageLoop(); | 54 channel_->ClearIPCTaskRunner(); |
| 52 } | 55 } |
| 53 | 56 |
| 54 void ServiceIPCServer::OnChannelConnected(int32 peer_pid) { | 57 void ServiceIPCServer::OnChannelConnected(int32 peer_pid) { |
| 55 DCHECK(!client_connected_); | 58 DCHECK(!client_connected_); |
| 56 client_connected_ = true; | 59 client_connected_ = true; |
| 57 } | 60 } |
| 58 | 61 |
| 59 void ServiceIPCServer::OnChannelError() { | 62 void ServiceIPCServer::OnChannelError() { |
| 60 // When a client (typically a browser process) disconnects, the pipe is | 63 // When a client (typically a browser process) disconnects, the pipe is |
| 61 // closed and we get an OnChannelError. Since we want to keep servicing | 64 // closed and we get an OnChannelError. Since we want to keep servicing |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 } | 157 } |
| 155 | 158 |
| 156 void ServiceIPCServer::OnEnableVirtualDriver() { | 159 void ServiceIPCServer::OnEnableVirtualDriver() { |
| 157 g_service_process->EnableVirtualPrintDriver(); | 160 g_service_process->EnableVirtualPrintDriver(); |
| 158 } | 161 } |
| 159 | 162 |
| 160 void ServiceIPCServer::OnDisableVirtualDriver() { | 163 void ServiceIPCServer::OnDisableVirtualDriver() { |
| 161 g_service_process->DisableVirtualPrintDriver(); | 164 g_service_process->DisableVirtualPrintDriver(); |
| 162 } | 165 } |
| 163 | 166 |
| OLD | NEW |