-From 2e8e78b202515864cedb539a04642a21a441331c Mon Sep 17 00:00:00 2001
+From ecc46c5f7780c7c55ef45c229f9c924bd4de839d Mon Sep 17 00:00:00 2001
 From: Tiago Vignatti <tiago.vignatti@intel.com>
 Date: Tue, 13 Aug 2013 11:51:41 +0300
-Subject: [PATCH 7/7] content/browser: Use in-process for 3D contexts
+Subject: [PATCH] content/browser: Use in-process for 3D contexts
 
 This has to be properly implemented later to use command buffer (GPU process).
 ---
- content/browser/aura/image_transport_factory.cc |    7 +++++++
- content/browser/browser_main_loop.cc            |    3 ++-
+ content/browser/aura/image_transport_factory.cc |    5 +++++
+ content/browser/browser_main_loop.cc            |    5 +++--
  ui/aura/demo/demo_main.cc                       |    5 +++++
- 3 files changed, 14 insertions(+), 1 deletion(-)
+ ui/compositor/compositor.cc                     |    5 +++++
+ 4 files changed, 18 insertions(+), 2 deletions(-)
 
 diff --git a/content/browser/aura/image_transport_factory.cc b/content/browser/aura/image_transport_factory.cc
-index 28b04bf..ff2f980 100644
+index 28b04bf..796b8c6 100644
 --- a/content/browser/aura/image_transport_factory.cc
 +++ b/content/browser/aura/image_transport_factory.cc
-@@ -44,6 +44,13 @@ static bool UseTestContextAndTransportFactory() {
+@@ -44,6 +44,11 @@ static bool UseTestContextAndTransportFactory() {
  
  // static
  void ImageTransportFactory::Initialize() {
 +#if defined(USE_OZONE)
 +  // XXX: hack for in-process only 3D contexts
-+  bool allow_test_contexts = false;
-+  ui::Compositor::InitializeContextFactoryForTests(allow_test_contexts);
 +  g_factory = new NoTransportImageTransportFactory(NULL);
 +  return;
 +#endif

     g_factory =
         new NoTransportImageTransportFactory(new ui::TestContextFactory);
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index c51b5c5..b1b68be 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -658,7 +658,8 @@ int BrowserMainLoop::PreMainMessageLoopRun() {
   // If the UI thread blocks, the whole UI is unresponsive.
   // Do not allow disk IO from the UI thread.
   base::ThreadRestrictions::SetIOAllowed(false);
-  base::ThreadRestrictions::DisallowWaiting();
+  // InProcessCommandBuffer::Initialize needs Wait() (r19522006)
+  //base::ThreadRestrictions::DisallowWaiting();
   return result_code_;
 }

   // Create the message-loop here before creating the root window.
   base::MessageLoop message_loop(base::MessageLoop::TYPE_UI);
   aura::Env::GetInstance();
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
index 88cfc56..f92867c 100644
--- a/ui/compositor/compositor.cc
+++ b/ui/compositor/compositor.cc
@@ -83,6 +83,11 @@ namespace ui {
 
 // static
 ContextFactory* ContextFactory::GetInstance() {
+  // XXX: hack for in-process only 3D contexts
+  if (!g_context_factory) {
+    bool allow_test_contexts = false;
+    Compositor::InitializeContextFactoryForTests(allow_test_contexts);
+  }
   DCHECK(g_context_factory);
   return g_context_factory;
 }
-- 
1.7.9.5

