[jumbo] Inlined a duplicate function GetWorkerThreadIPCMessageSender

A second GetWorkerThreadIPCMessageSender appeared which caused
some (non default) jumbo builds to fail because they ended up
in the same translation unit.

Since they are mostly there to save writing a long expression,
I just inlined them to get past the clash. Alternatives would have
been to rename one of them, or (better) move them to a shared place
so everyone can take advantage of the code.

Bug: 939096

Change-Id: I25b506fb6306c8e023bb39138b91300a48d2c48c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1511400
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Auto-Submit: Daniel Bratell <bratell@opera.com>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#639128}
diff --git a/extensions/renderer/extension_port.cc b/extensions/renderer/extension_port.cc
index 199ebec..05cd0e5 100644
--- a/extensions/renderer/extension_port.cc
+++ b/extensions/renderer/extension_port.cc
@@ -18,15 +18,6 @@
 
 namespace extensions {
 
-namespace {
-
-IPCMessageSender* GetWorkerThreadIPCMessageSender() {
-  DCHECK(worker_thread_util::IsWorkerThread());
-  return WorkerThreadDispatcher::GetBindingsSystem()->GetIPCMessageSender();
-}
-
-}  // namespace
-
 ExtensionPort::ExtensionPort(ScriptContext* script_context,
                              const PortId& id,
                              int js_id)
@@ -37,7 +28,9 @@
 void ExtensionPort::PostExtensionMessage(std::unique_ptr<Message> message) {
   if (worker_thread_util::IsWorkerThread()) {
     DCHECK(!script_context_->GetRenderFrame());
-    GetWorkerThreadIPCMessageSender()->SendPostMessageToPort(id_, *message);
+    WorkerThreadDispatcher::GetBindingsSystem()
+        ->GetIPCMessageSender()
+        ->SendPostMessageToPort(id_, *message);
   } else {
     content::RenderFrame* render_frame = script_context_->GetRenderFrame();
     if (!render_frame)
@@ -49,8 +42,9 @@
 void ExtensionPort::Close(bool close_channel) {
   if (worker_thread_util::IsWorkerThread()) {
     DCHECK(!script_context_->GetRenderFrame());
-    GetWorkerThreadIPCMessageSender()->SendCloseMessagePort(MSG_ROUTING_NONE,
-                                                            id_, close_channel);
+    WorkerThreadDispatcher::GetBindingsSystem()
+        ->GetIPCMessageSender()
+        ->SendCloseMessagePort(MSG_ROUTING_NONE, id_, close_channel);
   } else {
     content::RenderFrame* render_frame = script_context_->GetRenderFrame();
     if (!render_frame)
diff --git a/extensions/renderer/messaging_bindings.cc b/extensions/renderer/messaging_bindings.cc
index ca80343..af9e7a4e 100644
--- a/extensions/renderer/messaging_bindings.cc
+++ b/extensions/renderer/messaging_bindings.cc
@@ -57,11 +57,6 @@
 base::LazyInstance<std::map<ScriptContext*, MessagingBindings*>>::
     DestructorAtExit g_messaging_map = LAZY_INSTANCE_INITIALIZER;
 
-IPCMessageSender* GetWorkerThreadIPCMessageSender() {
-  DCHECK(worker_thread_util::IsWorkerThread());
-  return WorkerThreadDispatcher::GetBindingsSystem()->GetIPCMessageSender();
-}
-
 }  // namespace
 
 MessagingBindings::MessagingBindings(ScriptContext* context)
@@ -312,9 +307,12 @@
   {
     SCOPED_UMA_HISTOGRAM_TIMER("Extensions.Messaging.SetPortIdTime.Tab");
     if (is_for_service_worker) {
-      GetWorkerThreadIPCMessageSender()->SendOpenMessageChannel(
-          context(), port_id, MessageTarget::ForTab(info.tab_id, info.frame_id),
-          channel_name, false /* include_tls_channel_id */);
+      WorkerThreadDispatcher::GetBindingsSystem()
+          ->GetIPCMessageSender()
+          ->SendOpenMessageChannel(
+              context(), port_id,
+              MessageTarget::ForTab(info.tab_id, info.frame_id), channel_name,
+              false /* include_tls_channel_id */);
     } else {
       render_frame->Send(new ExtensionHostMsg_OpenChannelToTab(
           PortContext::ForFrame(render_frame->GetRoutingID()), info,