Allow consumers of MessageLoop to specify the type of MessageLoop they want.

This CL introduces a Type enum to MessageLoop, and I also created subclasses of MessageLoop corresponding to the non-default types: MessageLoopForIO and MessageLoopForUI.

I moved all of the platform-specific MessageLoop APIs onto either MessageLoopForIO or MessageLoopForUI.  MessageLoopForIO gets the Watcher API, and MessageLoopForUI gets the Observer and Dispatcher APIs.  Under the hood, both are implemented in terms of MessagePumpWin, but that will change in a future CL.

The Thread class is changed to allow the consumer to specify the Type of MessageLoop they want to have setup on the created thread.

I re-organized message_loop_unittest.cc and timer_unittest.cc so that I could exercise all (or most) of the tests against each type of MessageLoop.

Note:  I know that "explicit MessageLoop(Type type = TYPE_DEFAULT);" is in violation to the style-guide's restriction against default arguments.  I'm working on finding a decent solution to that problem.  Please ignore this issue for now.

The corresponding chrome/ changes are coming in a separate CL due to Reitveld data size limitations.

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


CrOS-Libchrome-Original-Commit: 4d9bdfafcd1393385860bc9fe947e0c07719c0f4
diff --git a/base/thread_unittest.cc b/base/thread_unittest.cc
index c570e91..cad346f 100644
--- a/base/thread_unittest.cc
+++ b/base/thread_unittest.cc
@@ -8,6 +8,8 @@
 #include "base/thread.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
+using base::Thread;
+
 namespace {
 
 class ToggleValue : public Task {
@@ -50,11 +52,13 @@
   EXPECT_FALSE(a.message_loop());
 }
 
-TEST(ThreadTest, StartWithStackSize) {
+TEST(ThreadTest, StartWithOptions_StackSize) {
   Thread a("StartWithStackSize");
   // Ensure that the thread can work with only 12 kb and still process a
   // message.
-  EXPECT_TRUE(a.StartWithStackSize(12*1024));
+  Thread::Options options;
+  options.stack_size = 12*1024;
+  EXPECT_TRUE(a.StartWithOptions(options));
   EXPECT_TRUE(a.message_loop());
 
   bool was_invoked = false;