Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Side by Side Diff: chrome/service/service_ipc_server.cc

Issue 301973003: Introduce IPC::ChannelProxy::Create*() and IPC::SynChannel::Create*() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing mac build Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/common/service_messages.h" 8 #include "chrome/common/service_messages.h"
9 #include "chrome/service/cloud_print/cloud_print_proxy.h" 9 #include "chrome/service/cloud_print/cloud_print_proxy.h"
10 #include "chrome/service/service_process.h" 10 #include "chrome/service/service_process.h"
11 #include "ipc/ipc_logging.h" 11 #include "ipc/ipc_logging.h"
12 12
13 ServiceIPCServer::ServiceIPCServer(const IPC::ChannelHandle& channel_handle) 13 ServiceIPCServer::ServiceIPCServer(const IPC::ChannelHandle& channel_handle)
14 : channel_handle_(channel_handle), client_connected_(false) { 14 : channel_handle_(channel_handle), client_connected_(false) {
15 } 15 }
16 16
17 bool ServiceIPCServer::Init() { 17 bool ServiceIPCServer::Init() {
18 #ifdef IPC_MESSAGE_LOG_ENABLED 18 #ifdef IPC_MESSAGE_LOG_ENABLED
19 IPC::Logging::GetInstance()->SetIPCSender(this); 19 IPC::Logging::GetInstance()->SetIPCSender(this);
20 #endif 20 #endif
21 sync_message_filter_ = 21 sync_message_filter_ =
22 new IPC::SyncMessageFilter(g_service_process->shutdown_event()); 22 new IPC::SyncMessageFilter(g_service_process->shutdown_event());
23 CreateChannel(); 23 CreateChannel();
24 return true; 24 return true;
25 } 25 }
26 26
27 void ServiceIPCServer::CreateChannel() { 27 void ServiceIPCServer::CreateChannel() {
28 channel_.reset(NULL); // Tear down the existing channel, if any. 28 channel_.reset(NULL); // Tear down the existing channel, if any.
29 channel_.reset(new IPC::SyncChannel( 29 channel_= IPC::SyncChannel::CreateNamedServer(
30 channel_handle_, 30 channel_handle_,
31 IPC::Channel::MODE_NAMED_SERVER,
32 this, 31 this,
33 g_service_process->io_thread()->message_loop_proxy().get(), 32 g_service_process->io_thread()->message_loop_proxy().get(),
34 true, 33 true,
35 g_service_process->shutdown_event())); 34 g_service_process->shutdown_event());
36 DCHECK(sync_message_filter_.get()); 35 DCHECK(sync_message_filter_.get());
37 channel_->AddFilter(sync_message_filter_.get()); 36 channel_->AddFilter(sync_message_filter_.get());
38 } 37 }
39 38
40 ServiceIPCServer::~ServiceIPCServer() { 39 ServiceIPCServer::~ServiceIPCServer() {
41 #ifdef IPC_MESSAGE_LOG_ENABLED 40 #ifdef IPC_MESSAGE_LOG_ENABLED
42 IPC::Logging::GetInstance()->SetIPCSender(NULL); 41 IPC::Logging::GetInstance()->SetIPCSender(NULL);
43 #endif 42 #endif
44 43
45 channel_->RemoveFilter(sync_message_filter_.get()); 44 channel_->RemoveFilter(sync_message_filter_.get());
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 } 146 }
148 147
149 void ServiceIPCServer::OnShutdown() { 148 void ServiceIPCServer::OnShutdown() {
150 g_service_process->Shutdown(); 149 g_service_process->Shutdown();
151 } 150 }
152 151
153 void ServiceIPCServer::OnUpdateAvailable() { 152 void ServiceIPCServer::OnUpdateAvailable() {
154 g_service_process->SetUpdateAvailable(); 153 g_service_process->SetUpdateAvailable();
155 } 154 }
156 155
OLDNEW
« no previous file with comments | « chrome/browser/service_process/service_process_control.cc ('k') | components/nacl/browser/nacl_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698