Mojo: AsyncWaiter and mojo/public/environment

Summary of changes:

 o BindingsSupport is gone:
   - mojo/public/bindings/lib depends on mojo/public/environment/,
     which is also a static library.
   - mojo/public/environment provides a default implementation of
     MojoAsyncWaiter (replacing the AsyncWait functionality of
     BindingsSupport).
   - mojo/public/environment provides TLS support for storing the
     current Buffer* (replacing the Set/GetCurrentBuffer functionality
     of BindingsSupport).
   - mojo/public/environment provides the Environment class, formerly
     part of mojo/public/utility/
   - The standalone implementation of mojo/public/environment/ depends
     on mojo/public/utility/ and assumes clients will be instantiating
     RunLoops on their threads.
   - The chromium-specific implementation of mojo/public/environment/
     depends on mojo/common/ and assumes clients will be instantiating
     MessageLoops on their threads.
   - The chromium-specific implementation of mojo/public/environment/
     is divided into two targets: mojo_environment_chromium and
     mojo_environment_chromium_impl. The former is a static library and
     the latter is a component. (This way all of the state--TLS keys--
     associated with the environment is kept in a DSO when using a
     component build.)

 o RemotePtr and Connector may optionally be parameterized with a
   MojoAsyncWaiter*, allowing users to customize how AsyncWait is
   implemented for a particular usage of bindings. This is needed by
   the GL library so that it can schedule work on an application
   defined run loop.

 o RunLoop gains a RunUntilIdle method to support tests. This allows us
   to delete SimpleBindingsSupport instead of converting it over to an
   implementation of MojoAsyncWaiter.

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244739 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/mojo/mojo.gyp b/mojo/mojo.gyp
index 1b06f5f9..415ab6689 100644
--- a/mojo/mojo.gyp
+++ b/mojo/mojo.gyp
@@ -35,6 +35,7 @@
         'mojo_js_unittests',
         'mojo_public_test_support',
         'mojo_public_bindings_unittests',
+        'mojo_public_environment_unittests',
         'mojo_public_system_perftests',
         'mojo_public_system_unittests',
         'mojo_public_utility_unittests',
@@ -197,8 +198,6 @@
         'mojo_system',
       ],
       'sources': [
-        'common/bindings_support_impl.cc',
-        'common/bindings_support_impl.h',
         'common/common_type_converters.cc',
         'common/common_type_converters.h',
         'common/handle_watcher.cc',
@@ -239,6 +238,7 @@
         '../base/base.gyp:base_message_loop_tests',
         '../testing/gtest.gyp:gtest',
         'mojo_bindings',
+        'mojo_environment_chromium',
         'mojo_common_lib',
         'mojo_common_test_support',
         'mojo_public_test_support',
@@ -262,6 +262,45 @@
       ],
     },
     {
+      'target_name': 'mojo_environment_chromium',
+      'type': 'static_library',
+      'dependencies': [
+        'mojo_environment_chromium_impl',
+      ],
+      'sources': [
+        'environment/default_async_waiter.cc',
+        'environment/buffer_tls.cc',
+        'environment/environment.cc',
+      ],
+      'include_dirs': [
+        '..',
+      ],
+      'export_dependent_settings': [
+        'mojo_environment_chromium_impl',
+      ],
+    },
+    {
+      'target_name': 'mojo_environment_chromium_impl',
+      'type': '<(component)',
+      'defines': [
+        'MOJO_ENVIRONMENT_IMPL_IMPLEMENTATION',
+      ],
+      'dependencies': [
+        '../base/base.gyp:base',
+        '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
+        'mojo_common_lib'
+      ],
+      'sources': [
+        'environment/default_async_waiter_impl.cc',
+        'environment/default_async_waiter_impl.h',
+        'environment/buffer_tls_impl.cc',
+        'environment/buffer_tls_impl.h',
+      ],
+      'include_dirs': [
+        '..',
+      ],
+    },
+    {
       'target_name': 'mojo_shell_lib',
       'type': 'static_library',
       'dependencies': [
@@ -326,6 +365,7 @@
         '../ui/gl/gl.gyp:gl',
         '../url/url.gyp:url_lib',
         'mojo_common_lib',
+        'mojo_environment_chromium',
         'mojo_shell_lib',
         'mojo_system',
         'mojo_system_impl',
@@ -349,6 +389,7 @@
         '../base/base.gyp:base',
         '../testing/gtest.gyp:gtest',
         'mojo_common_lib',
+        'mojo_environment_chromium',
         'mojo_run_all_unittests',
         'mojo_shell_lib',
       ],
@@ -409,6 +450,7 @@
             '../ui/gfx/gfx.gyp:gfx_geometry',
             '../ui/gl/gl.gyp:gl',
             'mojo_common_lib',
+            'mojo_environment_chromium',
             'mojo_jni_headers',
             'mojo_shell_bindings',
             'mojo_shell_lib',