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

Unified Diff: mojo/android/system/src/org/chromium/mojo/system/HandleBase.java

Issue 291103004: Add conversion from Handle to UntypedHandle (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: HandleImpl -> HandleBase Created 6 years, 7 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: mojo/android/system/src/org/chromium/mojo/system/HandleBase.java
diff --git a/mojo/android/system/src/org/chromium/mojo/system/HandleImpl.java b/mojo/android/system/src/org/chromium/mojo/system/HandleBase.java
similarity index 80%
rename from mojo/android/system/src/org/chromium/mojo/system/HandleImpl.java
rename to mojo/android/system/src/org/chromium/mojo/system/HandleBase.java
index 5dff103cdb7dbd8308e61ea03b35f795606b0257..5d9fd470a07e3a5937a33c0758926ffca4d5e503 100644
--- a/mojo/android/system/src/org/chromium/mojo/system/HandleImpl.java
+++ b/mojo/android/system/src/org/chromium/mojo/system/HandleBase.java
@@ -11,7 +11,7 @@ import org.chromium.mojo.system.Core.WaitFlags;
/**
* Implementation of {@link Handle}.
*/
-class HandleImpl implements Handle {
+abstract class HandleBase implements Handle {
private static final String TAG = "HandleImpl";
@@ -21,24 +21,25 @@ class HandleImpl implements Handle {
private int mMojoHandle;
/**
- * the core implementation. Will be used to delegate all behavior.
+ * The core implementation. Will be used to delegate all behavior.
*/
protected CoreImpl mCore;
/**
* Base constructor. Takes ownership of the passed handle.
*/
- HandleImpl(CoreImpl core, int mojoHandle) {
+ HandleBase(CoreImpl core, int mojoHandle) {
mCore = core;
mMojoHandle = mojoHandle;
}
/**
- * Constructor for transforming an {@link UntypedHandle} into a specific one.
+ * Constructor for transforming {@link HandleBase} into a specific one. It is used to transform
+ * an {@link UntypedHandle} into a typed one, or any handle into an {@link UntypedHandle}.
*/
- HandleImpl(UntypedHandleImpl other) {
+ protected HandleBase(HandleBase other) {
mCore = other.mCore;
- HandleImpl otherAsHandleImpl = other;
+ HandleBase otherAsHandleImpl = other;
int mojoHandle = otherAsHandleImpl.mMojoHandle;
otherAsHandleImpl.mMojoHandle = CoreImpl.INVALID_HANDLE;
mMojoHandle = mojoHandle;
@@ -74,6 +75,14 @@ class HandleImpl implements Handle {
}
/**
+ * @see org.chromium.mojo.system.Handle#toUntypedHandle()
+ */
+ @Override
+ public UntypedHandle toUntypedHandle() {
+ return new UntypedHandleImpl(this);
+ }
+
+ /**
* Getter for the native scoped handle.
*
* @return the native scoped handle.

Powered by Google App Engine
This is Rietveld 408576698