OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.base; |
| 6 |
| 7 import android.os.Parcel; |
| 8 import android.os.Parcelable; |
| 9 |
| 10 import org.chromium.base.annotations.CalledByNative; |
| 11 import org.chromium.base.annotations.JNINamespace; |
| 12 |
| 13 /** |
| 14 * Contains the result of a native main method that ran in a child process. |
| 15 */ |
| 16 @JNINamespace("base::android") |
| 17 public final class MainReturnCodeResult implements Parcelable { |
| 18 private final int mMainReturnCode; |
| 19 private final boolean mTimedOut; |
| 20 |
| 21 public MainReturnCodeResult(int mainReturnCode, boolean timedOut) { |
| 22 mMainReturnCode = mainReturnCode; |
| 23 mTimedOut = timedOut; |
| 24 } |
| 25 |
| 26 MainReturnCodeResult(Parcel in) { |
| 27 mMainReturnCode = in.readInt(); |
| 28 mTimedOut = (in.readInt() != 0); |
| 29 } |
| 30 |
| 31 @CalledByNative |
| 32 public int getReturnCode() { |
| 33 return mMainReturnCode; |
| 34 } |
| 35 |
| 36 @CalledByNative |
| 37 public boolean hasTimedOut() { |
| 38 return mTimedOut; |
| 39 } |
| 40 |
| 41 @Override |
| 42 public int describeContents() { |
| 43 return 0; |
| 44 } |
| 45 |
| 46 @Override |
| 47 public void writeToParcel(Parcel dest, int flags) { |
| 48 dest.writeInt(mMainReturnCode); |
| 49 dest.writeInt(mTimedOut ? 1 : 0); |
| 50 } |
| 51 |
| 52 public static final Parcelable.Creator<MainReturnCodeResult> CREATOR = |
| 53 new Parcelable.Creator<MainReturnCodeResult>() { |
| 54 @Override |
| 55 public MainReturnCodeResult createFromParcel(Parcel in) { |
| 56 return new MainReturnCodeResult(in); |
| 57 } |
| 58 |
| 59 @Override |
| 60 public MainReturnCodeResult[] newArray(int size) { |
| 61 return new MainReturnCodeResult[size]; |
| 62 } |
| 63 }; |
| 64 } |
OLD | NEW |