| OLD | NEW |
| 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.content.browser; | 5 package org.chromium.content.browser; |
| 6 | 6 |
| 7 import android.content.ComponentName; | 7 import android.content.ComponentName; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.content.pm.ApplicationInfo; | 9 import android.content.pm.ApplicationInfo; |
| 10 import android.content.pm.PackageManager; | 10 import android.content.pm.PackageManager; |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 } | 374 } |
| 375 }; | 375 }; |
| 376 String packageName = creationParams != null ? creationParams.getPackageN
ame() | 376 String packageName = creationParams != null ? creationParams.getPackageN
ame() |
| 377 : context.getPackageName(); | 377 : context.getPackageName(); |
| 378 initConnectionAllocatorsIfNecessary(context, inSandbox, packageName); | 378 initConnectionAllocatorsIfNecessary(context, inSandbox, packageName); |
| 379 return getConnectionAllocator(packageName, inSandbox) | 379 return getConnectionAllocator(packageName, inSandbox) |
| 380 .allocate(context, deathCallback, chromiumLinkerParams, alwaysIn
Foreground, | 380 .allocate(context, deathCallback, chromiumLinkerParams, alwaysIn
Foreground, |
| 381 creationParams); | 381 creationParams); |
| 382 } | 382 } |
| 383 | 383 |
| 384 private static boolean sLinkerInitialized = false; | 384 private static boolean sLinkerInitialized; |
| 385 private static long sLinkerLoadAddress = 0; | 385 private static long sLinkerLoadAddress; |
| 386 | 386 |
| 387 private static ChromiumLinkerParams getLinkerParamsForNewConnection() { | 387 private static ChromiumLinkerParams getLinkerParamsForNewConnection() { |
| 388 if (!sLinkerInitialized) { | 388 if (!sLinkerInitialized) { |
| 389 if (Linker.isUsed()) { | 389 if (Linker.isUsed()) { |
| 390 sLinkerLoadAddress = Linker.getInstance().getBaseLoadAddress(); | 390 sLinkerLoadAddress = Linker.getInstance().getBaseLoadAddress(); |
| 391 if (sLinkerLoadAddress == 0) { | 391 if (sLinkerLoadAddress == 0) { |
| 392 Log.i(TAG, "Shared RELRO support disabled!"); | 392 Log.i(TAG, "Shared RELRO support disabled!"); |
| 393 } | 393 } |
| 394 } | 394 } |
| 395 sLinkerInitialized = true; | 395 sLinkerInitialized = true; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 } | 477 } |
| 478 | 478 |
| 479 // Represents an invalid process handle; same as base/process/process.h kNul
lProcessHandle. | 479 // Represents an invalid process handle; same as base/process/process.h kNul
lProcessHandle. |
| 480 private static final int NULL_PROCESS_HANDLE = 0; | 480 private static final int NULL_PROCESS_HANDLE = 0; |
| 481 | 481 |
| 482 // Map from pid to ChildService connection. | 482 // Map from pid to ChildService connection. |
| 483 private static Map<Integer, ChildProcessConnection> sServiceMap = | 483 private static Map<Integer, ChildProcessConnection> sServiceMap = |
| 484 new ConcurrentHashMap<Integer, ChildProcessConnection>(); | 484 new ConcurrentHashMap<Integer, ChildProcessConnection>(); |
| 485 | 485 |
| 486 // A pre-allocated and pre-bound connection ready for connection setup, or n
ull. | 486 // A pre-allocated and pre-bound connection ready for connection setup, or n
ull. |
| 487 private static ChildProcessConnection sSpareSandboxedConnection = null; | 487 private static ChildProcessConnection sSpareSandboxedConnection; |
| 488 | 488 |
| 489 // Manages oom bindings used to bind chind services. | 489 // Manages oom bindings used to bind chind services. |
| 490 private static BindingManager sBindingManager = BindingManagerImpl.createBin
dingManager(); | 490 private static BindingManager sBindingManager = BindingManagerImpl.createBin
dingManager(); |
| 491 | 491 |
| 492 // Whether the main application is currently brought to the foreground. | 492 // Whether the main application is currently brought to the foreground. |
| 493 private static boolean sApplicationInForeground = true; | 493 private static boolean sApplicationInForeground = true; |
| 494 | 494 |
| 495 @VisibleForTesting | 495 @VisibleForTesting |
| 496 public static void setBindingManagerForTesting(BindingManager manager) { | 496 public static void setBindingManagerForTesting(BindingManager manager) { |
| 497 sBindingManager = manager; | 497 sBindingManager = manager; |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 } | 913 } |
| 914 | 914 |
| 915 private static native void nativeOnChildProcessStarted(long clientContext, i
nt pid); | 915 private static native void nativeOnChildProcessStarted(long clientContext, i
nt pid); |
| 916 private static native void nativeEstablishSurfacePeer( | 916 private static native void nativeEstablishSurfacePeer( |
| 917 int pid, Surface surface, int primaryID, int secondaryID); | 917 int pid, Surface surface, int primaryID, int secondaryID); |
| 918 private static native void nativeCompleteScopedSurfaceRequest( | 918 private static native void nativeCompleteScopedSurfaceRequest( |
| 919 UnguessableToken requestToken, Surface surface); | 919 UnguessableToken requestToken, Surface surface); |
| 920 private static native boolean nativeIsSingleProcess(); | 920 private static native boolean nativeIsSingleProcess(); |
| 921 private static native Surface nativeGetViewSurface(int surfaceId); | 921 private static native Surface nativeGetViewSurface(int surfaceId); |
| 922 } | 922 } |
| OLD | NEW |