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

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

Issue 10378057: Broker out PPAPI handle duplication (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 7 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
« no previous file with comments | « ppapi/proxy/proxy_channel.h ('k') | webkit/fileapi/file_system_callback_dispatcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 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 "ipc/ipc_platform_file.h" 7 #include "ipc/ipc_platform_file.h"
8 #include "ipc/ipc_test_sink.h" 8 #include "ipc/ipc_test_sink.h"
9 9
10 namespace ppapi { 10 namespace ppapi {
11 namespace proxy { 11 namespace proxy {
12 12
13 ProxyChannel::ProxyChannel(base::ProcessHandle remote_process_handle) 13 ProxyChannel::ProxyChannel()
14 : delegate_(NULL), 14 : delegate_(NULL),
15 remote_process_handle_(remote_process_handle),
16 test_sink_(NULL) { 15 test_sink_(NULL) {
17 } 16 }
18 17
19 ProxyChannel::~ProxyChannel() { 18 ProxyChannel::~ProxyChannel() {
20 DVLOG(1) << "ProxyChannel::~ProxyChannel()"; 19 DVLOG(1) << "ProxyChannel::~ProxyChannel()";
21 } 20 }
22 21
23 bool ProxyChannel::InitWithChannel(Delegate* delegate, 22 bool ProxyChannel::InitWithChannel(Delegate* delegate,
24 const IPC::ChannelHandle& channel_handle, 23 const IPC::ChannelHandle& channel_handle,
25 bool is_client) { 24 bool is_client) {
(...skipping 18 matching lines...) Expand all
44 #if defined(OS_POSIX) 43 #if defined(OS_POSIX)
45 int ProxyChannel::TakeRendererFD() { 44 int ProxyChannel::TakeRendererFD() {
46 DCHECK(channel()); 45 DCHECK(channel());
47 return channel()->TakeClientFileDescriptor(); 46 return channel()->TakeClientFileDescriptor();
48 } 47 }
49 #endif 48 #endif
50 49
51 IPC::PlatformFileForTransit ProxyChannel::ShareHandleWithRemote( 50 IPC::PlatformFileForTransit ProxyChannel::ShareHandleWithRemote(
52 base::PlatformFile handle, 51 base::PlatformFile handle,
53 bool should_close_source) { 52 bool should_close_source) {
54 return IPC::GetFileHandleForProcess(handle, remote_process_handle_, 53 return delegate_->ShareHandleWithRemote(handle, *channel_,
55 should_close_source); 54 should_close_source);
56 } 55 }
57 56
58 bool ProxyChannel::Send(IPC::Message* msg) { 57 bool ProxyChannel::Send(IPC::Message* msg) {
59 if (test_sink_) 58 if (test_sink_)
60 return test_sink_->Send(msg); 59 return test_sink_->Send(msg);
61 if (channel_.get()) 60 if (channel_.get())
62 return channel_->Send(msg); 61 return channel_->Send(msg);
63 62
64 // Remote side crashed, drop this message. 63 // Remote side crashed, drop this message.
65 delete msg; 64 delete msg;
66 return false; 65 return false;
67 } 66 }
68 67
69 } // namespace proxy 68 } // namespace proxy
70 } // namespace ppapi 69 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/proxy_channel.h ('k') | webkit/fileapi/file_system_callback_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698