OLD | NEW |
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 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.os.Handler; | 8 import android.os.Handler; |
9 import android.util.Log; | |
10 | 9 |
11 import org.chromium.base.CalledByNative; | 10 import org.chromium.base.CalledByNative; |
12 import org.chromium.base.JNINamespace; | 11 import org.chromium.base.JNINamespace; |
| 12 import org.chromium.base.Log; |
13 import org.chromium.base.ResourceExtractor; | 13 import org.chromium.base.ResourceExtractor; |
14 import org.chromium.base.ThreadUtils; | 14 import org.chromium.base.ThreadUtils; |
15 import org.chromium.base.VisibleForTesting; | 15 import org.chromium.base.VisibleForTesting; |
16 import org.chromium.base.library_loader.LibraryLoader; | 16 import org.chromium.base.library_loader.LibraryLoader; |
17 import org.chromium.base.library_loader.LibraryProcessType; | 17 import org.chromium.base.library_loader.LibraryProcessType; |
18 import org.chromium.base.library_loader.LoaderErrors; | 18 import org.chromium.base.library_loader.LoaderErrors; |
19 import org.chromium.base.library_loader.ProcessInitException; | 19 import org.chromium.base.library_loader.ProcessInitException; |
20 import org.chromium.content.app.ContentMain; | 20 import org.chromium.content.app.ContentMain; |
21 | 21 |
22 import java.util.ArrayList; | 22 import java.util.ArrayList; |
(...skipping 16 matching lines...) Expand all Loading... |
39 public class BrowserStartupController { | 39 public class BrowserStartupController { |
40 | 40 |
41 /** | 41 /** |
42 * This provides the interface to the callbacks for successful or failed sta
rtup | 42 * This provides the interface to the callbacks for successful or failed sta
rtup |
43 */ | 43 */ |
44 public interface StartupCallback { | 44 public interface StartupCallback { |
45 void onSuccess(boolean alreadyStarted); | 45 void onSuccess(boolean alreadyStarted); |
46 void onFailure(); | 46 void onFailure(); |
47 } | 47 } |
48 | 48 |
49 private static final String TAG = "BrowserStartupController"; | 49 private static final String TAG = "cr.BrowserStartup"; |
50 | 50 |
51 // Helper constants for {@link StartupCallback#onSuccess}. | 51 // Helper constants for {@link StartupCallback#onSuccess}. |
52 private static final boolean ALREADY_STARTED = true; | 52 private static final boolean ALREADY_STARTED = true; |
53 private static final boolean NOT_ALREADY_STARTED = false; | 53 private static final boolean NOT_ALREADY_STARTED = false; |
54 | 54 |
55 // Helper constants for {@link #executeEnqueuedCallbacks(int, boolean)}. | 55 // Helper constants for {@link #executeEnqueuedCallbacks(int, boolean)}. |
56 @VisibleForTesting | 56 @VisibleForTesting |
57 static final int STARTUP_SUCCESS = -1; | 57 static final int STARTUP_SUCCESS = -1; |
58 @VisibleForTesting | 58 @VisibleForTesting |
59 static final int STARTUP_FAILURE = 1; | 59 static final int STARTUP_FAILURE = 1; |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 callback.onFailure(); | 265 callback.onFailure(); |
266 } | 266 } |
267 } | 267 } |
268 }); | 268 }); |
269 } | 269 } |
270 | 270 |
271 @VisibleForTesting | 271 @VisibleForTesting |
272 void prepareToStartBrowserProcess( | 272 void prepareToStartBrowserProcess( |
273 final boolean singleProcess, final Runnable completionCallback) | 273 final boolean singleProcess, final Runnable completionCallback) |
274 throws ProcessInitException { | 274 throws ProcessInitException { |
275 Log.i(TAG, "Initializing chromium process, singleProcess=" + singleProce
ss); | 275 Log.i(TAG, "Initializing chromium process, singleProcess=%b", singleProc
ess); |
276 | 276 |
277 // Normally Main.java will have kicked this off asynchronously for Chrom
e. But other | 277 // Normally Main.java will have kicked this off asynchronously for Chrom
e. But other |
278 // ContentView apps like tests also need them so we make sure we've extr
acted resources | 278 // ContentView apps like tests also need them so we make sure we've extr
acted resources |
279 // here. We can still make it a little async (wait until the library is
loaded). | 279 // here. We can still make it a little async (wait until the library is
loaded). |
280 ResourceExtractor resourceExtractor = ResourceExtractor.get(mContext); | 280 ResourceExtractor resourceExtractor = ResourceExtractor.get(mContext); |
281 resourceExtractor.startExtractingResources(); | 281 resourceExtractor.startExtractingResources(); |
282 | 282 |
283 // Normally Main.java will have already loaded the library asynchronousl
y, we only need | 283 // Normally Main.java will have already loaded the library asynchronousl
y, we only need |
284 // to load it here if we arrived via another flow, e.g. bookmark access
& sync setup. | 284 // to load it here if we arrived via another flow, e.g. bookmark access
& sync setup. |
285 LibraryLoader.get(mLibraryProcessType).ensureInitialized(mContext, true)
; | 285 LibraryLoader.get(mLibraryProcessType).ensureInitialized(mContext, true)
; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 | 329 |
330 private static native void nativeSetCommandLineFlags( | 330 private static native void nativeSetCommandLineFlags( |
331 boolean singleProcess, String pluginDescriptor); | 331 boolean singleProcess, String pluginDescriptor); |
332 | 332 |
333 // Is this an official build of Chrome? Only native code knows for sure. Off
icial build | 333 // Is this an official build of Chrome? Only native code knows for sure. Off
icial build |
334 // knowledge is needed very early in process startup. | 334 // knowledge is needed very early in process startup. |
335 private static native boolean nativeIsOfficialBuild(); | 335 private static native boolean nativeIsOfficialBuild(); |
336 | 336 |
337 private static native boolean nativeIsPluginEnabled(); | 337 private static native boolean nativeIsPluginEnabled(); |
338 } | 338 } |
OLD | NEW |