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

Side by Side Diff: remoting/client/jni/chromoting_jni_runtime.cc

Issue 1407233017: Define a Java-side global application context. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Undo changes to ApplicationStatus Created 5 years, 1 month 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
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 "remoting/client/jni/chromoting_jni_runtime.h" 5 #include "remoting/client/jni/chromoting_jni_runtime.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/library_loader/library_loader_hooks.h" 10 #include "base/android/library_loader/library_loader_hooks.h"
(...skipping 20 matching lines...) Expand all
31 31
32 namespace remoting { 32 namespace remoting {
33 33
34 bool RegisterChromotingJniRuntime(JNIEnv* env) { 34 bool RegisterChromotingJniRuntime(JNIEnv* env) {
35 return remoting::RegisterNativesImpl(env); 35 return remoting::RegisterNativesImpl(env);
36 } 36 }
37 37
38 // Implementation of stubs defined in JniInterface_jni.h. These are the entry 38 // Implementation of stubs defined in JniInterface_jni.h. These are the entry
39 // points for JNI calls from Java into C++. 39 // points for JNI calls from Java into C++.
40 40
41 static void LoadNative(JNIEnv* env, 41 static void LoadNative(JNIEnv* env, const JavaParamRef<jclass>& clazz) {
42 const JavaParamRef<jclass>& clazz,
43 const JavaParamRef<jobject>& context) {
44 base::android::InitApplicationContext(env, context);
45
46 // The google_apis functions check the command-line arguments to make sure no 42 // The google_apis functions check the command-line arguments to make sure no
47 // runtime API keys have been specified by the environment. Unfortunately, we 43 // runtime API keys have been specified by the environment. Unfortunately, we
48 // neither launch Chromium nor have a command line, so we need to prevent 44 // neither launch Chromium nor have a command line, so we need to prevent
49 // them from DCHECKing out when they go looking. 45 // them from DCHECKing out when they go looking.
50 base::CommandLine::Init(0, nullptr); 46 base::CommandLine::Init(0, nullptr);
51 47
52 // Create the singleton now so that the Chromoting threads will be set up. 48 // Create the singleton now so that the Chromoting threads will be set up.
53 remoting::ChromotingJniRuntime::GetInstance(); 49 remoting::ChromotingJniRuntime::GetInstance();
54 } 50 }
55 51
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 390
395 JNIEnv* env = base::android::AttachCurrentThread(); 391 JNIEnv* env = base::android::AttachCurrentThread();
396 Java_JniInterface_redrawGraphicsInternal(env); 392 Java_JniInterface_redrawGraphicsInternal(env);
397 } 393 }
398 394
399 void ChromotingJniRuntime::DetachFromVmAndSignal(base::WaitableEvent* waiter) { 395 void ChromotingJniRuntime::DetachFromVmAndSignal(base::WaitableEvent* waiter) {
400 base::android::DetachFromVM(); 396 base::android::DetachFromVM();
401 waiter->Signal(); 397 waiter->Signal();
402 } 398 }
403 } // namespace remoting 399 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698