| 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 16 matching lines...) Expand all Loading... |
| 28 break; | 28 break; |
| 29 } | 29 } |
| 30 | 30 |
| 31 // Check with the embedder as well. | 31 // Check with the embedder as well. |
| 32 ContentClient* client = GetContentClient(); | 32 ContentClient* client = GetContentClient(); |
| 33 return client->CanSendWhileSwappedOut(msg); | 33 return client->CanSendWhileSwappedOut(msg); |
| 34 } | 34 } |
| 35 | 35 |
| 36 bool SwappedOutMessages::CanHandleWhileSwappedOut( | 36 bool SwappedOutMessages::CanHandleWhileSwappedOut( |
| 37 const IPC::Message& msg) { | 37 const IPC::Message& msg) { |
| 38 // We must allow all synchronous IPC messages to be processed, or else |
| 39 // the renderer process will become stuck and won't respond to future |
| 40 // navigations. |
| 41 if (msg.is_sync()) |
| 42 return true; |
| 43 |
| 38 // Any message the renderer is allowed to send while swapped out should | 44 // Any message the renderer is allowed to send while swapped out should |
| 39 // be handled by the browser. | 45 // be handled by the browser. |
| 40 if (CanSendWhileSwappedOut(&msg)) | 46 if (CanSendWhileSwappedOut(&msg)) |
| 41 return true; | 47 return true; |
| 42 | 48 |
| 43 // We drop most other messages that arrive from a swapped out renderer. | 49 // 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 | 50 // However, some are important (e.g., ACKs) for keeping the browser and |
| 45 // renderer state consistent in case we later return to the renderer. | 51 // renderer state consistent in case we later return to the renderer. |
| 46 switch (msg.type()) { | 52 switch (msg.type()) { |
| 47 // Sends an ACK. | 53 // Sends an ACK. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 74 default: | 80 default: |
| 75 break; | 81 break; |
| 76 } | 82 } |
| 77 | 83 |
| 78 // Check with the embedder as well. | 84 // Check with the embedder as well. |
| 79 ContentClient* client = GetContentClient(); | 85 ContentClient* client = GetContentClient(); |
| 80 return client->CanHandleWhileSwappedOut(msg); | 86 return client->CanHandleWhileSwappedOut(msg); |
| 81 } | 87 } |
| 82 | 88 |
| 83 } // namespace content | 89 } // namespace content |
| OLD | NEW |