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

Side by Side Diff: base/android/java/src/org/chromium/base/ResourceExtractor.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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.base; 5 package org.chromium.base;
6 6
7 import android.annotation.TargetApi; 7 import android.annotation.TargetApi;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.SharedPreferences; 9 import android.content.SharedPreferences;
10 import android.content.pm.PackageInfo; 10 import android.content.pm.PackageInfo;
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 List<String> pakAndSnapshotFileAssets = new ArrayList<String>(); 339 List<String> pakAndSnapshotFileAssets = new ArrayList<String>();
340 AssetManager manager = mContext.getResources().getAssets(); 340 AssetManager manager = mContext.getResources().getAssets();
341 try { 341 try {
342 String[] files = manager.list(""); 342 String[] files = manager.list("");
343 for (String file : files) { 343 for (String file : files) {
344 if (file.endsWith(".pak")) pakAndSnapshotFileAssets.add(file); 344 if (file.endsWith(".pak")) pakAndSnapshotFileAssets.add(file);
345 } 345 }
346 } catch (IOException e) { 346 } catch (IOException e) {
347 Log.w(LOGTAG, "Exception while accessing assets: " + e.getMessage(), e); 347 Log.w(LOGTAG, "Exception while accessing assets: " + e.getMessage(), e);
348 } 348 }
349 pakAndSnapshotFileAssets.add("natives_blob.bin");
350 pakAndSnapshotFileAssets.add("snapshot_blob.bin");
351 setMandatoryPaksToExtract(pakAndSnapshotFileAssets.toArray( 349 setMandatoryPaksToExtract(pakAndSnapshotFileAssets.toArray(
352 new String[pakAndSnapshotFileAssets.size()])); 350 new String[pakAndSnapshotFileAssets.size()]));
353 } 351 }
354 352
355 private ResourceExtractor(Context context) { 353 private ResourceExtractor(Context context) {
356 mContext = context.getApplicationContext(); 354 mContext = context.getApplicationContext();
357 } 355 }
358 356
359 /** 357 /**
360 * Synchronously wait for the resource extraction to be completed. 358 * Synchronously wait for the resource extraction to be completed.
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 /** 473 /**
476 * Pak extraction not necessarily required by the embedder; we allow them to skip 474 * Pak extraction not necessarily required by the embedder; we allow them to skip
477 * this process if they call setMandatoryPaksToExtract with a single empty S tring. 475 * this process if they call setMandatoryPaksToExtract with a single empty S tring.
478 */ 476 */
479 private static boolean shouldSkipPakExtraction() { 477 private static boolean shouldSkipPakExtraction() {
480 // Must call setMandatoryPaksToExtract before beginning resource extract ion. 478 // Must call setMandatoryPaksToExtract before beginning resource extract ion.
481 assert sMandatoryPaks != null; 479 assert sMandatoryPaks != null;
482 return sMandatoryPaks.length == 1 && "".equals(sMandatoryPaks[0]); 480 return sMandatoryPaks.length == 1 && "".equals(sMandatoryPaks[0]);
483 } 481 }
484 } 482 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698