Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(500)

Side by Side Diff: mojo/shell/android/mojo_main.cc

Issue 281353005: Mojo: nuke EnvironmentData (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix gn Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « mojo/services/view_manager/view_manager_connection_unittest.cc ('k') | mojo/shell/context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/shell/android/mojo_main.h" 5 #include "mojo/shell/android/mojo_main.h"
6 6
7 #include "base/android/jni_string.h" 7 #include "base/android/jni_string.h"
8 #include "base/at_exit.h" 8 #include "base/at_exit.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
15 #include "jni/MojoMain_jni.h" 15 #include "jni/MojoMain_jni.h"
16 #include "mojo/public/cpp/application/application.h" 16 #include "mojo/public/cpp/application/application.h"
17 #include "mojo/public/cpp/environment/environment.h"
18 #include "mojo/service_manager/service_loader.h" 17 #include "mojo/service_manager/service_loader.h"
19 #include "mojo/service_manager/service_manager.h" 18 #include "mojo/service_manager/service_manager.h"
20 #include "mojo/shell/context.h" 19 #include "mojo/shell/context.h"
21 #include "mojo/shell/init.h" 20 #include "mojo/shell/init.h"
22 #include "mojo/shell/run.h" 21 #include "mojo/shell/run.h"
23 #include "ui/gl/gl_surface_egl.h" 22 #include "ui/gl/gl_surface_egl.h"
24 23
25 using base::LazyInstance; 24 using base::LazyInstance;
26 25
27 namespace mojo { 26 namespace mojo {
28 27
29 namespace { 28 namespace {
30 29
31 LazyInstance<scoped_ptr<base::MessageLoop> > g_java_message_loop = 30 LazyInstance<scoped_ptr<base::MessageLoop> > g_java_message_loop =
32 LAZY_INSTANCE_INITIALIZER; 31 LAZY_INSTANCE_INITIALIZER;
33 32
34 LazyInstance<scoped_ptr<shell::Context> > g_context = 33 LazyInstance<scoped_ptr<shell::Context> > g_context =
35 LAZY_INSTANCE_INITIALIZER; 34 LAZY_INSTANCE_INITIALIZER;
36 35
37
38 LazyInstance<scoped_ptr<mojo::Environment> > g_env =
39 LAZY_INSTANCE_INITIALIZER;
40
41 } // namespace 36 } // namespace
42 37
43 static void Init(JNIEnv* env, jclass clazz, jobject context) { 38 static void Init(JNIEnv* env, jclass clazz, jobject context) {
44 base::android::ScopedJavaLocalRef<jobject> scoped_context(env, context); 39 base::android::ScopedJavaLocalRef<jobject> scoped_context(env, context);
45 40
46 base::android::InitApplicationContext(env, scoped_context); 41 base::android::InitApplicationContext(env, scoped_context);
47 42
48 base::CommandLine::Init(0, 0); 43 base::CommandLine::Init(0, 0);
49 mojo::shell::InitializeLogging(); 44 mojo::shell::InitializeLogging();
50 45
(...skipping 10 matching lines...) Expand all
61 std::vector<GURL> app_urls; 56 std::vector<GURL> app_urls;
62 #if defined(MOJO_SHELL_DEBUG_URL) 57 #if defined(MOJO_SHELL_DEBUG_URL)
63 app_urls.push_back(GURL(MOJO_SHELL_DEBUG_URL)); 58 app_urls.push_back(GURL(MOJO_SHELL_DEBUG_URL));
64 // Sleep for 5 seconds to give the debugger a chance to attach. 59 // Sleep for 5 seconds to give the debugger a chance to attach.
65 sleep(5); 60 sleep(5);
66 #else 61 #else
67 if (jurl) 62 if (jurl)
68 app_urls.push_back(GURL(base::android::ConvertJavaStringToUTF8(env, jurl))); 63 app_urls.push_back(GURL(base::android::ConvertJavaStringToUTF8(env, jurl)));
69 #endif 64 #endif
70 65
71 g_env.Get().reset(new Environment);
72
73 base::android::ScopedJavaGlobalRef<jobject> activity; 66 base::android::ScopedJavaGlobalRef<jobject> activity;
74 activity.Reset(env, context); 67 activity.Reset(env, context);
75 68
76 shell::Context* shell_context = new shell::Context(); 69 shell::Context* shell_context = new shell::Context();
77 shell_context->set_activity(activity.obj()); 70 shell_context->set_activity(activity.obj());
78 71
79 g_context.Get().reset(shell_context); 72 g_context.Get().reset(shell_context);
80 shell::Run(shell_context, app_urls); 73 shell::Run(shell_context, app_urls);
81 } 74 }
82 75
83 bool RegisterMojoMain(JNIEnv* env) { 76 bool RegisterMojoMain(JNIEnv* env) {
84 return RegisterNativesImpl(env); 77 return RegisterNativesImpl(env);
85 } 78 }
86 79
87 } // namespace mojo 80 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/view_manager/view_manager_connection_unittest.cc ('k') | mojo/shell/context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698