Replace FrameMsg_DeleteProxy with UnfreezableleFrameMsg_DeleteProxy

This CL replaces FrameMsg_DeleteProxy with
UnfreezableFrameMsg_DeleteProxy, so that it is always executed and not
frozen even when the frame is frozen. This IPC is triggered when bfcache
eviction happens and has to be executed.

Bug: 978742
Change-Id: I236f3018d9ceae9d77ed7d30bdfca1d239ec5b8d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1687270
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Yuzu Saijo <yuzus@chromium.org>
Cr-Commit-Position: refs/heads/master@{#677634}
diff --git a/content/browser/frame_host/render_frame_proxy_host.cc b/content/browser/frame_host/render_frame_proxy_host.cc
index 62b8af6..af80a5a 100644
--- a/content/browser/frame_host/render_frame_proxy_host.cc
+++ b/content/browser/frame_host/render_frame_proxy_host.cc
@@ -27,6 +27,7 @@
 #include "content/browser/site_instance_impl.h"
 #include "content/common/frame_messages.h"
 #include "content/common/frame_owner_properties.h"
+#include "content/common/unfreezable_frame_messages.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/common/content_features.h"
 #include "ipc/ipc_message.h"
@@ -103,7 +104,7 @@
     // This can be removed once we don't have a swapped out state on
     // RenderFrame. See https://crbug.com/357747
     if (!frame_tree_node_->IsMainFrame())
-      Send(new FrameMsg_DeleteProxy(routing_id_));
+      Send(new UnfreezableFrameMsg_DeleteProxy(routing_id_));
   }
 
   // TODO(arthursonzogni): There are no known reason for removing the
diff --git a/content/common/frame_messages.h b/content/common/frame_messages.h
index 32987122..888a1fa 100644
--- a/content/common/frame_messages.h
+++ b/content/common/frame_messages.h
@@ -831,10 +831,6 @@
 IPC_MESSAGE_ROUTED1(FrameMsg_Reload,
                     bool /* bypass_cache */)
 
-// Requests the corresponding RenderFrameProxy to be deleted and removed from
-// the frame tree.
-IPC_MESSAGE_ROUTED0(FrameMsg_DeleteProxy)
-
 // Request the text surrounding the selection with a |max_length|. The response
 // will be sent via FrameHostMsg_TextSurroundingSelectionResponse.
 IPC_MESSAGE_ROUTED1(FrameMsg_TextSurroundingSelectionRequest,
diff --git a/content/common/unfreezable_frame_messages.h b/content/common/unfreezable_frame_messages.h
index a8b3665..3e2e181d 100644
--- a/content/common/unfreezable_frame_messages.h
+++ b/content/common/unfreezable_frame_messages.h
@@ -30,4 +30,8 @@
 // Instructs the renderer to delete the RenderFrame.
 IPC_MESSAGE_ROUTED1(UnfreezableFrameMsg_Delete, content::FrameDeleteIntention)
 
+// Requests the corresponding RenderFrameProxy to be deleted and removed from
+// the frame tree.
+IPC_MESSAGE_ROUTED0(UnfreezableFrameMsg_DeleteProxy)
+
 #endif  // CONTENT_COMMON_UNFREEZABLE_FRAME_MESSAGES_H_
diff --git a/content/renderer/render_frame_proxy.cc b/content/renderer/render_frame_proxy.cc
index d3a8ccf0..a056a23 100644
--- a/content/renderer/render_frame_proxy.cc
+++ b/content/renderer/render_frame_proxy.cc
@@ -20,6 +20,7 @@
 #include "content/common/input_messages.h"
 #include "content/common/page_messages.h"
 #include "content/common/swapped_out_messages.h"
+#include "content/common/unfreezable_frame_messages.h"
 #include "content/common/view_messages.h"
 #include "content/public/common/content_client.h"
 #include "content/public/common/content_switches.h"
@@ -387,7 +388,6 @@
 
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP(RenderFrameProxy, msg)
-    IPC_MESSAGE_HANDLER(FrameMsg_DeleteProxy, OnDeleteProxy)
     IPC_MESSAGE_HANDLER(FrameMsg_ChildFrameProcessGone, OnChildFrameProcessGone)
     IPC_MESSAGE_HANDLER(FrameMsg_FirstSurfaceActivation,
                         OnFirstSurfaceActivation)
@@ -434,6 +434,7 @@
     IPC_MESSAGE_HANDLER(FrameMsg_SetHasReceivedUserGestureBeforeNavigation,
                         OnSetHasReceivedUserGestureBeforeNavigation)
     IPC_MESSAGE_HANDLER(FrameMsg_RenderFallbackContent, OnRenderFallbackContent)
+    IPC_MESSAGE_HANDLER(UnfreezableFrameMsg_DeleteProxy, OnDeleteProxy)
     IPC_MESSAGE_UNHANDLED(handled = false)
   IPC_END_MESSAGE_MAP()