Clone service_manager::Connector for IO thread

URLLoaderThrottleProviderImpl and WebSocketHandshakeThrottleProviderImpl
used content::RenderThread::Get()->GetConnector() to connect mojo
interfaces. This prevented us from creating these throttle providers
on the IO thread. To allow these throttle providers can be constructed
without going to the main thread, create a clone of the main thread's
connector in ChromeContentRendererClient::RenderThreadStarted().
The cloned connector is bound to the IO thread and will be used
to create throttle providers for off-the-main-thread service worker
startup.

Bug: 989781
Change-Id: Ic4d20813e18c6238700545946cbcfd6f4534d974
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1724754
Reviewed-by: Scott Violet <[email protected]>
Reviewed-by: Ken Rockot <[email protected]>
Commit-Queue: Kenichi Ishibashi <[email protected]>
Cr-Commit-Position: refs/heads/master@{#684169}
diff --git a/chrome/renderer/url_loader_throttle_provider_impl.cc b/chrome/renderer/url_loader_throttle_provider_impl.cc
index b12f277..45e6915 100644
--- a/chrome/renderer/url_loader_throttle_provider_impl.cc
+++ b/chrome/renderer/url_loader_throttle_provider_impl.cc
@@ -112,20 +112,18 @@
 }  // namespace
 
 URLLoaderThrottleProviderImpl::URLLoaderThrottleProviderImpl(
+    service_manager::Connector* connector,
     content::URLLoaderThrottleProviderType type,
     ChromeContentRendererClient* chrome_content_renderer_client)
     : type_(type),
       chrome_content_renderer_client_(chrome_content_renderer_client) {
   DETACH_FROM_THREAD(thread_checker_);
-
-  content::RenderThread::Get()->GetConnector()->BindInterface(
-      content::mojom::kBrowserServiceName,
-      mojo::MakeRequest(&safe_browsing_info_));
+  connector->BindInterface(content::mojom::kBrowserServiceName,
+                           mojo::MakeRequest(&safe_browsing_info_));
 
   if (data_reduction_proxy::params::IsEnabledWithNetworkService()) {
-    content::RenderThread::Get()->GetConnector()->BindInterface(
-        content::mojom::kBrowserServiceName,
-        mojo::MakeRequest(&data_reduction_proxy_info_));
+    connector->BindInterface(content::mojom::kBrowserServiceName,
+                             mojo::MakeRequest(&data_reduction_proxy_info_));
   }
 }