Chromium Code Reviews| Index: remoting/android/javatests/src/org/chromium/chromoting/Pointer.java |
| diff --git a/remoting/android/javatests/src/org/chromium/chromoting/Pointer.java b/remoting/android/javatests/src/org/chromium/chromoting/Pointer.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..71091d38d428b05777bd889ff13a22c318099ceb |
| --- /dev/null |
| +++ b/remoting/android/javatests/src/org/chromium/chromoting/Pointer.java |
| @@ -0,0 +1,35 @@ |
| +// 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.chromoting; |
| + |
| +/** |
| + * A container of a reference to pass data into or out from a closure. This class is usually useful |
|
Lambros
2016/05/27 22:26:07
This should go in a 'util' subpackage. Maybe call
Hzj_jie
2016/05/28 00:32:07
Done.
|
| + * in test cases. |
| + * |
| + * @param <T> The type of reference. |
| + */ |
| +public class Pointer<T> { |
| + private T mRef; |
| + |
| + public Pointer() { |
| + clear(); |
| + } |
| + |
| + public Pointer(T ref) { |
| + set(ref); |
| + } |
| + |
| + public void clear() { |
| + set(null); |
| + } |
| + |
| + public void set(T ref) { |
| + mRef = ref; |
| + } |
| + |
| + public T get() { |
| + return mRef; |
| + } |
| +} |