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 "content/common/swapped_out_messages.h" | 5 #include "content/common/swapped_out_messages.h" |
6 | 6 |
7 #include "content/common/accessibility_messages.h" | 7 #include "content/common/accessibility_messages.h" |
8 #include "content/common/frame_messages.h" | 8 #include "content/common/frame_messages.h" |
9 #include "content/common/input_messages.h" | 9 #include "content/common/input_messages.h" |
10 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
11 #include "content/public/common/content_client.h" | 11 #include "content/public/common/content_client.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 bool SwappedOutMessages::CanSendWhileSwappedOut(const IPC::Message* msg) { | 15 bool SwappedOutMessages::CanSendWhileSwappedOut(const IPC::Message* msg) { |
16 // We filter out most IPC messages when swapped out. However, some are | 16 // We filter out most IPC messages when swapped out. However, some are |
17 // important (e.g., ACKs) for keeping the browser and renderer state | 17 // important (e.g., ACKs) for keeping the browser and renderer state |
18 // consistent in case we later return to the same renderer. | 18 // consistent in case we later return to the same renderer. |
19 switch (msg->type()) { | 19 switch (msg->type()) { |
20 // Handled by RenderWidgetHost. | 20 // Handled by RenderWidgetHost. |
21 case InputHostMsg_HandleInputEvent_ACK::ID: | 21 case InputHostMsg_HandleInputEvent_ACK::ID: |
22 case ViewHostMsg_UpdateRect::ID: | 22 case ViewHostMsg_UpdateRect::ID: |
23 // Handled by RenderWidgetHostView. | 23 // Handled by RenderWidgetHostView. |
24 case ViewHostMsg_SetNeedsBeginFrames::ID: | 24 case ViewHostMsg_SetNeedsBeginFrames::ID: |
25 // Allow targeted navigations while swapped out. | 25 // Allow targeted navigations while swapped out. |
26 case FrameHostMsg_OpenURL::ID: | 26 case FrameHostMsg_OpenURL::ID: |
27 case ViewHostMsg_Focus::ID: | 27 case ViewHostMsg_Focus::ID: |
28 // Handled by RenderViewHost. | 28 // Handled by RenderViewHost. |
29 case ViewHostMsg_ClosePage_ACK::ID: | 29 case ViewHostMsg_ClosePage_ACK::ID: |
30 case ViewHostMsg_ShowFullscreenWidget::ID: | |
31 case ViewHostMsg_ShowView::ID: | |
32 case ViewHostMsg_ShowWidget::ID: | |
30 case ViewHostMsg_SwapCompositorFrame::ID: | 33 case ViewHostMsg_SwapCompositorFrame::ID: |
31 // Handled by SharedWorkerMessageFilter. | 34 // Handled by SharedWorkerMessageFilter. |
32 case ViewHostMsg_DocumentDetached::ID: | 35 case ViewHostMsg_DocumentDetached::ID: |
33 // Allow cross-process JavaScript calls. | 36 // Allow cross-process JavaScript calls. |
34 case ViewHostMsg_RouteCloseEvent::ID: | 37 case ViewHostMsg_RouteCloseEvent::ID: |
35 // Send page scale factor reset notification upon cross-process navigations. | 38 // Send page scale factor reset notification upon cross-process navigations. |
36 case ViewHostMsg_PageScaleFactorChanged::ID: | 39 case ViewHostMsg_PageScaleFactorChanged::ID: |
37 // Handled by RenderFrameHost. | 40 // Handled by RenderFrameHost. |
38 case FrameHostMsg_BeforeUnload_ACK::ID: | 41 case FrameHostMsg_BeforeUnload_ACK::ID: |
39 case FrameHostMsg_SwapOut_ACK::ID: | 42 case FrameHostMsg_SwapOut_ACK::ID: |
(...skipping 21 matching lines...) Expand all Loading... | |
61 // be handled by the browser. | 64 // be handled by the browser. |
62 if (CanSendWhileSwappedOut(&msg)) | 65 if (CanSendWhileSwappedOut(&msg)) |
63 return true; | 66 return true; |
64 | 67 |
65 // We drop most other messages that arrive from a swapped out renderer. | 68 // We drop most other messages that arrive from a swapped out renderer. |
66 // However, some are important (e.g., ACKs) for keeping the browser and | 69 // However, some are important (e.g., ACKs) for keeping the browser and |
67 // renderer state consistent in case we later return to the renderer. | 70 // renderer state consistent in case we later return to the renderer. |
68 // Note that synchronous messages that are not handled will receive an | 71 // Note that synchronous messages that are not handled will receive an |
69 // error reply instead, to avoid leaving the renderer in a stuck state. | 72 // error reply instead, to avoid leaving the renderer in a stuck state. |
70 switch (msg.type()) { | 73 switch (msg.type()) { |
71 // Sends an ACK. | |
72 case ViewHostMsg_ShowView::ID: | |
73 // Sends an ACK. | |
74 case ViewHostMsg_ShowWidget::ID: | |
75 // Sends an ACK. | |
76 case ViewHostMsg_ShowFullscreenWidget::ID: | |
dcheng
2016/11/21 11:19:52
Out of curiosity, why did we move these?
I guess
ncarter (slow)
2016/11/21 19:51:24
I didn't change when these messages were sent, but
| |
77 // Updates the previous navigation entry. | 74 // Updates the previous navigation entry. |
78 case ViewHostMsg_UpdateState::ID: | 75 case ViewHostMsg_UpdateState::ID: |
79 // Sends an ACK. | 76 // Sends an ACK. |
80 case ViewHostMsg_UpdateTargetURL::ID: | 77 case ViewHostMsg_UpdateTargetURL::ID: |
81 // We allow closing even if we are in the process of swapping out. | 78 // We allow closing even if we are in the process of swapping out. |
82 case ViewHostMsg_Close::ID: | 79 case ViewHostMsg_Close::ID: |
83 // Sends an ACK. | 80 // Sends an ACK. |
84 case ViewHostMsg_RequestMove::ID: | 81 case ViewHostMsg_RequestMove::ID: |
85 // Sends an ACK. | 82 // Sends an ACK. |
86 case AccessibilityHostMsg_Events::ID: | 83 case AccessibilityHostMsg_Events::ID: |
87 return true; | 84 return true; |
88 default: | 85 default: |
89 break; | 86 break; |
90 } | 87 } |
91 | 88 |
92 return false; | 89 return false; |
93 } | 90 } |
94 | 91 |
95 } // namespace content | 92 } // namespace content |
OLD | NEW |