| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/dispatcher.h" | 5 #include "ppapi/proxy/dispatcher.h" |
| 6 | 6 |
| 7 #include <string.h> // For memset. | 7 #include <string.h> // For memset. |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 GetInterfaceFunc local_get_interface) | 21 GetInterfaceFunc local_get_interface) |
| 22 : ProxyChannel(remote_process_handle), | 22 : ProxyChannel(remote_process_handle), |
| 23 disallow_trusted_interfaces_(false), // TODO(brettw) make this settable. | 23 disallow_trusted_interfaces_(false), // TODO(brettw) make this settable. |
| 24 local_get_interface_(local_get_interface), | 24 local_get_interface_(local_get_interface), |
| 25 callback_tracker_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 25 callback_tracker_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
| 26 } | 26 } |
| 27 | 27 |
| 28 Dispatcher::~Dispatcher() { | 28 Dispatcher::~Dispatcher() { |
| 29 } | 29 } |
| 30 | 30 |
| 31 InterfaceProxy* Dispatcher::GetInterfaceProxy(InterfaceID id) { | 31 InterfaceProxy* Dispatcher::GetInterfaceProxy(ApiID id) { |
| 32 InterfaceProxy* proxy = proxies_[id].get(); | 32 InterfaceProxy* proxy = proxies_[id].get(); |
| 33 if (!proxy) { | 33 if (!proxy) { |
| 34 // Handle the first time for a given API by creating the proxy for it. | 34 // Handle the first time for a given API by creating the proxy for it. |
| 35 InterfaceProxy::Factory factory = | 35 InterfaceProxy::Factory factory = |
| 36 InterfaceList::GetInstance()->GetFactoryForID(id); | 36 InterfaceList::GetInstance()->GetFactoryForID(id); |
| 37 if (!factory) { | 37 if (!factory) { |
| 38 NOTREACHED(); | 38 NOTREACHED(); |
| 39 return NULL; | 39 return NULL; |
| 40 } | 40 } |
| 41 proxy = factory(this); | 41 proxy = factory(this); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 59 if (msg.routing_id() == MSG_ROUTING_CONTROL) { | 59 if (msg.routing_id() == MSG_ROUTING_CONTROL) { |
| 60 bool handled = true; | 60 bool handled = true; |
| 61 IPC_BEGIN_MESSAGE_MAP(Dispatcher, msg) | 61 IPC_BEGIN_MESSAGE_MAP(Dispatcher, msg) |
| 62 IPC_MESSAGE_FORWARD(PpapiMsg_ExecuteCallback, &callback_tracker_, | 62 IPC_MESSAGE_FORWARD(PpapiMsg_ExecuteCallback, &callback_tracker_, |
| 63 CallbackTracker::ReceiveExecuteSerializedCallback) | 63 CallbackTracker::ReceiveExecuteSerializedCallback) |
| 64 IPC_MESSAGE_UNHANDLED(handled = false) | 64 IPC_MESSAGE_UNHANDLED(handled = false) |
| 65 IPC_END_MESSAGE_MAP() | 65 IPC_END_MESSAGE_MAP() |
| 66 return handled; | 66 return handled; |
| 67 } | 67 } |
| 68 | 68 |
| 69 if (msg.routing_id() <= 0 || msg.routing_id() >= INTERFACE_ID_COUNT) { | 69 if (msg.routing_id() <= 0 || msg.routing_id() >= API_ID_COUNT) { |
| 70 OnInvalidMessageReceived(); | 70 OnInvalidMessageReceived(); |
| 71 return true; | 71 return true; |
| 72 } | 72 } |
| 73 | 73 |
| 74 InterfaceProxy* proxy = GetInterfaceProxy( | 74 InterfaceProxy* proxy = GetInterfaceProxy( |
| 75 static_cast<InterfaceID>(msg.routing_id())); | 75 static_cast<ApiID>(msg.routing_id())); |
| 76 if (!proxy) { | 76 if (!proxy) { |
| 77 NOTREACHED(); | 77 NOTREACHED(); |
| 78 return true; | 78 return true; |
| 79 } | 79 } |
| 80 return proxy->OnMessageReceived(msg); | 80 return proxy->OnMessageReceived(msg); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void Dispatcher::SetSerializationRules( | 83 void Dispatcher::SetSerializationRules( |
| 84 VarSerializationRules* var_serialization_rules) { | 84 VarSerializationRules* var_serialization_rules) { |
| 85 serialization_rules_.reset(var_serialization_rules); | 85 serialization_rules_.reset(var_serialization_rules); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void Dispatcher::OnInvalidMessageReceived() { | 88 void Dispatcher::OnInvalidMessageReceived() { |
| 89 } | 89 } |
| 90 | 90 |
| 91 } // namespace proxy | 91 } // namespace proxy |
| 92 } // namespace ppapi | 92 } // namespace ppapi |
| OLD | NEW |