Revert of Remove EnableThreadedCompositing from the browser. (https://codereview.chromium.org/337783002/)

Reason for revert:
Broke virtual/implsidepainting/inspector/timeline, made them use single threaded compositor (and impl side painting).

Original issue's description:
> Remove EnableThreadedCompositing from the browser.
> 
> Now only --disable-threaded-compositing exists, which is only present
> for layout tests. The --enable-threaded-compositing flag moves to
> become a content shell flag only, as it's only used for DumpRenderTree.
> 
> Change any checks in the renderer process for kEnableThreadedCompositing
> to instead be !kDisableThreadedCompositing since that is the only
> flag left.
> 
> Remove the whole threaded compositing thing from about:gpu and
> about:flags.
> 
> R=piman
> BUG=384381,346363
> 
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=278151

[email protected]
NOTREECHECKS=true
NOTRY=true
BUG=384381,346363

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278178 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index b7c72fa5..dd278d60 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -148,11 +148,6 @@
   return it->second;
 }
 
-bool IsThreadedCompositingEnabled() {
-  content::RenderThreadImpl* impl = content::RenderThreadImpl::current();
-  return impl && !!impl->compositor_message_loop_proxy().get();
-}
-
 // TODO(brianderson): Replace the hard-coded threshold with a fraction of
 // the BeginMainFrame interval.
 // 4166us will allow 1/4 of a 60Hz interval or 1/2 of a 120Hz interval to
@@ -393,6 +388,7 @@
       suppress_next_char_events_(false),
       screen_info_(screen_info),
       device_scale_factor_(screen_info_.deviceScaleFactor),
+      is_threaded_compositing_enabled_(false),
       current_event_latency_info_(NULL),
       next_output_surface_id_(0),
 #if defined(OS_ANDROID)
@@ -406,6 +402,9 @@
   if (!swapped_out)
     RenderProcess::current()->AddRefProcess();
   DCHECK(RenderThread::Get());
+  is_threaded_compositing_enabled_ =
+      CommandLine::ForCurrentProcess()->HasSwitch(
+          switches::kEnableThreadedCompositing);
 }
 
 RenderWidget::~RenderWidget() {
@@ -834,7 +833,7 @@
 
   uint32 output_surface_id = next_output_surface_id_++;
   if (command_line.HasSwitch(switches::kEnableDelegatedRenderer)) {
-    DCHECK(IsThreadedCompositingEnabled());
+    DCHECK(is_threaded_compositing_enabled_);
     return scoped_ptr<cc::OutputSurface>(
         new DelegatedCompositorOutputSurface(
             routing_id(),
@@ -857,7 +856,7 @@
     // Composite-to-mailbox is currently used for layout tests in order to cause
     // them to draw inside in the renderer to do the readback there. This should
     // no longer be the case when crbug.com/311404 is fixed.
-    DCHECK(IsThreadedCompositingEnabled() ||
+    DCHECK(is_threaded_compositing_enabled_ ||
            RenderThreadImpl::current()->layout_test_mode());
     cc::ResourceFormat format = cc::RGBA_8888;
 #if defined(OS_ANDROID)
@@ -1168,8 +1167,8 @@
 }
 
 void RenderWidget::initializeLayerTreeView() {
-  compositor_ =
-      RenderWidgetCompositor::Create(this, IsThreadedCompositingEnabled());
+  compositor_ = RenderWidgetCompositor::Create(
+      this, is_threaded_compositing_enabled_);
   compositor_->setViewportSize(size_, physical_backing_size_);
   if (init_complete_)
     StartCompositor();