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" |
11 | 11 |
12 ServiceIPCServer::ServiceIPCServer(const IPC::ChannelHandle& channel_handle) | 12 ServiceIPCServer::ServiceIPCServer(const IPC::ChannelHandle& channel_handle) |
13 : channel_handle_(channel_handle), client_connected_(false) { | 13 : channel_handle_(channel_handle), client_connected_(false) { |
14 } | 14 } |
15 | 15 |
16 bool ServiceIPCServer::Init() { | 16 bool ServiceIPCServer::Init() { |
17 #ifdef IPC_MESSAGE_LOG_ENABLED | 17 #ifdef IPC_MESSAGE_LOG_ENABLED |
18 IPC::Logging::GetInstance()->SetIPCSender(this); | 18 IPC::Logging::GetInstance()->SetIPCSender(this); |
19 #endif | 19 #endif |
20 sync_message_filter_ = | 20 sync_message_filter_ = |
21 new IPC::SyncMessageFilter(g_service_process->shutdown_event()); | 21 new IPC::SyncMessageFilter(g_service_process->shutdown_event()); |
22 CreateChannel(); | 22 CreateChannel(); |
23 return true; | 23 return true; |
24 } | 24 } |
25 | 25 |
26 void ServiceIPCServer::CreateChannel() { | 26 void ServiceIPCServer::CreateChannel() { |
27 channel_.reset(NULL); // Tear down the existing channel, if any. | 27 channel_.reset(NULL); // Tear down the existing channel, if any. |
28 channel_.reset(new IPC::SyncChannel(channel_handle_, | 28 channel_.reset(new IPC::SyncChannel( |
29 IPC::Channel::MODE_NAMED_SERVER, this, | 29 channel_handle_, |
30 g_service_process->io_thread()->message_loop_proxy(), true, | 30 IPC::Channel::MODE_NAMED_SERVER, |
| 31 this, |
| 32 g_service_process->io_thread()->message_loop_proxy().get(), |
| 33 true, |
31 g_service_process->shutdown_event())); | 34 g_service_process->shutdown_event())); |
32 DCHECK(sync_message_filter_.get()); | 35 DCHECK(sync_message_filter_.get()); |
33 channel_->AddFilter(sync_message_filter_.get()); | 36 channel_->AddFilter(sync_message_filter_.get()); |
34 } | 37 } |
35 | 38 |
36 ServiceIPCServer::~ServiceIPCServer() { | 39 ServiceIPCServer::~ServiceIPCServer() { |
37 #ifdef IPC_MESSAGE_LOG_ENABLED | 40 #ifdef IPC_MESSAGE_LOG_ENABLED |
38 IPC::Logging::GetInstance()->SetIPCSender(NULL); | 41 IPC::Logging::GetInstance()->SetIPCSender(NULL); |
39 #endif | 42 #endif |
40 | 43 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 } | 134 } |
132 | 135 |
133 void ServiceIPCServer::OnShutdown() { | 136 void ServiceIPCServer::OnShutdown() { |
134 g_service_process->Shutdown(); | 137 g_service_process->Shutdown(); |
135 } | 138 } |
136 | 139 |
137 void ServiceIPCServer::OnUpdateAvailable() { | 140 void ServiceIPCServer::OnUpdateAvailable() { |
138 g_service_process->SetUpdateAvailable(); | 141 g_service_process->SetUpdateAvailable(); |
139 } | 142 } |
140 | 143 |
OLD | NEW |