| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 // static | 174 // static |
| 175 InterfaceList* InterfaceList::GetInstance() { | 175 InterfaceList* InterfaceList::GetInstance() { |
| 176 return Singleton<InterfaceList>::get(); | 176 return Singleton<InterfaceList>::get(); |
| 177 } | 177 } |
| 178 | 178 |
| 179 } // namespace | 179 } // namespace |
| 180 | 180 |
| 181 Dispatcher::Dispatcher(base::ProcessHandle remote_process_handle, | 181 Dispatcher::Dispatcher(base::ProcessHandle remote_process_handle, |
| 182 GetInterfaceFunc local_get_interface) | 182 GetInterfaceFunc local_get_interface) |
| 183 : ProxyChannel(remote_process_handle), | 183 : ProxyChannel(remote_process_handle), |
| 184 dispatcher_delegate_(NULL), | |
| 185 disallow_trusted_interfaces_(false), // TODO(brettw) make this settable. | 184 disallow_trusted_interfaces_(false), // TODO(brettw) make this settable. |
| 186 local_get_interface_(local_get_interface), | 185 local_get_interface_(local_get_interface), |
| 187 callback_tracker_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 186 callback_tracker_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
| 188 } | 187 } |
| 189 | 188 |
| 190 Dispatcher::~Dispatcher() { | 189 Dispatcher::~Dispatcher() { |
| 191 } | 190 } |
| 192 | 191 |
| 193 bool Dispatcher::OnMessageReceived(const IPC::Message& msg) { | 192 bool Dispatcher::OnMessageReceived(const IPC::Message& msg) { |
| 194 // Control messages. | 193 // Control messages. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 } | 234 } |
| 236 | 235 |
| 237 // static | 236 // static |
| 238 const InterfaceProxy::Info* Dispatcher::GetPPPInterfaceInfo(InterfaceID id) { | 237 const InterfaceProxy::Info* Dispatcher::GetPPPInterfaceInfo(InterfaceID id) { |
| 239 if (id <= 0 || id >= INTERFACE_ID_COUNT) | 238 if (id <= 0 || id >= INTERFACE_ID_COUNT) |
| 240 return NULL; | 239 return NULL; |
| 241 const InterfaceList* list = InterfaceList::GetInstance(); | 240 const InterfaceList* list = InterfaceList::GetInstance(); |
| 242 return list->id_to_plugin_info_[id]; | 241 return list->id_to_plugin_info_[id]; |
| 243 } | 242 } |
| 244 | 243 |
| 245 void Dispatcher::SetDelegate(Delegate* delegate) { | |
| 246 DCHECK(!dispatcher_delegate_); | |
| 247 dispatcher_delegate_ = delegate; | |
| 248 } | |
| 249 | |
| 250 void Dispatcher::SetSerializationRules( | 244 void Dispatcher::SetSerializationRules( |
| 251 VarSerializationRules* var_serialization_rules) { | 245 VarSerializationRules* var_serialization_rules) { |
| 252 serialization_rules_.reset(var_serialization_rules); | 246 serialization_rules_.reset(var_serialization_rules); |
| 253 } | 247 } |
| 254 | 248 |
| 255 const void* Dispatcher::GetLocalInterface(const char* interface_name) { | 249 const void* Dispatcher::GetLocalInterface(const char* interface_name) { |
| 256 return local_get_interface_(interface_name); | 250 return local_get_interface_(interface_name); |
| 257 } | 251 } |
| 258 | 252 |
| 259 base::MessageLoopProxy* Dispatcher::GetIPCMessageLoop() { | 253 base::MessageLoopProxy* Dispatcher::GetIPCMessageLoop() { |
| 260 return delegate()->GetIPCMessageLoop(); | 254 return delegate()->GetIPCMessageLoop(); |
| 261 } | 255 } |
| 262 | 256 |
| 263 void Dispatcher::AddIOThreadMessageFilter( | 257 void Dispatcher::AddIOThreadMessageFilter( |
| 264 IPC::ChannelProxy::MessageFilter* filter) { | 258 IPC::ChannelProxy::MessageFilter* filter) { |
| 265 channel()->AddFilter(filter); | 259 channel()->AddFilter(filter); |
| 266 } | 260 } |
| 267 | 261 |
| 268 } // namespace proxy | 262 } // namespace proxy |
| 269 } // namespace pp | 263 } // namespace pp |
| OLD | NEW |