Chromium Code Reviews| 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/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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 // Synchronous messages might be re-entrant, so we need to drop the lock. | 193 // Synchronous messages might be re-entrant, so we need to drop the lock. |
| 194 ProxyAutoUnlock unlock; | 194 ProxyAutoUnlock unlock; |
| 195 return Dispatcher::Send(msg); | 195 return Dispatcher::Send(msg); |
| 196 } | 196 } |
| 197 return Dispatcher::Send(msg); | 197 return Dispatcher::Send(msg); |
| 198 } | 198 } |
| 199 | 199 |
| 200 bool PluginDispatcher::OnMessageReceived(const IPC::Message& msg) { | 200 bool PluginDispatcher::OnMessageReceived(const IPC::Message& msg) { |
| 201 // We need to grab the proxy lock to ensure that we don't collide with the | 201 // We need to grab the proxy lock to ensure that we don't collide with the |
| 202 // plugin making pepper calls on a different thread. | 202 // plugin making pepper calls on a different thread. |
| 203 ProxyAutoLock lock; | 203 ProxyAutoLock lock; |
|
dmichael (off chromium)
2012/11/06 19:24:10
Shouldn't this lock cover it? Or can we get to OnM
| |
| 204 TRACE_EVENT2("ppapi proxy", "PluginDispatcher::OnMessageReceived", | 204 TRACE_EVENT2("ppapi proxy", "PluginDispatcher::OnMessageReceived", |
| 205 "Class", IPC_MESSAGE_ID_CLASS(msg.type()), | 205 "Class", IPC_MESSAGE_ID_CLASS(msg.type()), |
| 206 "Line", IPC_MESSAGE_ID_LINE(msg.type())); | 206 "Line", IPC_MESSAGE_ID_LINE(msg.type())); |
| 207 | 207 |
| 208 if (msg.routing_id() == MSG_ROUTING_CONTROL) { | 208 if (msg.routing_id() == MSG_ROUTING_CONTROL) { |
| 209 // Handle some plugin-specific control messages. | 209 // Handle some plugin-specific control messages. |
| 210 bool handled = true; | 210 bool handled = true; |
| 211 IPC_BEGIN_MESSAGE_MAP(PluginDispatcher, msg) | 211 IPC_BEGIN_MESSAGE_MAP(PluginDispatcher, msg) |
| 212 IPC_MESSAGE_HANDLER(PpapiPluginMsg_ResourceReply, OnMsgResourceReply) | 212 IPC_MESSAGE_HANDLER(PpapiPluginMsg_ResourceReply, OnMsgResourceReply) |
| 213 IPC_MESSAGE_HANDLER(PpapiMsg_SupportsInterface, OnMsgSupportsInterface) | 213 IPC_MESSAGE_HANDLER(PpapiMsg_SupportsInterface, OnMsgSupportsInterface) |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 267 | 267 |
| 268 thunk::ResourceCreationAPI* PluginDispatcher::GetResourceCreationAPI() { | 268 thunk::ResourceCreationAPI* PluginDispatcher::GetResourceCreationAPI() { |
| 269 return static_cast<ResourceCreationProxy*>( | 269 return static_cast<ResourceCreationProxy*>( |
| 270 GetInterfaceProxy(API_ID_RESOURCE_CREATION)); | 270 GetInterfaceProxy(API_ID_RESOURCE_CREATION)); |
| 271 } | 271 } |
| 272 | 272 |
| 273 // static | 273 // static |
| 274 void PluginDispatcher::DispatchResourceReply( | 274 void PluginDispatcher::DispatchResourceReply( |
| 275 const ppapi::proxy::ResourceMessageReplyParams& reply_params, | 275 const ppapi::proxy::ResourceMessageReplyParams& reply_params, |
| 276 const IPC::Message& nested_msg) { | 276 const IPC::Message& nested_msg) { |
| 277 // We need to grab the proxy lock to ensure that we don't collide with the | |
| 278 // plugin making pepper calls on a different thread. | |
| 279 ProxyAutoLock lock; | |
| 280 | |
| 277 Resource* resource = PpapiGlobals::Get()->GetResourceTracker()->GetResource( | 281 Resource* resource = PpapiGlobals::Get()->GetResourceTracker()->GetResource( |
| 278 reply_params.pp_resource()); | 282 reply_params.pp_resource()); |
| 279 if (!resource) { | 283 if (!resource) { |
| 280 if (reply_params.sequence()) | 284 if (reply_params.sequence()) |
| 281 NOTREACHED(); | 285 NOTREACHED(); |
| 282 return; | 286 return; |
| 283 } | 287 } |
| 284 resource->OnReplyReceived(reply_params, nested_msg); | 288 resource->OnReplyReceived(reply_params, nested_msg); |
| 285 } | 289 } |
| 286 | 290 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 331 // once they're set. The user will have to restart to get new font prefs | 335 // once they're set. The user will have to restart to get new font prefs |
| 332 // propogated to plugins. | 336 // propogated to plugins. |
| 333 if (!received_preferences_) { | 337 if (!received_preferences_) { |
| 334 received_preferences_ = true; | 338 received_preferences_ = true; |
| 335 preferences_ = prefs; | 339 preferences_ = prefs; |
| 336 } | 340 } |
| 337 } | 341 } |
| 338 | 342 |
| 339 } // namespace proxy | 343 } // namespace proxy |
| 340 } // namespace ppapi | 344 } // namespace ppapi |
| OLD | NEW |