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 part of core; | 5 part of core; |
6 | 6 |
7 class _MojoHandleWatcherNatives { | 7 class _MojoHandleWatcherNatives { |
8 static int sendControlData(int controlHandle, int mojoHandle, SendPort port, | 8 external static int sendControlData(int controlHandle, int mojoHandle, |
9 int data) native "MojoHandleWatcher_SendControlData"; | 9 SendPort port, int data); |
10 static List recvControlData(int controlHandle) native | 10 external static List recvControlData(int controlHandle); |
11 "MojoHandleWatcher_RecvControlData"; | 11 external static int setControlHandle(int controlHandle); |
12 static int setControlHandle(int controlHandle) native | 12 external static int getControlHandle(); |
13 "MojoHandleWatcher_SetControlHandle"; | |
14 static int getControlHandle() native "MojoHandleWatcher_GetControlHandle"; | |
15 } | 13 } |
16 | 14 |
17 // The MojoHandleWatcher sends a stream of events to application isolates that | 15 // The MojoHandleWatcher sends a stream of events to application isolates that |
18 // register Mojo handles with it. Application isolates make the following calls: | 16 // register Mojo handles with it. Application isolates make the following calls: |
19 // | 17 // |
20 // add(handle, port, signals) - Instructs the MojoHandleWatcher isolate to add | 18 // add(handle, port, signals) - Instructs the MojoHandleWatcher isolate to add |
21 // 'handle' to the set of handles it watches, and to notify the calling | 19 // 'handle' to the set of handles it watches, and to notify the calling |
22 // isolate only for the events specified by 'signals' using the send port | 20 // isolate only for the events specified by 'signals' using the send port |
23 // 'port' | 21 // 'port' |
24 // | 22 // |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 } | 334 } |
337 | 335 |
338 static MojoResult timer(Object ignored, SendPort port, int deadline) { | 336 static MojoResult timer(Object ignored, SendPort port, int deadline) { |
339 // The deadline will be unwrapped before sending to the handle watcher. | 337 // The deadline will be unwrapped before sending to the handle watcher. |
340 return _sendControlData( | 338 return _sendControlData( |
341 new MojoHandle(deadline), | 339 new MojoHandle(deadline), |
342 port, | 340 port, |
343 _encodeCommand(TIMER)); | 341 _encodeCommand(TIMER)); |
344 } | 342 } |
345 } | 343 } |
OLD | NEW |