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

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

Issue 10944038: Don't crash the renderer if the plugin crashes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | « no previous file | no next file » | 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) 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 "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 {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #if defined(OS_POSIX) && !defined(OS_NACL) 43 #if defined(OS_POSIX) && !defined(OS_NACL)
44 int ProxyChannel::TakeRendererFD() { 44 int ProxyChannel::TakeRendererFD() {
45 DCHECK(channel()); 45 DCHECK(channel());
46 return channel()->TakeClientFileDescriptor(); 46 return channel()->TakeClientFileDescriptor();
47 } 47 }
48 #endif 48 #endif
49 49
50 IPC::PlatformFileForTransit ProxyChannel::ShareHandleWithRemote( 50 IPC::PlatformFileForTransit ProxyChannel::ShareHandleWithRemote(
51 base::PlatformFile handle, 51 base::PlatformFile handle,
52 bool should_close_source) { 52 bool should_close_source) {
53 // Channel could be closed if the plugin crashes.
54 if (!channel_.get())
55 return IPC::InvalidPlatformFileForTransit();
53 return delegate_->ShareHandleWithRemote(handle, *channel_, 56 return delegate_->ShareHandleWithRemote(handle, *channel_,
54 should_close_source); 57 should_close_source);
55 } 58 }
56 59
57 bool ProxyChannel::Send(IPC::Message* msg) { 60 bool ProxyChannel::Send(IPC::Message* msg) {
58 if (test_sink_) 61 if (test_sink_)
59 return test_sink_->Send(msg); 62 return test_sink_->Send(msg);
60 if (channel_.get()) 63 if (channel_.get())
61 return channel_->Send(msg); 64 return channel_->Send(msg);
62 65
63 // Remote side crashed, drop this message. 66 // Remote side crashed, drop this message.
64 delete msg; 67 delete msg;
65 return false; 68 return false;
66 } 69 }
67 70
68 } // namespace proxy 71 } // namespace proxy
69 } // namespace ppapi 72 } // namespace ppapi
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698