OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.mojo.system.impl; | 5 package org.chromium.mojo.system.impl; |
6 | 6 |
7 import android.util.Log; | 7 import android.util.Log; |
8 | 8 |
9 import org.chromium.mojo.system.Core; | 9 import org.chromium.mojo.system.Core; |
10 import org.chromium.mojo.system.Core.HandleSignalsState; | 10 import org.chromium.mojo.system.Core.HandleSignals; |
| 11 import org.chromium.mojo.system.Core.WaitResult; |
11 import org.chromium.mojo.system.Handle; | 12 import org.chromium.mojo.system.Handle; |
12 import org.chromium.mojo.system.UntypedHandle; | 13 import org.chromium.mojo.system.UntypedHandle; |
13 | 14 |
14 /** | 15 /** |
15 * Implementation of {@link Handle}. | 16 * Implementation of {@link Handle}. |
16 */ | 17 */ |
17 abstract class HandleBase implements Handle { | 18 abstract class HandleBase implements Handle { |
18 | 19 |
19 private static final String TAG = "HandleImpl"; | 20 private static final String TAG = "HandleImpl"; |
20 | 21 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 public void close() { | 56 public void close() { |
56 if (mMojoHandle != CoreImpl.INVALID_HANDLE) { | 57 if (mMojoHandle != CoreImpl.INVALID_HANDLE) { |
57 // After a close, the handle is invalid whether the close succeed or
not. | 58 // After a close, the handle is invalid whether the close succeed or
not. |
58 int handle = mMojoHandle; | 59 int handle = mMojoHandle; |
59 mMojoHandle = CoreImpl.INVALID_HANDLE; | 60 mMojoHandle = CoreImpl.INVALID_HANDLE; |
60 mCore.close(handle); | 61 mCore.close(handle); |
61 } | 62 } |
62 } | 63 } |
63 | 64 |
64 /** | 65 /** |
65 * @see org.chromium.mojo.system.Handle#querySignalsState() | 66 * @see org.chromium.mojo.system.Handle#wait(HandleSignals, long) |
66 */ | 67 */ |
67 @Override | 68 @Override |
68 public HandleSignalsState querySignalsState() { | 69 public WaitResult wait(HandleSignals signals, long deadline) { |
69 return mCore.queryHandleSignalsState(mMojoHandle); | 70 return mCore.wait(this, signals, deadline); |
70 } | 71 } |
71 | 72 |
72 /** | 73 /** |
73 * @see org.chromium.mojo.system.Handle#isValid() | 74 * @see org.chromium.mojo.system.Handle#isValid() |
74 */ | 75 */ |
75 @Override | 76 @Override |
76 public boolean isValid() { | 77 public boolean isValid() { |
77 return mMojoHandle != CoreImpl.INVALID_HANDLE; | 78 return mMojoHandle != CoreImpl.INVALID_HANDLE; |
78 } | 79 } |
79 | 80 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // This should not happen, as the user of this class should close th
e handle. Adding a | 132 // This should not happen, as the user of this class should close th
e handle. Adding a |
132 // warning. | 133 // warning. |
133 Log.w(TAG, "Handle was not closed."); | 134 Log.w(TAG, "Handle was not closed."); |
134 // Ignore result at this point. | 135 // Ignore result at this point. |
135 mCore.closeWithResult(mMojoHandle); | 136 mCore.closeWithResult(mMojoHandle); |
136 } | 137 } |
137 super.finalize(); | 138 super.finalize(); |
138 } | 139 } |
139 | 140 |
140 } | 141 } |
OLD | NEW |