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 21 matching lines...) Expand all Loading... |
32 DCHECK(sync_message_filter_.get()); | 32 DCHECK(sync_message_filter_.get()); |
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 | |
43 // 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. | |
45 // 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 | |
47 // 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 | |
49 // automatically. We used to watch the object handle on Windows to do this, | |
50 // but it wasn't possible to do so on POSIX. | |
51 channel_->ClearIPCMessageLoop(); | |
52 } | 42 } |
53 | 43 |
54 void ServiceIPCServer::OnChannelConnected(int32 peer_pid) { | 44 void ServiceIPCServer::OnChannelConnected(int32 peer_pid) { |
55 DCHECK(!client_connected_); | 45 DCHECK(!client_connected_); |
56 client_connected_ = true; | 46 client_connected_ = true; |
57 } | 47 } |
58 | 48 |
59 void ServiceIPCServer::OnChannelError() { | 49 void ServiceIPCServer::OnChannelError() { |
60 // When a client (typically a browser process) disconnects, the pipe is | 50 // When a client (typically a browser process) disconnects, the pipe is |
61 // closed and we get an OnChannelError. Since we want to keep servicing | 51 // 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 } | 144 } |
155 | 145 |
156 void ServiceIPCServer::OnEnableVirtualDriver() { | 146 void ServiceIPCServer::OnEnableVirtualDriver() { |
157 g_service_process->EnableVirtualPrintDriver(); | 147 g_service_process->EnableVirtualPrintDriver(); |
158 } | 148 } |
159 | 149 |
160 void ServiceIPCServer::OnDisableVirtualDriver() { | 150 void ServiceIPCServer::OnDisableVirtualDriver() { |
161 g_service_process->DisableVirtualPrintDriver(); | 151 g_service_process->DisableVirtualPrintDriver(); |
162 } | 152 } |
163 | 153 |
OLD | NEW |