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

Unified Diff: base/test/android/java/src/org/chromium/base/FileDescriptorInfo.java

Issue 2549363004: Multiprocess test client: Android child process launcher rework. (Closed)
Patch Set: Addressed comments + synced Created 4 years 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: base/test/android/java/src/org/chromium/base/FileDescriptorInfo.java
diff --git a/base/test/android/java/src/org/chromium/base/FileDescriptorInfo.java b/base/test/android/java/src/org/chromium/base/FileDescriptorInfo.java
new file mode 100644
index 0000000000000000000000000000000000000000..61174f000385050e9aea452446a30858950b04a1
--- /dev/null
+++ b/base/test/android/java/src/org/chromium/base/FileDescriptorInfo.java
@@ -0,0 +1,58 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.base;
+
+import android.annotation.SuppressLint;
+import android.os.Parcel;
+import android.os.ParcelFileDescriptor;
+import android.os.Parcelable;
+
+/**
+ * Parcelable class that contains file descriptor and an ID.
+ * TODO(jcivelli): should be merged with
+ * org.chromium.content.common.FileDescriptorInfo
+ */
+@SuppressLint("ParcelClassLoader")
+public final class FileDescriptorInfo implements Parcelable {
+ /** An consumer chosen ID that uniquely identifies a file descriptor. */
+ public final int id;
Robert Sesek 2016/12/20 20:44:34 Since the base C++ calls this "key" -- why not do
Jay Civelli 2016/12/20 23:07:26 Good idea, done.
+
+ /** A file descriptor to access the file. */
+ public final ParcelFileDescriptor fd;
+
+ public FileDescriptorInfo(int id, ParcelFileDescriptor fd) {
+ this.id = id;
+ this.fd = fd;
+ }
+
+ FileDescriptorInfo(Parcel in) {
+ id = in.readInt();
+ fd = in.readParcelable(null);
+ }
+
+ @Override
+ public int describeContents() {
+ return CONTENTS_FILE_DESCRIPTOR;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(id);
+ dest.writeParcelable(fd, CONTENTS_FILE_DESCRIPTOR);
+ }
+
+ public static final Parcelable.Creator<FileDescriptorInfo> CREATOR =
+ new Parcelable.Creator<FileDescriptorInfo>() {
+ @Override
+ public FileDescriptorInfo createFromParcel(Parcel in) {
+ return new FileDescriptorInfo(in);
+ }
+
+ @Override
+ public FileDescriptorInfo[] newArray(int size) {
+ return new FileDescriptorInfo[size];
+ }
+ };
+}

Powered by Google App Engine
This is Rietveld 408576698