Making a way to create thread with a Java Looper for Android

We need to create a new message loop type for this as for
testing the Android UI message pump type is not the standard Java, but gets overridden to a different one that can handle nested message loops.

Using the new Java thread for the java bridge thread, so the thread used for AJI callbacks will have a prepared Looper.

BUG=b/8680913
TBR=jochen@chromium.org

Review URL: https://chromiumcodereview.appspot.com/18584006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@216349 0039d316-1c4b-4281-b951-d872f2087c98


CrOS-Libchrome-Original-Commit: 349ad5872a8ff25729e1b67ad24a09b64571c04c
diff --git a/base/message_loop/message_loop.cc b/base/message_loop/message_loop.cc
index d2eafbd..826c757 100644
--- a/base/message_loop/message_loop.cc
+++ b/base/message_loop/message_loop.cc
@@ -92,7 +92,7 @@
 // time for every task that is added to the MessageLoop incoming queue.
 bool AlwaysNotifyPump(MessageLoop::Type type) {
 #if defined(OS_ANDROID)
-  return type == MessageLoop::TYPE_UI;
+  return type == MessageLoop::TYPE_UI || type == MessageLoop::TYPE_JAVA;
 #else
   return false;
 #endif
@@ -184,6 +184,10 @@
       pump_.reset(MESSAGE_PUMP_UI);
   } else if (type_ == TYPE_IO) {
     pump_.reset(MESSAGE_PUMP_IO);
+#if defined(OS_ANDROID)
+  } else if (type_ == TYPE_JAVA) {
+    pump_.reset(MESSAGE_PUMP_UI);
+#endif
   } else {
     DCHECK_EQ(TYPE_DEFAULT, type_);
     pump_.reset(new MessagePumpDefault());