Replace RenderFrameSetup with Frame interfaces.

The idea is to allow each end to create a MP immediately and start writing to it before the other side is bound, and remove the queueing logic in ServiceRegistry.

Post-mojoification the InterfaceProvider should be obtained from Frame/FrameHost interfaces, so this seemed like as good a time as any to introduce them.

[email protected],[email protected]
BUG=
CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_site_isolation

Review-Url: https://codereview.chromium.org/2072603002
Cr-Commit-Position: refs/heads/master@{#400579}
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h
index 3fbf1d4..3c9cd7f9 100644
--- a/content/renderer/render_thread_impl.h
+++ b/content/renderer/render_thread_impl.h
@@ -24,6 +24,7 @@
 #include "build/build_config.h"
 #include "content/child/child_thread_impl.h"
 #include "content/common/content_export.h"
+#include "content/common/frame.mojom.h"
 #include "content/common/frame_replication_state.h"
 #include "content/common/gpu_process_launch_causes.h"
 #include "content/common/storage_partition_service.mojom.h"
@@ -436,10 +437,9 @@
   void AddEmbeddedWorkerRoute(int32_t routing_id, IPC::Listener* listener);
   void RemoveEmbeddedWorkerRoute(int32_t routing_id);
 
-  void RegisterPendingRenderFrameConnect(
-      int routing_id,
-      shell::mojom::InterfaceProviderRequest services,
-      shell::mojom::InterfaceProviderPtr exposed_services);
+  void RegisterPendingFrameCreate(int routing_id,
+                                  mojom::FrameRequest frame,
+                                  mojom::FrameHostPtr host);
 
   mojom::StoragePartitionService* GetStoragePartitionService();
 
@@ -663,36 +663,34 @@
   bool are_image_decode_tasks_enabled_;
   bool is_threaded_animation_enabled_;
 
-  class PendingRenderFrameConnect
-      : public base::RefCounted<PendingRenderFrameConnect> {
+  class PendingFrameCreate : public base::RefCounted<PendingFrameCreate> {
    public:
-    PendingRenderFrameConnect(
-        int routing_id,
-        shell::mojom::InterfaceProviderRequest services,
-        shell::mojom::InterfaceProviderPtr exposed_services);
+     PendingFrameCreate(int routing_id,
+                        mojom::FrameRequest frame_request,
+                        mojom::FrameHostPtr frame_host);
 
-    shell::mojom::InterfaceProviderRequest& services() { return services_; }
-
-    shell::mojom::InterfaceProviderPtr& exposed_services() {
-      return exposed_services_;
+    mojom::FrameRequest TakeFrameRequest() { return std::move(frame_request_); }
+    mojom::FrameHostPtr TakeFrameHost() {
+      frame_host_.set_connection_error_handler(mojo::Closure());
+      return std::move(frame_host_);
     }
 
    private:
-    friend class base::RefCounted<PendingRenderFrameConnect>;
+    friend class base::RefCounted<PendingFrameCreate>;
 
-    ~PendingRenderFrameConnect();
+    ~PendingFrameCreate();
 
     // Mojo error handler.
     void OnConnectionError();
 
     int routing_id_;
-    shell::mojom::InterfaceProviderRequest services_;
-    shell::mojom::InterfaceProviderPtr exposed_services_;
+    mojom::FrameRequest frame_request_;
+    mojom::FrameHostPtr frame_host_;
   };
 
-  typedef std::map<int, scoped_refptr<PendingRenderFrameConnect>>
-      PendingRenderFrameConnectMap;
-  PendingRenderFrameConnectMap pending_render_frame_connects_;
+  using PendingFrameCreateMap =
+      std::map<int, scoped_refptr<PendingFrameCreate>>;
+  PendingFrameCreateMap pending_frame_creates_;
 
   mojom::StoragePartitionServicePtr storage_partition_service_;