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.bindings; | 5 package org.chromium.mojo.bindings; |
6 | 6 |
| 7 import org.chromium.mojo.system.AsyncWaiter; |
| 8 import org.chromium.mojo.system.Handle; |
| 9 |
7 /** | 10 /** |
8 * Helper functions. | 11 * Helper functions. |
9 */ | 12 */ |
10 public class BindingsHelper { | 13 public class BindingsHelper { |
11 /** | 14 /** |
12 * Alignment in bytes for mojo serialization. | 15 * Alignment in bytes for mojo serialization. |
13 */ | 16 */ |
14 public static final int ALIGNMENT = 8; | 17 public static final int ALIGNMENT = 8; |
15 | 18 |
16 /** | 19 /** |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 } | 69 } |
67 | 70 |
68 /** | 71 /** |
69 * Determines if the given {@code char} value is a Unicode <i>surrogate code
unit</i>. See | 72 * Determines if the given {@code char} value is a Unicode <i>surrogate code
unit</i>. See |
70 * {@link Character#isSurrogate}. Extracting here because the method only ex
ists at API level | 73 * {@link Character#isSurrogate}. Extracting here because the method only ex
ists at API level |
71 * 19. | 74 * 19. |
72 */ | 75 */ |
73 private static boolean isSurrogate(char c) { | 76 private static boolean isSurrogate(char c) { |
74 return c >= Character.MIN_SURROGATE && c < (Character.MAX_SURROGATE + 1)
; | 77 return c >= Character.MIN_SURROGATE && c < (Character.MAX_SURROGATE + 1)
; |
75 } | 78 } |
| 79 |
| 80 /** |
| 81 * Returns an {@link AsyncWaiter} to use with the given handle, or <code>nul
l</code> if none if |
| 82 * available. |
| 83 */ |
| 84 static AsyncWaiter getDefaultAsyncWaiterForHandle(Handle handle) { |
| 85 if (handle.getCore() != null) { |
| 86 return handle.getCore().getDefaultAsyncWaiter(); |
| 87 } else { |
| 88 return null; |
| 89 } |
| 90 } |
| 91 |
76 } | 92 } |
OLD | NEW |