summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorddorwin@chromium.org <ddorwin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-18 22:51:08 +0000
committerddorwin@chromium.org <ddorwin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-18 22:51:08 +0000
commit4b417e55e37a4d9d347a0dfbfc5350f55569819f (patch)
tree1e93f2f2510c8e1d7a596dbf9aaec4bdd8ed1f87 /ppapi
parent5d15b27b0e135a5353bd8150d42be1d1ed6d1871 (diff)
downloadchromium_src-4b417e55e37a4d9d347a0dfbfc5350f55569819f.zip
chromium_src-4b417e55e37a4d9d347a0dfbfc5350f55569819f.tar.gz
chromium_src-4b417e55e37a4d9d347a0dfbfc5350f55569819f.tar.bz2
Fix two bugs in proxying of Broker Connect callback and shutdown Broker when renderer exits.
BUG=none TEST=none Review URL: http://codereview.chromium.org/6882020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82017 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/proxy/broker_dispatcher.cc25
-rw-r--r--ppapi/proxy/broker_dispatcher.h15
-rw-r--r--ppapi/proxy/host_dispatcher.cc2
-rw-r--r--ppapi/proxy/plugin_dispatcher.cc4
-rw-r--r--ppapi/proxy/ppb_broker_proxy.cc4
-rw-r--r--ppapi/proxy/proxy_channel.h2
6 files changed, 45 insertions, 7 deletions
diff --git a/ppapi/proxy/broker_dispatcher.cc b/ppapi/proxy/broker_dispatcher.cc
index ff86212..087e9fc 100644
--- a/ppapi/proxy/broker_dispatcher.cc
+++ b/ppapi/proxy/broker_dispatcher.cc
@@ -84,5 +84,30 @@ BrokerHostDispatcher::BrokerHostDispatcher(
: BrokerDispatcher(remote_process_handle, NULL) {
}
+void BrokerHostDispatcher::OnChannelError() {
+ BrokerDispatcher::OnChannelError(); // Stop using the channel.
+
+ // Tell the host about the crash so it can clean up and display notification.
+ // TODO(ddorwin): Add BrokerCrashed() to PPB_Proxy_Private and call it.
+ // ppb_proxy_->BrokerCrashed(pp_module());
+}
+
+BrokerSideDispatcher::BrokerSideDispatcher(
+ base::ProcessHandle remote_process_handle,
+ PP_ConnectInstance_Func connect_instance)
+ : BrokerDispatcher(remote_process_handle, connect_instance) {
+}
+
+void BrokerSideDispatcher::OnChannelError() {
+ BrokerDispatcher::OnChannelError();
+
+ // The renderer has crashed or exited. This channel and all instances
+ // associated with it are no longer valid.
+ // TODO(ddorwin): This causes the broker process to exit, which may not be
+ // desirable in some use cases.
+ delete this;
+}
+
+
} // namespace proxy
} // namespace pp
diff --git a/ppapi/proxy/broker_dispatcher.h b/ppapi/proxy/broker_dispatcher.h
index e451218..399bb87 100644
--- a/ppapi/proxy/broker_dispatcher.h
+++ b/ppapi/proxy/broker_dispatcher.h
@@ -39,10 +39,23 @@ class BrokerDispatcher : public ProxyChannel {
DISALLOW_COPY_AND_ASSIGN(BrokerDispatcher);
};
-// A simple class for broker hosts.
+// The dispatcher for the browser side of the broker channel.
class BrokerHostDispatcher : public BrokerDispatcher {
public:
BrokerHostDispatcher(base::ProcessHandle remote_process_handle);
+
+ // IPC::Channel::Listener implementation.
+ virtual void OnChannelError();
+};
+
+// The dispatcher for the broker side of the broker channel.
+class BrokerSideDispatcher : public BrokerDispatcher {
+ public:
+ BrokerSideDispatcher(base::ProcessHandle remote_process_handle,
+ PP_ConnectInstance_Func connect_instance);
+
+ // IPC::Channel::Listener implementation.
+ virtual void OnChannelError();
};
} // namespace proxy
diff --git a/ppapi/proxy/host_dispatcher.cc b/ppapi/proxy/host_dispatcher.cc
index cba66de..dc2c832 100644
--- a/ppapi/proxy/host_dispatcher.cc
+++ b/ppapi/proxy/host_dispatcher.cc
@@ -176,7 +176,7 @@ bool HostDispatcher::OnMessageReceived(const IPC::Message& msg) {
void HostDispatcher::OnChannelError() {
Dispatcher::OnChannelError(); // Stop using the channel.
- // Tell the host about the crash so it can clean up.
+ // Tell the host about the crash so it can clean up and display notification.
ppb_proxy_->PluginCrashed(pp_module());
}
diff --git a/ppapi/proxy/plugin_dispatcher.cc b/ppapi/proxy/plugin_dispatcher.cc
index 6fb29bf..f4dc945 100644
--- a/ppapi/proxy/plugin_dispatcher.cc
+++ b/ppapi/proxy/plugin_dispatcher.cc
@@ -151,8 +151,8 @@ bool PluginDispatcher::OnMessageReceived(const IPC::Message& msg) {
void PluginDispatcher::OnChannelError() {
Dispatcher::OnChannelError();
- // The renderer has crashed. This channel and all instances associated with
- // it are no longer valid.
+ // The renderer has crashed or exited. This channel and all instances
+ // associated with it are no longer valid.
ForceFreeAllInstances();
// TODO(brettw) free resources too!
delete this;
diff --git a/ppapi/proxy/ppb_broker_proxy.cc b/ppapi/proxy/ppb_broker_proxy.cc
index 44747a9..af59382 100644
--- a/ppapi/proxy/ppb_broker_proxy.cc
+++ b/ppapi/proxy/ppb_broker_proxy.cc
@@ -268,9 +268,9 @@ void PPB_Broker_Proxy::ConnectCompleteInHost(int32_t result,
foreign_socket_handle == IPC::InvalidPlatformFileForTransit());
bool success = dispatcher()->Send(new PpapiMsg_PPBBroker_ConnectComplete(
- INTERFACE_ID_PPB_FILE_SYSTEM, broker, foreign_socket_handle, result));
+ INTERFACE_ID_PPB_BROKER, broker, foreign_socket_handle, result));
- if (!success || result == PP_OK) {
+ if (!success || result != PP_OK) {
// The plugin did not receive the handle, so it must be closed.
// The easiest way to clean it up is to just put it in an object
// and then close it. This failure case is not performance critical.
diff --git a/ppapi/proxy/proxy_channel.h b/ppapi/proxy/proxy_channel.h
index 91e98ac..8df6893 100644
--- a/ppapi/proxy/proxy_channel.h
+++ b/ppapi/proxy/proxy_channel.h
@@ -44,7 +44,7 @@ class ProxyChannel : public IPC::Channel::Listener,
virtual ~ProxyChannel();
// Alternative to InitWithChannel() for unit tests that want to send all
- // messages sent via this dispatcher to the given test sink. The test sink
+ // messages sent via this channel to the given test sink. The test sink
// must outlive this class.
void InitWithTestSink(IPC::TestSink* test_sink);