Remove RenderThread::TaskRunner()

Now that base::ThreadTaskRunnerHandle::Get() will always return the
correct task runner on the renderer main thread, there's no need for the
RenderThread::TaskRunner() getter any longer since it will just return
the same value. This patch removes that function as well as its usage.

Note that instead of the following:

    DCHECK(content::RenderThread::Get()->TaskRunner()->RunsTasksOnCurrentThread())

it's more correct to check for:

    DCHECK(content::RenderThread::Get());

because the current render thread is only non-null when running on the
renderer thread itself.

BUG=465354

Review URL: https://codereview.chromium.org/1233763004

Cr-Commit-Position: refs/heads/master@{#339460}
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 6a99945..24e2846 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -848,6 +848,7 @@
 }
 
 void RenderWidget::OnClose() {
+  DCHECK(content::RenderThread::Get());
   if (closing_)
     return;
   NotifyOnClose();
@@ -864,7 +865,7 @@
   // If there is a Send call on the stack, then it could be dangerous to close
   // now.  Post a task that only gets invoked when there are no nested message
   // loops.
-  RenderThread::Get()->GetTaskRunner()->PostNonNestableTask(
+  base::ThreadTaskRunnerHandle::Get()->PostNonNestableTask(
       FROM_HERE, base::Bind(&RenderWidget::Close, this));
 
   // Balances the AddRef taken when we called AddRoute.
@@ -1561,6 +1562,7 @@
 }
 
 void RenderWidget::closeWidgetSoon() {
+  DCHECK(content::RenderThread::Get());
   if (is_swapped_out_) {
     // This widget is currently swapped out, and the active widget is in a
     // different process.  Have the browser route the close request to the
@@ -1577,7 +1579,7 @@
   // could be closed before the JS finishes executing.  So instead, post a
   // message back to the message loop, which won't run until the JS is
   // complete, and then the Close message can be sent.
-  RenderThread::Get()->GetTaskRunner()->PostTask(
+  base::ThreadTaskRunnerHandle::Get()->PostTask(
       FROM_HERE, base::Bind(&RenderWidget::DoDeferredClose, this));
 }