Mojofy RenderFrameImpl::JavaScriptExecuteRequest*

This CL refactors FrameMsg_JavaScriptExecuteRequest* and
FrameHostMsg_JavaScriptExecuteResponse from being a legacy IPC message
into a method on mojom::Frame and mojom::FrameHost.

This is necessary for bfcache where JavaScript must not be executed on
per-thread task runners. While legacy IPC processes messages on a
per-thread (default) task runner, Mojo can dispatch on a per-frame task
runner.

Bug: 870606
Change-Id: Ie655dc6f594568f70efd3f030e9d49257c64cc2a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1488405
Commit-Queue: Hajime Hoshi <[email protected]>
Reviewed-by: Avi Drissman <[email protected]>
Reviewed-by: Ted Choc <[email protected]>
Reviewed-by: Ken Rockot <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Cr-Commit-Position: refs/heads/master@{#638476}
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index d0df613..634e9d0 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -620,6 +620,18 @@
       blink::mojom::DevToolsAgentHostAssociatedPtrInfo host,
       blink::mojom::DevToolsAgentAssociatedRequest request) override;
 
+  void JavaScriptExecuteRequest(const base::string16& javascript,
+                                int id,
+                                bool notify_result) override;
+  void JavaScriptExecuteRequestForTests(const base::string16& javascript,
+                                        int id,
+                                        bool notify_result,
+                                        bool has_user_gesture) override;
+  void JavaScriptExecuteRequestInIsolatedWorld(const base::string16& jscript,
+                                               int id,
+                                               bool notify_result,
+                                               int world_id) override;
+
   // mojom::FullscreenVideoElementHandler implementation:
   void RequestFullscreenVideoElement() override;
 
@@ -984,7 +996,6 @@
     JavaScriptIsolatedWorldRequest(
         int id,
         bool notify_result,
-        int routing_id,
         base::WeakPtr<RenderFrameImpl> render_frame_impl);
     void Completed(
         const blink::WebVector<v8::Local<v8::Value>>& result) override;
@@ -994,7 +1005,6 @@
 
     int id_;
     bool notify_result_;
-    int routing_id_;
     base::WeakPtr<RenderFrameImpl> render_frame_impl_;
 
     DISALLOW_COPY_AND_ASSIGN(JavaScriptIsolatedWorldRequest);
@@ -1086,17 +1096,6 @@
   void OnSaveImageAt(int x, int y);
   void OnAddMessageToConsole(ConsoleMessageLevel level,
                              const std::string& message);
-  void OnJavaScriptExecuteRequest(const base::string16& javascript,
-                                  int id,
-                                  bool notify_result);
-  void OnJavaScriptExecuteRequestForTests(const base::string16& javascript,
-                                          int id,
-                                          bool notify_result,
-                                          bool has_user_gesture);
-  void OnJavaScriptExecuteRequestInIsolatedWorld(const base::string16& jscript,
-                                                 int id,
-                                                 bool notify_result,
-                                                 int world_id);
   void OnVisualStateRequest(uint64_t key);
   void OnReload(bool bypass_cache);
   void OnReloadLoFiImages();