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

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: content_unittests + sync Created 3 years, 11 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: 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..c1c3d114db6c117c2cd4f81128a8b48f1026e203
--- /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 a key that identifies it.
+ * 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 key;
+
+ /** A file descriptor to access the file. */
+ public final ParcelFileDescriptor fd;
+
+ public FileDescriptorInfo(int key, ParcelFileDescriptor fd) {
+ this.key = key;
+ this.fd = fd;
+ }
+
+ FileDescriptorInfo(Parcel in) {
+ key = in.readInt();
+ fd = in.readParcelable(null);
+ }
+
+ @Override
+ public int describeContents() {
+ return CONTENTS_FILE_DESCRIPTOR;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(key);
+ 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