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

Unified Diff: content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java

Issue 2684433003: Files required by a service now listed in manifest. (Closed)
Patch Set: Synced + addressed comment from @rockot Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
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 e6a84437fbc0ea0786e6e44bf969f43803751509..fea89f4082689540b7a5b8faf187cc6169b6cb56 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(
boliu 2017/02/09 23:59:55 that's a lot of jni calls just put these things i
Jay Civelli 2017/02/10 06:32:34 Merged it all in one JNI call.
+ fdInfo.mId, fd, fdInfo.mOffset, fdInfo.mSize);
+ }
}
+ nativeReleaseFileDescriptorStoreRegistrationContext(storeRegistrationContext);
nativeInitChildProcessImpl(ChildProcessServiceImpl.this, mCpuCount,
mCpuFeatures);
if (mActivitySemaphore.tryAcquire()) {
@@ -401,6 +415,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.

Powered by Google App Engine
This is Rietveld 408576698