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

Side by Side Diff: sky/shell/sky_main.cc

Issue 893643002: Add a standalone SkyShell.apk for testing (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "sky/shell/sky_main.h"
6
7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h"
10 #include "base/at_exit.h"
11 #include "base/bind.h"
12 #include "base/command_line.h"
13 #include "base/lazy_instance.h"
14 #include "base/logging.h"
15 #include "base/macros.h"
16 #include "base/message_loop/message_loop.h"
17 #include "base/run_loop.h"
18 #include "base/threading/simple_thread.h"
19 #include "jni/SkyMain_jni.h"
20
21 using base::LazyInstance;
22
23 namespace sky {
24 namespace shell {
25
26 namespace {
27
28 const char kLogTag[] = "chromium";
eseidel 2015/01/30 21:57:56 !?!
29
30 LazyInstance<scoped_ptr<base::MessageLoop>> g_java_message_loop =
31 LAZY_INSTANCE_INITIALIZER;
32
33 LazyInstance<base::android::ScopedJavaGlobalRef<jobject>> g_main_activiy =
34 LAZY_INSTANCE_INITIALIZER;
35
36 void InitializeLogging() {
37 logging::LoggingSettings settings;
38 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
39 logging::InitLogging(settings);
40 // To view log output with IDs and timestamps use "adb logcat -v threadtime".
41 logging::SetLogItems(false, // Process ID
42 false, // Thread ID
43 false, // Timestamp
44 false); // Tick count
45 }
46
47 } // namespace
48
49 static void Init(JNIEnv* env,
50 jclass clazz,
51 jobject activity) {
52 g_main_activiy.Get().Reset(env, activity);
53
54 base::android::ScopedJavaLocalRef<jobject> scoped_activity(env, activity);
55 base::android::InitApplicationContext(env, scoped_activity);
56
57 base::CommandLine::Init(0, nullptr);
58
59 InitializeLogging();
60
61 g_java_message_loop.Get().reset(new base::MessageLoopForUI);
62 base::MessageLoopForUI::current()->Start();
63 }
64
65 static jboolean Start(JNIEnv* env, jclass clazz) {
66 LOG(INFO) << "Native code started!";
67 return true;
68 }
69
70 bool RegisterSkyMain(JNIEnv* env) {
71 return RegisterNativesImpl(env);
72 }
73
74 } // namespace sky
75 } // namespace mojo
OLDNEW
« sky/shell/apk/src/org/domokit/sky/shell/SkyShellApplication.java ('K') | « sky/shell/sky_main.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698