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

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

Issue 310853003: Add IPC::ChannelProxy::Create() and IPC::SyncChannel::Create() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Landing 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::Create(
30 channel_handle_, 30 channel_handle_,
31 IPC::Channel::MODE_NAMED_SERVER, 31 IPC::Channel::MODE_NAMED_SERVER,
32 this, 32 this,
33 g_service_process->io_thread()->message_loop_proxy().get(), 33 g_service_process->io_thread()->message_loop_proxy().get(),
34 true, 34 true,
35 g_service_process->shutdown_event())); 35 g_service_process->shutdown_event());
36 DCHECK(sync_message_filter_.get()); 36 DCHECK(sync_message_filter_.get());
37 channel_->AddFilter(sync_message_filter_.get()); 37 channel_->AddFilter(sync_message_filter_.get());
38 } 38 }
39 39
40 ServiceIPCServer::~ServiceIPCServer() { 40 ServiceIPCServer::~ServiceIPCServer() {
41 #ifdef IPC_MESSAGE_LOG_ENABLED 41 #ifdef IPC_MESSAGE_LOG_ENABLED
42 IPC::Logging::GetInstance()->SetIPCSender(NULL); 42 IPC::Logging::GetInstance()->SetIPCSender(NULL);
43 #endif 43 #endif
44 44
45 channel_->RemoveFilter(sync_message_filter_.get()); 45 channel_->RemoveFilter(sync_message_filter_.get());
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 } 147 }
148 148
149 void ServiceIPCServer::OnShutdown() { 149 void ServiceIPCServer::OnShutdown() {
150 g_service_process->Shutdown(); 150 g_service_process->Shutdown();
151 } 151 }
152 152
153 void ServiceIPCServer::OnUpdateAvailable() { 153 void ServiceIPCServer::OnUpdateAvailable() {
154 g_service_process->SetUpdateAvailable(); 154 g_service_process->SetUpdateAvailable();
155 } 155 }
156 156
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