| Index: content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java
|
| diff --git a/content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java b/content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java
|
| index 7df71bb4b475e0d954316fe28455ab670b5a0893..bc5dfc861ce7cfd91ca4bfc3ee298a065e12d428 100644
|
| --- a/content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java
|
| +++ b/content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java
|
| @@ -260,10 +260,24 @@ public class ChildProcessServiceImpl {
|
| mMainThread.wait();
|
| }
|
| }
|
| +
|
| + String sharedFilesValue = CommandLine.getInstance().getSwitchValue(
|
| + ContentSwitches.SHARED_FILES, null);
|
| + long storeRegistrationContext =
|
| + nativeCreateFileDescriptorStoreRegistrationContext(sharedFilesValue);
|
| for (FileDescriptorInfo fdInfo : mFdInfos) {
|
| - nativeRegisterGlobalFileDescriptor(
|
| - fdInfo.mId, fdInfo.mFd.detachFd(), fdInfo.mOffset, fdInfo.mSize);
|
| + // For now we support the FileDescriptorStore (which passes string keys for
|
| + // FDs through the command line) and the GlobalFileDescriptor (which uses
|
| + // int keys).
|
| + int fd = fdInfo.mFd.detachFd();
|
| + if (storeRegistrationContext == 0
|
| + || !nativeRegisterInFileDescriptorStore(storeRegistrationContext,
|
| + fdInfo.mId, fd, fdInfo.mOffset, fdInfo.mSize)) {
|
| + nativeRegisterGlobalFileDescriptor(
|
| + fdInfo.mId, fd, fdInfo.mOffset, fdInfo.mSize);
|
| + }
|
| }
|
| + nativeReleaseFileDescriptorStoreRegistrationContext(storeRegistrationContext);
|
| nativeInitChildProcessImpl(ChildProcessServiceImpl.this, mCpuCount,
|
| mCpuFeatures);
|
| if (mActivitySemaphore.tryAcquire()) {
|
| @@ -443,6 +457,20 @@ public class ChildProcessServiceImpl {
|
| }
|
|
|
| /**
|
| + * Creates/releases a context needed by nativeRegisterInFileDescriptorStore.
|
| + */
|
| + private static native long nativeCreateFileDescriptorStoreRegistrationContext(
|
| + String sharedFileSwitchValue);
|
| + private static native void nativeReleaseFileDescriptorStoreRegistrationContext(long context);
|
| +
|
| + /**
|
| + * Helper for registering FileDescriptorInfo objects with FileDescriptorStore.
|
| + * Returns true if the file was registered (if it was found in the command line).
|
| + */
|
| + private static native boolean nativeRegisterInFileDescriptorStore(
|
| + long context, int id, int fd, long offset, long size);
|
| +
|
| + /**
|
| * Helper for registering FileDescriptorInfo objects with GlobalFileDescriptors.
|
| * This includes the IPC channel, the crash dump signals and resource related
|
| * files.
|
|
|