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

Unified Diff: base/android/java/src/org/chromium/base/ParcelableWrapper.java

Issue 2735113003: Changing SpawnChild to return a struct.
Patch Set: Created 3 years, 9 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
« no previous file with comments | « base/android/java/src/org/chromium/base/ParcelableWrapper.aidl ('k') | base/android/jni_array.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/java/src/org/chromium/base/ParcelableWrapper.java
diff --git a/base/android/java/src/org/chromium/base/ParcelableWrapper.java b/base/android/java/src/org/chromium/base/ParcelableWrapper.java
new file mode 100644
index 0000000000000000000000000000000000000000..ce92a8d60326c724cedc867340b9c88400c1a40d
--- /dev/null
+++ b/base/android/java/src/org/chromium/base/ParcelableWrapper.java
@@ -0,0 +1,59 @@
+// Copyright 2017 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.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * A Parcelable and its associated ID.
+ * Used on the ParcelableChannel to send Parcelable's over a Mojo channel.
+ */
+public class ParcelableWrapper implements Parcelable {
+ private int mId;
+ private Parcelable mParcelable;
+
+ public ParcelableWrapper(int id, Parcelable parcelable) {
+ mId = id;
+ mParcelable = parcelable;
+ }
+
+ ParcelableWrapper(Parcel in) {
+ mId = in.readInt();
+ mParcelable = in.readParcelable(getClass().getClassLoader());
+ }
+
+ public int getId() {
+ return mId;
+ }
+
+ public Parcelable getParcelable() {
+ return mParcelable;
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(mId);
+ dest.writeParcelable(mParcelable, 0);
+ }
+
+ public static final Parcelable.Creator<ParcelableWrapper> CREATOR =
+ new Parcelable.Creator<ParcelableWrapper>() {
+ @Override
+ public ParcelableWrapper createFromParcel(Parcel in) {
+ return new ParcelableWrapper(in);
+ }
+
+ @Override
+ public ParcelableWrapper[] newArray(int size) {
+ return new ParcelableWrapper[size];
+ }
+ };
+}
« no previous file with comments | « base/android/java/src/org/chromium/base/ParcelableWrapper.aidl ('k') | base/android/jni_array.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698