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

Side by Side Diff: blimp/client/android/java/src/org/chromium/blimp/BlimpLibraryLoader.java

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 2015 The Chromium Authors. All rights reserved. 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 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 package org.chromium.blimp; 5 package org.chromium.blimp;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.os.Handler; 8 import android.os.Handler;
9 9
10 import org.chromium.base.ContextUtils;
10 import org.chromium.base.ObserverList; 11 import org.chromium.base.ObserverList;
11 import org.chromium.base.ResourceExtractor; 12 import org.chromium.base.ResourceExtractor;
12 import org.chromium.base.ThreadUtils; 13 import org.chromium.base.ThreadUtils;
13 import org.chromium.base.annotations.JNINamespace; 14 import org.chromium.base.annotations.JNINamespace;
14 import org.chromium.base.library_loader.LibraryLoader; 15 import org.chromium.base.library_loader.LibraryLoader;
15 import org.chromium.base.library_loader.LibraryProcessType; 16 import org.chromium.base.library_loader.LibraryProcessType;
16 import org.chromium.base.library_loader.ProcessInitException; 17 import org.chromium.base.library_loader.ProcessInitException;
17 18
18 /** 19 /**
19 * Asynchronously loads and registers the native libraries associated with Blimp . 20 * Asynchronously loads and registers the native libraries associated with Blimp .
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 if (sLoadAttempted) return; 84 if (sLoadAttempted) return;
84 sLoadAttempted = true; 85 sLoadAttempted = true;
85 86
86 ResourceExtractor extractor = ResourceExtractor.get(context); 87 ResourceExtractor extractor = ResourceExtractor.get(context);
87 extractor.startExtractingResources(); 88 extractor.startExtractingResources();
88 LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER).ensureInitialized( context); 89 LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER).ensureInitialized( context);
89 90
90 extractor.addCompletionCallback(new Runnable() { 91 extractor.addCompletionCallback(new Runnable() {
91 @Override 92 @Override
92 public void run() { 93 public void run() {
93 final boolean initResult = nativeInitializeBlimp(context.getAppl icationContext()); 94 ContextUtils.initApplicationContext(context.getApplicationContex t());
95 final boolean initResult = nativeInitializeBlimp();
94 new Handler().post(new Runnable() { 96 new Handler().post(new Runnable() {
95 @Override 97 @Override
96 public void run() { 98 public void run() {
97 // Only run nativeStartBlimp if we properly initialized native. 99 // Only run nativeStartBlimp if we properly initialized native.
98 boolean startResult = initResult && nativeStartBlimp(); 100 boolean startResult = initResult && nativeStartBlimp();
99 sLibraryLoadResult = new Boolean(startResult); 101 sLibraryLoadResult = new Boolean(startResult);
100 102
101 // Notify any oustanding callers to #startAsync(). 103 // Notify any oustanding callers to #startAsync().
102 notifyCallbacksAndClear(); 104 notifyCallbacksAndClear();
103 } 105 }
(...skipping 15 matching lines...) Expand all
119 new Handler().post(new Runnable() { 121 new Handler().post(new Runnable() {
120 @Override 122 @Override
121 public void run() { 123 public void run() {
122 ThreadUtils.assertOnUiThread(); 124 ThreadUtils.assertOnUiThread();
123 callback.onStartupComplete(sLibraryLoadResult); 125 callback.onStartupComplete(sLibraryLoadResult);
124 } 126 }
125 }); 127 });
126 } 128 }
127 129
128 // Native methods. 130 // Native methods.
129 private static native boolean nativeInitializeBlimp(Context context); 131 private static native boolean nativeInitializeBlimp();
130 private static native boolean nativeStartBlimp(); 132 private static native boolean nativeStartBlimp();
131 } 133 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698