| OLD | NEW |
| 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/broker_dispatcher.h" | 5 #include "ppapi/proxy/broker_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/sync_socket.h" | 7 #include "base/sync_socket.h" |
| 8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
| 9 #include "ppapi/proxy/ppapi_messages.h" | 9 #include "ppapi/proxy/ppapi_messages.h" |
| 10 #include "ppapi/shared_impl/platform_file.h" | 10 #include "ppapi/shared_impl/platform_file.h" |
| 11 | 11 |
| 12 namespace ppapi { | 12 namespace ppapi { |
| 13 namespace proxy { | 13 namespace proxy { |
| 14 | 14 |
| 15 BrokerDispatcher::BrokerDispatcher(PP_ConnectInstance_Func connect_instance) | 15 BrokerDispatcher::BrokerDispatcher(PP_ConnectInstance_Func connect_instance) |
| 16 : connect_instance_(connect_instance) { | 16 : connect_instance_(connect_instance) { |
| 17 } | 17 } |
| 18 | 18 |
| 19 BrokerDispatcher::~BrokerDispatcher() { | 19 BrokerDispatcher::~BrokerDispatcher() { |
| 20 } | 20 } |
| 21 | 21 |
| 22 bool BrokerDispatcher::InitBrokerWithChannel( | 22 bool BrokerDispatcher::InitBrokerWithChannel( |
| 23 ProxyChannel::Delegate* delegate, | 23 ProxyChannel::Delegate* delegate, |
| 24 base::ProcessId peer_pid, |
| 24 const IPC::ChannelHandle& channel_handle, | 25 const IPC::ChannelHandle& channel_handle, |
| 25 bool is_client) { | 26 bool is_client) { |
| 26 return ProxyChannel::InitWithChannel(delegate, channel_handle, is_client); | 27 return ProxyChannel::InitWithChannel(delegate, peer_pid, channel_handle, |
| 28 is_client); |
| 27 } | 29 } |
| 28 | 30 |
| 29 bool BrokerDispatcher::OnMessageReceived(const IPC::Message& msg) { | 31 bool BrokerDispatcher::OnMessageReceived(const IPC::Message& msg) { |
| 30 // Control messages. | 32 // Control messages. |
| 31 if (msg.routing_id() == MSG_ROUTING_CONTROL) { | 33 if (msg.routing_id() == MSG_ROUTING_CONTROL) { |
| 32 bool handled = true; | 34 bool handled = true; |
| 33 IPC_BEGIN_MESSAGE_MAP(BrokerDispatcher, msg) | 35 IPC_BEGIN_MESSAGE_MAP(BrokerDispatcher, msg) |
| 34 IPC_MESSAGE_HANDLER(PpapiMsg_ConnectToPlugin, OnMsgConnectToPlugin) | 36 IPC_MESSAGE_HANDLER(PpapiMsg_ConnectToPlugin, OnMsgConnectToPlugin) |
| 35 IPC_MESSAGE_UNHANDLED(handled = false) | 37 IPC_MESSAGE_UNHANDLED(handled = false) |
| 36 IPC_END_MESSAGE_MAP() | 38 IPC_END_MESSAGE_MAP() |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // The renderer has crashed or exited. This channel and all instances | 90 // The renderer has crashed or exited. This channel and all instances |
| 89 // associated with it are no longer valid. | 91 // associated with it are no longer valid. |
| 90 // TODO(ddorwin): This causes the broker process to exit, which may not be | 92 // TODO(ddorwin): This causes the broker process to exit, which may not be |
| 91 // desirable in some use cases. | 93 // desirable in some use cases. |
| 92 delete this; | 94 delete this; |
| 93 } | 95 } |
| 94 | 96 |
| 95 | 97 |
| 96 } // namespace proxy | 98 } // namespace proxy |
| 97 } // namespace ppapi | 99 } // namespace ppapi |
| OLD | NEW |