| 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/plugin_dispatcher.h" | 5 #include "ppapi/proxy/plugin_dispatcher.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 return NULL; | 72 return NULL; |
| 73 return info->interface_ptr; | 73 return info->interface_ptr; |
| 74 } | 74 } |
| 75 | 75 |
| 76 bool PluginDispatcher::InitPluginWithChannel( | 76 bool PluginDispatcher::InitPluginWithChannel( |
| 77 PluginDispatcher::Delegate* delegate, | 77 PluginDispatcher::Delegate* delegate, |
| 78 const IPC::ChannelHandle& channel_handle, | 78 const IPC::ChannelHandle& channel_handle, |
| 79 bool is_client) { | 79 bool is_client) { |
| 80 if (!Dispatcher::InitWithChannel(delegate, channel_handle, is_client)) | 80 if (!Dispatcher::InitWithChannel(delegate, channel_handle, is_client)) |
| 81 return false; | 81 return false; |
| 82 SetDelegate(delegate); |
| 82 | 83 |
| 83 // The message filter will intercept and process certain messages directly | 84 // The message filter will intercept and process certain messages directly |
| 84 // on the I/O thread. | 85 // on the I/O thread. |
| 85 channel()->AddFilter( | 86 channel()->AddFilter( |
| 86 new PluginMessageFilter(delegate->GetGloballySeenInstanceIDSet())); | 87 new PluginMessageFilter(delegate->GetGloballySeenInstanceIDSet())); |
| 87 return true; | 88 return true; |
| 88 } | 89 } |
| 89 | 90 |
| 90 bool PluginDispatcher::IsPlugin() const { | 91 bool PluginDispatcher::IsPlugin() const { |
| 91 return true; | 92 return true; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 NOTREACHED(); | 195 NOTREACHED(); |
| 195 } | 196 } |
| 196 } | 197 } |
| 197 } | 198 } |
| 198 | 199 |
| 199 InstanceData* PluginDispatcher::GetInstanceData(PP_Instance instance) { | 200 InstanceData* PluginDispatcher::GetInstanceData(PP_Instance instance) { |
| 200 InstanceDataMap::iterator it = instance_map_.find(instance); | 201 InstanceDataMap::iterator it = instance_map_.find(instance); |
| 201 return (it == instance_map_.end()) ? NULL : &it->second; | 202 return (it == instance_map_.end()) ? NULL : &it->second; |
| 202 } | 203 } |
| 203 | 204 |
| 205 void PluginDispatcher::PostToWebKitThread( |
| 206 const tracked_objects::Location& from_here, |
| 207 const base::Closure& task) { |
| 208 return dispatcher_delegate_->PostToWebKitThread(from_here, task); |
| 209 } |
| 210 |
| 211 pp::shared_impl::WebKitForwarding* PluginDispatcher::GetWebKitForwarding() { |
| 212 return dispatcher_delegate_->GetWebKitForwarding(); |
| 213 } |
| 214 |
| 204 ::ppapi::shared_impl::FunctionGroupBase* PluginDispatcher::GetFunctionAPI( | 215 ::ppapi::shared_impl::FunctionGroupBase* PluginDispatcher::GetFunctionAPI( |
| 205 pp::proxy::InterfaceID id) { | 216 pp::proxy::InterfaceID id) { |
| 206 if (function_proxies_[id].get()) | 217 if (function_proxies_[id].get()) |
| 207 return function_proxies_[id].get(); | 218 return function_proxies_[id].get(); |
| 208 | 219 |
| 209 if (id == INTERFACE_ID_RESOURCE_CREATION) | 220 if (id == INTERFACE_ID_RESOURCE_CREATION) |
| 210 function_proxies_[id].reset(new ResourceCreationProxy(this)); | 221 function_proxies_[id].reset(new ResourceCreationProxy(this)); |
| 211 | 222 |
| 212 return function_proxies_[id].get(); | 223 return function_proxies_[id].get(); |
| 213 } | 224 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 if (!interface_functions) | 262 if (!interface_functions) |
| 252 return; | 263 return; |
| 253 target_proxies_[info->id].reset( | 264 target_proxies_[info->id].reset( |
| 254 info->create_proxy(this, interface_functions)); | 265 info->create_proxy(this, interface_functions)); |
| 255 *result = true; | 266 *result = true; |
| 256 } | 267 } |
| 257 | 268 |
| 258 } // namespace proxy | 269 } // namespace proxy |
| 259 } // namespace pp | 270 } // namespace pp |
| 260 | 271 |
| OLD | NEW |