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.HandleSignals; | 10 import org.chromium.mojo.system.Core.HandleSignalsState; |
11 import org.chromium.mojo.system.Core.WaitResult; | |
12 import org.chromium.mojo.system.Handle; | 11 import org.chromium.mojo.system.Handle; |
13 import org.chromium.mojo.system.UntypedHandle; | 12 import org.chromium.mojo.system.UntypedHandle; |
14 | 13 |
15 /** | 14 /** |
16 * Implementation of {@link Handle}. | 15 * Implementation of {@link Handle}. |
17 */ | 16 */ |
18 abstract class HandleBase implements Handle { | 17 abstract class HandleBase implements Handle { |
19 | 18 |
20 private static final String TAG = "HandleImpl"; | 19 private static final String TAG = "HandleImpl"; |
21 | 20 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 public void close() { | 55 public void close() { |
57 if (mMojoHandle != CoreImpl.INVALID_HANDLE) { | 56 if (mMojoHandle != CoreImpl.INVALID_HANDLE) { |
58 // After a close, the handle is invalid whether the close succeed or
not. | 57 // After a close, the handle is invalid whether the close succeed or
not. |
59 int handle = mMojoHandle; | 58 int handle = mMojoHandle; |
60 mMojoHandle = CoreImpl.INVALID_HANDLE; | 59 mMojoHandle = CoreImpl.INVALID_HANDLE; |
61 mCore.close(handle); | 60 mCore.close(handle); |
62 } | 61 } |
63 } | 62 } |
64 | 63 |
65 /** | 64 /** |
66 * @see org.chromium.mojo.system.Handle#wait(HandleSignals, long) | 65 * @see org.chromium.mojo.system.Handle#querySignalsState() |
67 */ | 66 */ |
68 @Override | 67 @Override |
69 public WaitResult wait(HandleSignals signals, long deadline) { | 68 public HandleSignalsState querySignalsState() { |
70 return mCore.wait(this, signals, deadline); | 69 return mCore.queryHandleSignalsState(mMojoHandle); |
71 } | 70 } |
72 | 71 |
73 /** | 72 /** |
74 * @see org.chromium.mojo.system.Handle#isValid() | 73 * @see org.chromium.mojo.system.Handle#isValid() |
75 */ | 74 */ |
76 @Override | 75 @Override |
77 public boolean isValid() { | 76 public boolean isValid() { |
78 return mMojoHandle != CoreImpl.INVALID_HANDLE; | 77 return mMojoHandle != CoreImpl.INVALID_HANDLE; |
79 } | 78 } |
80 | 79 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // This should not happen, as the user of this class should close th
e handle. Adding a | 131 // This should not happen, as the user of this class should close th
e handle. Adding a |
133 // warning. | 132 // warning. |
134 Log.w(TAG, "Handle was not closed."); | 133 Log.w(TAG, "Handle was not closed."); |
135 // Ignore result at this point. | 134 // Ignore result at this point. |
136 mCore.closeWithResult(mMojoHandle); | 135 mCore.closeWithResult(mMojoHandle); |
137 } | 136 } |
138 super.finalize(); | 137 super.finalize(); |
139 } | 138 } |
140 | 139 |
141 } | 140 } |
OLD | NEW |