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

Side by Side Diff: ppapi/proxy/proxy_channel.cc

Issue 310853003: Add IPC::ChannelProxy::Create() and IPC::SyncChannel::Create() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 "ppapi/proxy/proxy_channel.h" 5 #include "ppapi/proxy/proxy_channel.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ipc/ipc_platform_file.h" 8 #include "ipc/ipc_platform_file.h"
9 #include "ipc/ipc_test_sink.h" 9 #include "ipc/ipc_test_sink.h"
10 10
(...skipping 13 matching lines...) Expand all
24 ProxyChannel::~ProxyChannel() { 24 ProxyChannel::~ProxyChannel() {
25 DVLOG(1) << "ProxyChannel::~ProxyChannel()"; 25 DVLOG(1) << "ProxyChannel::~ProxyChannel()";
26 } 26 }
27 27
28 bool ProxyChannel::InitWithChannel(Delegate* delegate, 28 bool ProxyChannel::InitWithChannel(Delegate* delegate,
29 base::ProcessId peer_pid, 29 base::ProcessId peer_pid,
30 const IPC::ChannelHandle& channel_handle, 30 const IPC::ChannelHandle& channel_handle,
31 bool is_client) { 31 bool is_client) {
32 delegate_ = delegate; 32 delegate_ = delegate;
33 peer_pid_ = peer_pid; 33 peer_pid_ = peer_pid;
34 IPC::Channel::Mode mode = is_client ? IPC::Channel::MODE_CLIENT 34 channel_ = IPC::SyncChannel::Create(
35 : IPC::Channel::MODE_SERVER; 35 this, delegate->GetIPCMessageLoop(), delegate->GetShutdownEvent());
36 channel_.reset(new IPC::SyncChannel(channel_handle, mode, this, 36 channel_->Init(
37 delegate->GetIPCMessageLoop(), true, 37 channel_handle,
38 delegate->GetShutdownEvent())); 38 is_client ? IPC::Channel::MODE_CLIENT : IPC::Channel::MODE_SERVER,
39 true);
jam 2014/06/03 17:30:41 ditto
Hajime Morrita 2014/06/03 18:01:59 Done.
39 return true; 40 return true;
40 } 41 }
41 42
42 void ProxyChannel::InitWithTestSink(IPC::TestSink* test_sink) { 43 void ProxyChannel::InitWithTestSink(IPC::TestSink* test_sink) {
43 DCHECK(!test_sink_); 44 DCHECK(!test_sink_);
44 test_sink_ = test_sink; 45 test_sink_ = test_sink;
45 #if !defined(OS_NACL) 46 #if !defined(OS_NACL)
46 peer_pid_ = base::GetCurrentProcId(); 47 peer_pid_ = base::GetCurrentProcId();
47 #endif 48 #endif
48 } 49 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 if (channel_.get()) 84 if (channel_.get())
84 return channel_->Send(msg); 85 return channel_->Send(msg);
85 86
86 // Remote side crashed, drop this message. 87 // Remote side crashed, drop this message.
87 delete msg; 88 delete msg;
88 return false; 89 return false;
89 } 90 }
90 91
91 } // namespace proxy 92 } // namespace proxy
92 } // namespace ppapi 93 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698