Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Unified Diff: content/common/swapped_out_messages.cc

Issue 6319001: Support window.opener after a process swap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with trunk. Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/swapped_out_messages.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/swapped_out_messages.cc
diff --git a/content/common/swapped_out_messages.cc b/content/common/swapped_out_messages.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7c7d5cd83e2bf01af9e1e4807da71b70a991ab52
--- /dev/null
+++ b/content/common/swapped_out_messages.cc
@@ -0,0 +1,79 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/common/swapped_out_messages.h"
+
+#include "content/common/content_client.h"
+#include "content/common/view_messages.h"
+
+namespace content {
+
+bool SwappedOutMessages::CanSendWhileSwappedOut(const IPC::Message* msg) {
+ // We filter out most IPC messages when swapped out. However, some are
+ // important (e.g., ACKs) for keeping the browser and renderer state
+ // consistent in case we later return to the same renderer.
+ switch (msg->type()) {
+ // Handled by RenderWidget.
+ case ViewHostMsg_HandleInputEvent_ACK::ID:
+ case ViewHostMsg_PaintAtSize_ACK::ID:
+ case ViewHostMsg_UpdateRect::ID:
+ // Handled by RenderView.
+ case ViewHostMsg_RenderViewGone::ID:
+ case ViewHostMsg_ShouldClose_ACK::ID:
+ case ViewHostMsg_SwapOut_ACK::ID:
+ case ViewHostMsg_ClosePage_ACK::ID:
+ return true;
+ default:
+ break;
+ }
+
+ // Check with the embedder as well.
+ ContentClient* client = GetContentClient();
+ return client->CanSendWhileSwappedOut(msg);
+}
+
+bool SwappedOutMessages::CanHandleWhileSwappedOut(
+ const IPC::Message& msg) {
+ // Any message the renderer is allowed to send while swapped out should
+ // be handled by the browser.
+ if (CanSendWhileSwappedOut(&msg))
+ return true;
+
+ // We drop most other messages that arrive from a swapped out renderer.
+ // However, some are important (e.g., ACKs) for keeping the browser and
+ // renderer state consistent in case we later return to the renderer.
+ switch (msg.type()) {
+ // Sends an ACK.
+ case ViewHostMsg_ShowView::ID:
+ // Sends an ACK.
+ case ViewHostMsg_ShowWidget::ID:
+ // Sends an ACK.
+ case ViewHostMsg_ShowFullscreenWidget::ID:
+ // Updates browser state.
+ case ViewHostMsg_RenderViewReady::ID:
+ // Updates the previous navigation entry.
+ case ViewHostMsg_UpdateState::ID:
+ // Sends an ACK.
+ case ViewHostMsg_UpdateTargetURL::ID:
+ // We allow closing even if we are in the process of swapping out.
+ case ViewHostMsg_Close::ID:
+ // Sends an ACK.
+ case ViewHostMsg_RequestMove::ID:
+ // Suppresses dialog and sends an ACK.
+ case ViewHostMsg_RunJavaScriptMessage::ID:
+ // Suppresses dialog and sends an ACK.
+ case ViewHostMsg_RunBeforeUnloadConfirm::ID:
+ // Sends an ACK.
+ case ViewHostMsg_AccessibilityNotifications::ID:
+ return true;
+ default:
+ break;
+ }
+
+ // Check with the embedder as well.
+ ContentClient* client = GetContentClient();
+ return client->CanHandleWhileSwappedOut(msg);
+}
+
+} // namespace content
« no previous file with comments | « content/common/swapped_out_messages.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698