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" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/metrics/histogram_macros.h" |
12 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
13 #include "ipc/ipc_message.h" | 14 #include "ipc/ipc_message.h" |
14 #include "ipc/ipc_sync_channel.h" | 15 #include "ipc/ipc_sync_channel.h" |
15 #include "ipc/ipc_sync_message_filter.h" | 16 #include "ipc/ipc_sync_message_filter.h" |
16 #include "ppapi/c/pp_errors.h" | 17 #include "ppapi/c/pp_errors.h" |
17 #include "ppapi/c/ppp_instance.h" | 18 #include "ppapi/c/ppp_instance.h" |
18 #include "ppapi/proxy/flash_clipboard_resource.h" | 19 #include "ppapi/proxy/flash_clipboard_resource.h" |
19 #include "ppapi/proxy/flash_file_resource.h" | 20 #include "ppapi/proxy/flash_file_resource.h" |
20 #include "ppapi/proxy/flash_resource.h" | 21 #include "ppapi/proxy/flash_resource.h" |
21 #include "ppapi/proxy/gamepad_resource.h" | 22 #include "ppapi/proxy/gamepad_resource.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 // Allowing all async messages to unblock the renderer means more reentrancy | 200 // Allowing all async messages to unblock the renderer means more reentrancy |
200 // there but gives correct ordering. | 201 // there but gives correct ordering. |
201 // | 202 // |
202 // We don't want reply messages to unblock however, as they will potentially | 203 // We don't want reply messages to unblock however, as they will potentially |
203 // end up on the wrong queue - see crbug.com/122443 | 204 // end up on the wrong queue - see crbug.com/122443 |
204 if (!msg->is_reply()) | 205 if (!msg->is_reply()) |
205 msg->set_unblock(true); | 206 msg->set_unblock(true); |
206 if (msg->is_sync()) { | 207 if (msg->is_sync()) { |
207 // Synchronous messages might be re-entrant, so we need to drop the lock. | 208 // Synchronous messages might be re-entrant, so we need to drop the lock. |
208 ProxyAutoUnlock unlock; | 209 ProxyAutoUnlock unlock; |
| 210 SCOPED_UMA_HISTOGRAM_TIMER("Plugin.PpapiSyncIPCTime"); |
209 return SendMessage(msg); | 211 return SendMessage(msg); |
210 } | 212 } |
211 return SendMessage(msg); | 213 return SendMessage(msg); |
212 } | 214 } |
213 | 215 |
214 bool PluginDispatcher::OnMessageReceived(const IPC::Message& msg) { | 216 bool PluginDispatcher::OnMessageReceived(const IPC::Message& msg) { |
215 // We need to grab the proxy lock to ensure that we don't collide with the | 217 // We need to grab the proxy lock to ensure that we don't collide with the |
216 // plugin making pepper calls on a different thread. | 218 // plugin making pepper calls on a different thread. |
217 ProxyAutoLock lock; | 219 ProxyAutoLock lock; |
218 TRACE_EVENT2("ppapi proxy", "PluginDispatcher::OnMessageReceived", | 220 TRACE_EVENT2("ppapi proxy", "PluginDispatcher::OnMessageReceived", |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 // once they're set. The user will have to restart to get new font prefs | 322 // once they're set. The user will have to restart to get new font prefs |
321 // propogated to plugins. | 323 // propogated to plugins. |
322 if (!received_preferences_) { | 324 if (!received_preferences_) { |
323 received_preferences_ = true; | 325 received_preferences_ = true; |
324 preferences_ = prefs; | 326 preferences_ = prefs; |
325 } | 327 } |
326 } | 328 } |
327 | 329 |
328 } // namespace proxy | 330 } // namespace proxy |
329 } // namespace ppapi | 331 } // namespace ppapi |
OLD | NEW |