| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 std::string& channel_name) | 12 ServiceIPCServer::ServiceIPCServer(const std::string& channel_name) |
| 13 : channel_name_(channel_name), client_connected_(false) { | 13 : channel_name_(channel_name), 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::current()->SetIPCSender(this); | 18 IPC::Logging::current()->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(new IPC::SyncChannel(channel_name_, | 27 channel_.reset(new IPC::SyncChannel(channel_name_, |
| 28 IPC::Channel::MODE_SERVER, this, NULL, | 28 IPC::Channel::MODE_SERVER, this, |
| 29 g_service_process->io_thread()->message_loop(), true, | 29 g_service_process->io_thread()->message_loop(), true, |
| 30 g_service_process->shutdown_event())); | 30 g_service_process->shutdown_event())); |
| 31 DCHECK(sync_message_filter_.get()); | 31 DCHECK(sync_message_filter_.get()); |
| 32 channel_->AddFilter(sync_message_filter_.get()); | 32 channel_->AddFilter(sync_message_filter_.get()); |
| 33 } | 33 } |
| 34 | 34 |
| 35 ServiceIPCServer::~ServiceIPCServer() { | 35 ServiceIPCServer::~ServiceIPCServer() { |
| 36 #ifdef IPC_MESSAGE_LOG_ENABLED | 36 #ifdef IPC_MESSAGE_LOG_ENABLED |
| 37 IPC::Logging::current()->SetIPCSender(NULL); | 37 IPC::Logging::current()->SetIPCSender(NULL); |
| 38 #endif | 38 #endif |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 } | 131 } |
| 132 | 132 |
| 133 void ServiceIPCServer::OnShutdown() { | 133 void ServiceIPCServer::OnShutdown() { |
| 134 g_service_process->Shutdown(); | 134 g_service_process->Shutdown(); |
| 135 } | 135 } |
| 136 | 136 |
| 137 void ServiceIPCServer::OnUpdateAvailable() { | 137 void ServiceIPCServer::OnUpdateAvailable() { |
| 138 g_service_process->SetUpdateAvailable(); | 138 g_service_process->SetUpdateAvailable(); |
| 139 } | 139 } |
| 140 | 140 |
| OLD | NEW |