| 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/flash_menu_resource.h" | 5 #include "ppapi/proxy/flash_menu_resource.h" |
| 6 | 6 |
| 7 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
| 8 #include "ppapi/proxy/ppapi_messages.h" | 8 #include "ppapi/proxy/ppapi_messages.h" |
| 9 #include "ppapi/proxy/serialized_flash_menu.h" | 9 #include "ppapi/proxy/serialized_flash_menu.h" |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 selected_id_dest_ = selected_id; | 42 selected_id_dest_ = selected_id; |
| 43 callback_ = callback; | 43 callback_ = callback; |
| 44 | 44 |
| 45 // This must be a sync message even though we don't care about the result. | 45 // This must be a sync message even though we don't care about the result. |
| 46 // The actual reply will be sent asynchronously in the future. This sync | 46 // The actual reply will be sent asynchronously in the future. This sync |
| 47 // request is due to the following deadlock: | 47 // request is due to the following deadlock: |
| 48 // | 48 // |
| 49 // 1. Flash sends a show request to the renderer. | 49 // 1. Flash sends a show request to the renderer. |
| 50 // 2. The show handler in the renderer (in the case of full screen) requests | 50 // 2. The show handler in the renderer (in the case of full screen) requests |
| 51 // the window rect which is a sync message to the browser. This causes | 51 // the window rect which is a sync message to the browser. This causes |
| 52 // a nested message loop to be spun up in the renderer. | 52 // a nested run loop to be spun up in the renderer. |
| 53 // 3. Flash expects context menus to be synchronous so it starts a nested | 53 // 3. Flash expects context menus to be synchronous so it starts a nested |
| 54 // message loop. This creates a second nested message loop in both the | 54 // message loop. This creates a second nested run loop in both the |
| 55 // plugin and renderer process. | 55 // plugin and renderer process. |
| 56 // 4. The browser sends the window rect reply to unblock the renderer, but | 56 // 4. The browser sends the window rect reply to unblock the renderer, but |
| 57 // it's in the second nested message loop and the reply will *not* | 57 // it's in the second nested run loop and the reply will *not* |
| 58 // unblock this loop. | 58 // unblock this loop. |
| 59 // 5. The second loop won't exit until the message loop is complete, but | 59 // 5. The second loop won't exit until the message loop is complete, but |
| 60 // that can't start until the first one exits. | 60 // that can't start until the first one exits. |
| 61 // | 61 // |
| 62 // Having this message sync forces the sync request from the renderer to the | 62 // Having this message sync forces the sync request from the renderer to the |
| 63 // browser for the window rect will complete before Flash can run a nested | 63 // browser for the window rect will complete before Flash can run a nested |
| 64 // message loop to wait for the result of the menu. | 64 // message loop to wait for the result of the menu. |
| 65 SyncCall<IPC::Message>(RENDERER, PpapiHostMsg_FlashMenu_Show(*location)); | 65 SyncCall<IPC::Message>(RENDERER, PpapiHostMsg_FlashMenu_Show(*location)); |
| 66 return PP_OK_COMPLETIONPENDING; | 66 return PP_OK_COMPLETIONPENDING; |
| 67 } | 67 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 88 if (!TrackedCallback::IsPending(callback_)) | 88 if (!TrackedCallback::IsPending(callback_)) |
| 89 return; | 89 return; |
| 90 | 90 |
| 91 *selected_id_dest_ = selected_id; | 91 *selected_id_dest_ = selected_id; |
| 92 selected_id_dest_ = NULL; | 92 selected_id_dest_ = NULL; |
| 93 callback_->Run(params.result()); | 93 callback_->Run(params.result()); |
| 94 } | 94 } |
| 95 | 95 |
| 96 } // namespace proxy | 96 } // namespace proxy |
| 97 } // namespace ppapi | 97 } // namespace ppapi |
| OLD | NEW |