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

Side by Side Diff: components/nacl/renderer/trusted_plugin_channel.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/nacl/renderer/trusted_plugin_channel.h" 5 #include "components/nacl/renderer/trusted_plugin_channel.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "content/public/renderer/render_thread.h" 8 #include "content/public/renderer/render_thread.h"
9 #include "ipc/ipc_channel.h" 9 #include "ipc/ipc_channel.h"
10 #include "ipc/ipc_sync_channel.h" 10 #include "ipc/ipc_sync_channel.h"
11 #include "ppapi/c/pp_errors.h" 11 #include "ppapi/c/pp_errors.h"
12 12
13 namespace nacl { 13 namespace nacl {
14 14
15 TrustedPluginChannel::TrustedPluginChannel( 15 TrustedPluginChannel::TrustedPluginChannel(
16 const IPC::ChannelHandle& handle, 16 const IPC::ChannelHandle& handle,
17 const base::Callback<void(int32_t)>& connected_callback, 17 const base::Callback<void(int32_t)>& connected_callback,
18 base::WaitableEvent* waitable_event) 18 base::WaitableEvent* waitable_event)
19 : connected_callback_(connected_callback), 19 : connected_callback_(connected_callback),
20 channel_(new IPC::SyncChannel( 20 channel_(IPC::SyncChannel::Create(
21 handle, IPC::Channel::MODE_CLIENT, this, 21 handle,
22 content::RenderThread::Get()->GetIOMessageLoopProxy(), true, 22 IPC::Channel::MODE_CLIENT,
23 this,
24 content::RenderThread::Get()->GetIOMessageLoopProxy(),
25 true,
23 waitable_event)) { 26 waitable_event)) {
24 } 27 }
25 28
26 TrustedPluginChannel::~TrustedPluginChannel() { 29 TrustedPluginChannel::~TrustedPluginChannel() {
27 if (!connected_callback_.is_null()) 30 if (!connected_callback_.is_null())
28 base::ResetAndReturn(&connected_callback_).Run(PP_ERROR_FAILED); 31 base::ResetAndReturn(&connected_callback_).Run(PP_ERROR_FAILED);
29 } 32 }
30 33
31 bool TrustedPluginChannel::Send(IPC::Message* message) { 34 bool TrustedPluginChannel::Send(IPC::Message* message) {
32 return channel_->Send(message); 35 return channel_->Send(message);
33 } 36 }
34 37
35 bool TrustedPluginChannel::OnMessageReceived(const IPC::Message& message) { 38 bool TrustedPluginChannel::OnMessageReceived(const IPC::Message& message) {
36 return false; 39 return false;
37 } 40 }
38 41
39 void TrustedPluginChannel::OnChannelConnected(int32 peer_pid) { 42 void TrustedPluginChannel::OnChannelConnected(int32 peer_pid) {
40 if (!connected_callback_.is_null()) 43 if (!connected_callback_.is_null())
41 base::ResetAndReturn(&connected_callback_).Run(PP_OK); 44 base::ResetAndReturn(&connected_callback_).Run(PP_OK);
42 } 45 }
43 46
44 void TrustedPluginChannel::OnChannelError() { 47 void TrustedPluginChannel::OnChannelError() {
45 if (!connected_callback_.is_null()) 48 if (!connected_callback_.is_null())
46 base::ResetAndReturn(&connected_callback_).Run(PP_ERROR_FAILED); 49 base::ResetAndReturn(&connected_callback_).Run(PP_ERROR_FAILED);
47 } 50 }
48 51
49 } // namespace nacl 52 } // namespace nacl
OLDNEW
« no previous file with comments | « components/nacl/renderer/manifest_service_channel.cc ('k') | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698