diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-14 20:18:29 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-14 20:18:29 +0000 |
commit | 1ba6c7e1078e14901b6b1d86c20db490e107375e (patch) | |
tree | 3636f9da0992c881f1f2eaac1b97f82b104fd395 /mojo/shell | |
parent | a6699f3e95281be7fa0d9a6d12024e7b561dcab2 (diff) | |
download | chromium_src-1ba6c7e1078e14901b6b1d86c20db490e107375e.zip chromium_src-1ba6c7e1078e14901b6b1d86c20db490e107375e.tar.gz chromium_src-1ba6c7e1078e14901b6b1d86c20db490e107375e.tar.bz2 |
Mojo: nuke EnvironmentData
With this change, Mojo applications that link against mojo_environment_chromium
do not need to instantiate mojo::Environment. We rely on AtExitManager for all
finalization of singleton objects. This frees us up to use the familiar
base::Singleton and base::LazyInstance for any such state. Tests can use
ShadowingAtExitManager to clean the environment between test runs.
It becomes a link error to use mojo::Environment if you are not linking against
mojo_environment_standalone. I plan to follow this up with a change that buries
mojo::Environment for the case where you are linking against
mojo_environment_standalone. Ideally, this means no one will ever need to think
about mojo::Environment again.
Review URL: https://codereview.chromium.org/281353005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277265 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/shell')
-rw-r--r-- | mojo/shell/android/mojo_main.cc | 7 | ||||
-rw-r--r-- | mojo/shell/context.cc | 2 | ||||
-rw-r--r-- | mojo/shell/desktop/mojo_main.cc | 2 | ||||
-rw-r--r-- | mojo/shell/shell_test_base.h | 3 | ||||
-rw-r--r-- | mojo/shell/shell_test_helper.h | 3 |
5 files changed, 1 insertions, 16 deletions
diff --git a/mojo/shell/android/mojo_main.cc b/mojo/shell/android/mojo_main.cc index 3faf73f..c265632 100644 --- a/mojo/shell/android/mojo_main.cc +++ b/mojo/shell/android/mojo_main.cc @@ -14,7 +14,6 @@ #include "base/message_loop/message_loop.h" #include "jni/MojoMain_jni.h" #include "mojo/public/cpp/application/application.h" -#include "mojo/public/cpp/environment/environment.h" #include "mojo/service_manager/service_loader.h" #include "mojo/service_manager/service_manager.h" #include "mojo/shell/context.h" @@ -34,10 +33,6 @@ LazyInstance<scoped_ptr<base::MessageLoop> > g_java_message_loop = LazyInstance<scoped_ptr<shell::Context> > g_context = LAZY_INSTANCE_INITIALIZER; - -LazyInstance<scoped_ptr<mojo::Environment> > g_env = - LAZY_INSTANCE_INITIALIZER; - } // namespace static void Init(JNIEnv* env, jclass clazz, jobject context) { @@ -68,8 +63,6 @@ static void Start(JNIEnv* env, jclass clazz, jobject context, jstring jurl) { app_urls.push_back(GURL(base::android::ConvertJavaStringToUTF8(env, jurl))); #endif - g_env.Get().reset(new Environment); - base::android::ScopedJavaGlobalRef<jobject> activity; activity.Reset(env, context); diff --git a/mojo/shell/context.cc b/mojo/shell/context.cc index 608fc53..b47967e 100644 --- a/mojo/shell/context.cc +++ b/mojo/shell/context.cc @@ -54,7 +54,7 @@ class Setup { DISALLOW_COPY_AND_ASSIGN(Setup); }; -static base::LazyInstance<Setup> setup = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance<Setup>::Leaky setup = LAZY_INSTANCE_INITIALIZER; } // namespace diff --git a/mojo/shell/desktop/mojo_main.cc b/mojo/shell/desktop/mojo_main.cc index 7fc116f..de2d0d4 100644 --- a/mojo/shell/desktop/mojo_main.cc +++ b/mojo/shell/desktop/mojo_main.cc @@ -7,7 +7,6 @@ #include "base/command_line.h" #include "base/logging.h" #include "base/message_loop/message_loop.h" -#include "mojo/public/cpp/environment/environment.h" #include "mojo/shell/child_process.h" #include "mojo/shell/context.h" #include "mojo/shell/init.h" @@ -17,7 +16,6 @@ int main(int argc, char** argv) { base::AtExitManager at_exit; - mojo::Environment env; base::CommandLine::Init(argc, argv); mojo::shell::InitializeLogging(); diff --git a/mojo/shell/shell_test_base.h b/mojo/shell/shell_test_base.h index 639a0a7..84864b7 100644 --- a/mojo/shell/shell_test_base.h +++ b/mojo/shell/shell_test_base.h @@ -9,7 +9,6 @@ #include "base/macros.h" #include "base/memory/scoped_ptr.h" -#include "mojo/public/cpp/environment/environment.h" #include "mojo/public/cpp/system/core.h" #include "testing/gtest/include/gtest/gtest.h" @@ -44,8 +43,6 @@ class ShellTestBase : public testing::Test { Context* shell_context() { return shell_context_.get(); } private: - Environment environment_; - // Only set if/when |InitMojo()| is called. scoped_ptr<base::MessageLoop> message_loop_; scoped_ptr<Context> shell_context_; diff --git a/mojo/shell/shell_test_helper.h b/mojo/shell/shell_test_helper.h index 04a4df5..ef8af89 100644 --- a/mojo/shell/shell_test_helper.h +++ b/mojo/shell/shell_test_helper.h @@ -8,7 +8,6 @@ #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/run_loop.h" -#include "mojo/public/cpp/environment/environment.h" #include "mojo/public/interfaces/service_provider/service_provider.mojom.h" #include "mojo/service_manager/service_loader.h" #include "mojo/shell/context.h" @@ -42,8 +41,6 @@ class ShellTestHelper { private: class TestServiceProvider; - Environment environment_; - scoped_ptr<Context> context_; scoped_ptr<ServiceManager::TestAPI> test_api_; |