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

Unified Diff: base/android/java/src/org/chromium/base/ParcelableChannelClient.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
Index: base/android/java/src/org/chromium/base/ParcelableChannelClient.java
diff --git a/base/android/java/src/org/chromium/base/ParcelableChannelClient.java b/base/android/java/src/org/chromium/base/ParcelableChannelClient.java
new file mode 100644
index 0000000000000000000000000000000000000000..4fe1e446c77af6f499278c98b88dbe0a7f1c4c1c
--- /dev/null
+++ b/base/android/java/src/org/chromium/base/ParcelableChannelClient.java
@@ -0,0 +1,36 @@
+// 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.Parcelable;
+import android.os.RemoteException;
+
+import org.chromium.base.annotations.CalledByNative;
+import org.chromium.base.annotations.JNINamespace;
+
+/**
+ * Wraps a IParcelableChannel so it can be called from native code.
+ */
+@JNINamespace("base::android")
+public final class ParcelableChannelClient {
+ private static final String TAG = "ParcelableChanClient";
+
+ private IParcelableChannel mIParcelableChannel;
+
+ public ParcelableChannelClient(IParcelableChannel parcelableChannel) {
+ mIParcelableChannel = parcelableChannel;
+ }
+
+ @CalledByNative
+ public boolean sendParcelable(int id, Parcelable parcelable) {
+ try {
+ mIParcelableChannel.sendParcelable(new ParcelableWrapper(id, parcelable));
+ return true;
+ } catch (RemoteException e) {
+ Log.e(TAG, "Failed to send parcelable.", e);
+ return false;
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698