OLD | NEW |
1 // Copyright (c) 2011 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 "content/common/swapped_out_messages.h" | 5 #include "content/common/swapped_out_messages.h" |
6 | 6 |
7 #include "content/common/view_messages.h" | 7 #include "content/common/view_messages.h" |
8 #include "content/public/common/content_client.h" | 8 #include "content/public/common/content_client.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 | 11 |
(...skipping 24 matching lines...) Expand all Loading... |
36 bool SwappedOutMessages::CanHandleWhileSwappedOut( | 36 bool SwappedOutMessages::CanHandleWhileSwappedOut( |
37 const IPC::Message& msg) { | 37 const IPC::Message& msg) { |
38 // Any message the renderer is allowed to send while swapped out should | 38 // Any message the renderer is allowed to send while swapped out should |
39 // be handled by the browser. | 39 // be handled by the browser. |
40 if (CanSendWhileSwappedOut(&msg)) | 40 if (CanSendWhileSwappedOut(&msg)) |
41 return true; | 41 return true; |
42 | 42 |
43 // We drop most other messages that arrive from a swapped out renderer. | 43 // We drop most other messages that arrive from a swapped out renderer. |
44 // However, some are important (e.g., ACKs) for keeping the browser and | 44 // However, some are important (e.g., ACKs) for keeping the browser and |
45 // renderer state consistent in case we later return to the renderer. | 45 // renderer state consistent in case we later return to the renderer. |
| 46 // Note that synchronous messages that are not handled will receive an |
| 47 // error reply instead, to avoid leaving the renderer in a stuck state. |
46 switch (msg.type()) { | 48 switch (msg.type()) { |
47 // Sends an ACK. | 49 // Sends an ACK. |
48 case ViewHostMsg_ShowView::ID: | 50 case ViewHostMsg_ShowView::ID: |
49 // Sends an ACK. | 51 // Sends an ACK. |
50 case ViewHostMsg_ShowWidget::ID: | 52 case ViewHostMsg_ShowWidget::ID: |
51 // Sends an ACK. | 53 // Sends an ACK. |
52 case ViewHostMsg_ShowFullscreenWidget::ID: | 54 case ViewHostMsg_ShowFullscreenWidget::ID: |
53 // Updates browser state. | 55 // Updates browser state. |
54 case ViewHostMsg_RenderViewReady::ID: | 56 case ViewHostMsg_RenderViewReady::ID: |
55 // Updates the previous navigation entry. | 57 // Updates the previous navigation entry. |
56 case ViewHostMsg_UpdateState::ID: | 58 case ViewHostMsg_UpdateState::ID: |
57 // Sends an ACK. | 59 // Sends an ACK. |
58 case ViewHostMsg_UpdateTargetURL::ID: | 60 case ViewHostMsg_UpdateTargetURL::ID: |
59 // We allow closing even if we are in the process of swapping out. | 61 // We allow closing even if we are in the process of swapping out. |
60 case ViewHostMsg_Close::ID: | 62 case ViewHostMsg_Close::ID: |
61 // Sends an ACK. | 63 // Sends an ACK. |
62 case ViewHostMsg_RequestMove::ID: | 64 case ViewHostMsg_RequestMove::ID: |
63 // Suppresses dialog and sends an ACK. | |
64 case ViewHostMsg_RunJavaScriptMessage::ID: | |
65 // Suppresses dialog and sends an ACK. | |
66 case ViewHostMsg_RunBeforeUnloadConfirm::ID: | |
67 // Sends an ACK. | 65 // Sends an ACK. |
68 case ViewHostMsg_AccessibilityNotifications::ID: | 66 case ViewHostMsg_AccessibilityNotifications::ID: |
69 #if defined(USE_X11) | 67 #if defined(USE_X11) |
70 // Synchronous message when leaving a page with plugin. | 68 // Synchronous message when leaving a page with plugin. In this case, |
| 69 // we want to destroy the plugin rather than return an error message. |
71 case ViewHostMsg_DestroyPluginContainer::ID: | 70 case ViewHostMsg_DestroyPluginContainer::ID: |
72 #endif | 71 #endif |
73 return true; | 72 return true; |
74 default: | 73 default: |
75 break; | 74 break; |
76 } | 75 } |
77 | 76 |
78 // Check with the embedder as well. | 77 // Check with the embedder as well. |
79 ContentClient* client = GetContentClient(); | 78 ContentClient* client = GetContentClient(); |
80 return client->CanHandleWhileSwappedOut(msg); | 79 return client->CanHandleWhileSwappedOut(msg); |
81 } | 80 } |
82 | 81 |
83 } // namespace content | 82 } // namespace content |
OLD | NEW |