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

Side by Side Diff: chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastApplication.java

Issue 1156873002: Load v8 snapshots directly from APK (and store them uncompressed) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v8initializer
Patch Set: Keep extracting for components/ Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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.chromecast.shell; 5 package org.chromium.chromecast.shell;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.os.Build; 8 import android.os.Build;
9 import android.util.Log; 9 import android.util.Log;
10 10
11 import org.chromium.base.CommandLine; 11 import org.chromium.base.CommandLine;
12 import org.chromium.base.PathUtils; 12 import org.chromium.base.PathUtils;
13 import org.chromium.base.ResourceExtractor; 13 import org.chromium.base.ResourceExtractor;
14 import org.chromium.content.app.ContentApplication; 14 import org.chromium.content.app.ContentApplication;
15 15
16 /** 16 /**
17 * Entry point for the Android cast shell application. Handles initialization o f information that 17 * Entry point for the Android cast shell application. Handles initialization o f information that
18 * needs to be shared across the main activity and the child services created. 18 * needs to be shared across the main activity and the child services created.
19 * 19 *
20 * Note that this gets run for each process, including sandboxed child render pr ocesses. Child 20 * Note that this gets run for each process, including sandboxed child render pr ocesses. Child
21 * processes don't need most of the full "setup" performed in CastBrowserHelper. java, but they do 21 * processes don't need most of the full "setup" performed in CastBrowserHelper. java, but they do
22 * require a few basic pieces (found here). 22 * require a few basic pieces (found here).
23 */ 23 */
24 public class CastApplication extends ContentApplication { 24 public class CastApplication extends ContentApplication {
25 private static final String TAG = "CastApplication"; 25 private static final String TAG = "CastApplication";
26 26
27 private static final String[] MANDATORY_PAK_FILES = new String[] { 27 private static final String[] MANDATORY_PAK_FILES = new String[] {
28 "cast_shell.pak", 28 "cast_shell.pak",
29 "natives_blob.bin",
30 "snapshot_blob.bin"
31 }; 29 };
32 private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "cast_shell"; 30 private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "cast_shell";
33 private static final String COMMAND_LINE_FILE = "/data/local/tmp/castshell-c ommand-line"; 31 private static final String COMMAND_LINE_FILE = "/data/local/tmp/castshell-c ommand-line";
34 32
35 @Override 33 @Override
36 public void onCreate() { 34 public void onCreate() {
37 super.onCreate(); 35 super.onCreate();
38 initializeApplicationParameters(this); 36 initializeApplicationParameters(this);
39 } 37 }
40 38
41 public static void initializeApplicationParameters(Context context) { 39 public static void initializeApplicationParameters(Context context) {
42 ResourceExtractor.setMandatoryPaksToExtract(MANDATORY_PAK_FILES); 40 ResourceExtractor.setMandatoryPaksToExtract(MANDATORY_PAK_FILES);
43 PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX, c ontext); 41 PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX, c ontext);
44 } 42 }
45 43
46 @Override 44 @Override
47 public void initCommandLine() { 45 public void initCommandLine() {
48 if (allowCommandLineImport()) { 46 if (allowCommandLineImport()) {
49 Log.d(TAG, "Initializing command line from " + COMMAND_LINE_FILE); 47 Log.d(TAG, "Initializing command line from " + COMMAND_LINE_FILE);
50 CommandLine.initFromFile(COMMAND_LINE_FILE); 48 CommandLine.initFromFile(COMMAND_LINE_FILE);
51 } else { 49 } else {
52 CommandLine.init(null); 50 CommandLine.init(null);
53 } 51 }
54 } 52 }
55 53
56 private static boolean allowCommandLineImport() { 54 private static boolean allowCommandLineImport() {
57 return !Build.TYPE.equals("user"); 55 return !Build.TYPE.equals("user");
58 } 56 }
59 } 57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698