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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
185 // Allowing all async messages to unblock the renderer means more reentrancy | 185 // Allowing all async messages to unblock the renderer means more reentrancy |
186 // there but gives correct ordering. | 186 // there but gives correct ordering. |
187 // | 187 // |
188 // We don't want reply messages to unblock however, as they will potentially | 188 // We don't want reply messages to unblock however, as they will potentially |
189 // end up on the wrong queue - see crbug.com/122443 | 189 // end up on the wrong queue - see crbug.com/122443 |
190 if (!msg->is_reply()) | 190 if (!msg->is_reply()) |
191 msg->set_unblock(true); | 191 msg->set_unblock(true); |
192 if (msg->is_sync()) { | 192 if (msg->is_sync()) { |
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 | |
196 // TODO(yzshen): Make sending message thread-safe. It may be accessed from | |
197 // non-main threads. Moreover, since the proxy lock has been released, it | |
198 // may be accessed by multiple threads at the same time. | |
brettw
2012/11/27 00:49:15
Is there a bug on this?
yzshen1
2012/11/30 04:29:13
Yes. Although I haven't seen any bug reports, the
| |
195 return Dispatcher::Send(msg); | 199 return Dispatcher::Send(msg); |
196 } | 200 } |
197 return Dispatcher::Send(msg); | 201 return Dispatcher::Send(msg); |
198 } | 202 } |
199 | 203 |
200 bool PluginDispatcher::OnMessageReceived(const IPC::Message& msg) { | 204 bool PluginDispatcher::OnMessageReceived(const IPC::Message& msg) { |
201 // We need to grab the proxy lock to ensure that we don't collide with the | 205 // 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. | 206 // plugin making pepper calls on a different thread. |
203 ProxyAutoLock lock; | 207 ProxyAutoLock lock; |
204 TRACE_EVENT2("ppapi proxy", "PluginDispatcher::OnMessageReceived", | 208 TRACE_EVENT2("ppapi proxy", "PluginDispatcher::OnMessageReceived", |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
341 if (!resource) { | 345 if (!resource) { |
342 if (reply_params.sequence()) | 346 if (reply_params.sequence()) |
343 NOTREACHED(); | 347 NOTREACHED(); |
344 return; | 348 return; |
345 } | 349 } |
346 resource->OnReplyReceived(reply_params, nested_msg); | 350 resource->OnReplyReceived(reply_params, nested_msg); |
347 } | 351 } |
348 | 352 |
349 } // namespace proxy | 353 } // namespace proxy |
350 } // namespace ppapi | 354 } // namespace ppapi |
OLD | NEW |