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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ChildProcessConnectionImpl.java

Issue 1156183003: Pass file Regions along with FDs to child processes on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add operator!= for Region Created 5 years, 7 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/browser/ChildProcessConnectionImpl.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ChildProcessConnectionImpl.java b/content/public/android/java/src/org/chromium/content/browser/ChildProcessConnectionImpl.java
index 2f783f27f0f90c9cadbaa35963ee752df9ac81cf..e134d3625d3ab16879dfe1c59ed732eb93b97a4f 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ChildProcessConnectionImpl.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ChildProcessConnectionImpl.java
@@ -11,7 +11,6 @@ import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.DeadObjectException;
import android.os.IBinder;
-import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.util.Log;
@@ -319,42 +318,12 @@ public class ChildProcessConnectionImpl implements ChildProcessConnection {
Bundle bundle = new Bundle();
bundle.putStringArray(EXTRA_COMMAND_LINE, mConnectionParams.mCommandLine);
-
- FileDescriptorInfo[] fileInfos = mConnectionParams.mFilesToBeMapped;
- ParcelFileDescriptor[] parcelFiles = new ParcelFileDescriptor[fileInfos.length];
- for (int i = 0; i < fileInfos.length; i++) {
- if (fileInfos[i].mFd == -1) {
- // If someone provided an invalid FD, they are doing something wrong.
- Log.e(TAG, "Invalid FD (id=" + fileInfos[i].mId + ") for process connection, "
- + "aborting connection.");
- return;
- }
- String idName = EXTRA_FILES_PREFIX + i + EXTRA_FILES_ID_SUFFIX;
- String fdName = EXTRA_FILES_PREFIX + i + EXTRA_FILES_FD_SUFFIX;
- if (fileInfos[i].mAutoClose) {
- // Adopt the FD, it will be closed when we close the ParcelFileDescriptor.
- parcelFiles[i] = ParcelFileDescriptor.adoptFd(fileInfos[i].mFd);
- } else {
- try {
- parcelFiles[i] = ParcelFileDescriptor.fromFd(fileInfos[i].mFd);
- } catch (IOException e) {
- Log.e(TAG,
- "Invalid FD provided for process connection, aborting connection.",
- e);
- return;
- }
-
- }
- bundle.putParcelable(fdName, parcelFiles[i]);
- bundle.putInt(idName, fileInfos[i].mId);
- }
+ bundle.putParcelableArray(EXTRA_FILES, mConnectionParams.mFilesToBeMapped);
// Add the CPU properties now.
bundle.putInt(EXTRA_CPU_COUNT, CpuFeatures.getCount());
bundle.putLong(EXTRA_CPU_FEATURES, CpuFeatures.getMask());
-
bundle.putBundle(Linker.EXTRA_LINKER_SHARED_RELROS,
mConnectionParams.mSharedRelros);
-
try {
mPid = mService.setupConnection(bundle, mConnectionParams.mCallback);
assert mPid != 0 : "Child service claims to be run by a process of pid=0.";
@@ -363,8 +332,8 @@ public class ChildProcessConnectionImpl implements ChildProcessConnection {
}
// We proactively close the FDs rather than wait for GC & finalizer.
try {
- for (ParcelFileDescriptor parcelFile : parcelFiles) {
- if (parcelFile != null) parcelFile.close();
+ for (FileDescriptorInfo fileInfo : mConnectionParams.mFilesToBeMapped) {
+ fileInfo.mFd.close();
}
} catch (IOException ioe) {
Log.w(TAG, "Failed to close FD.", ioe);

Powered by Google App Engine
This is Rietveld 408576698