OLD | NEW |
---|---|
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // Create an empty class to represent the native fields used in | |
6 // the EventHandler class (it needs one native field). | |
7 class EventHandlerNativeWrapper extends NativeFieldWrapperClass1 { | |
Anton Muhin
2011/11/13 16:19:32
do you need this helper class, maybe simply class
siva
2011/11/15 02:16:52
I added it specifically to address the concern you
Anton Muhin
2011/11/15 12:22:23
Up to you, it's a minor thing. My concern was for
siva
2011/11/15 19:42:49
I will leave it as such with a comment stating tha
| |
8 } | |
9 | |
5 class EventHandler extends EventHandlerNativeWrapper { | 10 class EventHandler extends EventHandlerNativeWrapper { |
6 EventHandler() { } | 11 EventHandler() { } |
7 | 12 |
8 static void _start() { | 13 static void _start() { |
9 if (_eventHandler === null) { | 14 if (_eventHandler === null) { |
10 _eventHandler = new EventHandler(); | 15 _eventHandler = new EventHandler(); |
11 _eventHandler._doStart(); | 16 _eventHandler._doStart(); |
12 } | 17 } |
13 } | 18 } |
14 | 19 |
15 void _doStart() native "EventHandler_Start"; | 20 void _doStart() native "EventHandler_Start"; |
16 | 21 |
17 static _sendData(int id, ReceivePort receivePort, int data) { | 22 static _sendData(int id, ReceivePort receivePort, int data) { |
18 if (_eventHandler !== null) { | 23 if (_eventHandler !== null) { |
19 _eventHandler._doSendData(id, receivePort, data); | 24 _eventHandler._doSendData(id, receivePort, data); |
20 } | 25 } |
21 } | 26 } |
22 | 27 |
23 | 28 |
24 void _doSendData(int id, ReceivePort receivePort, int data) | 29 void _doSendData(int id, ReceivePort receivePort, int data) |
25 native "EventHandler_SendData"; | 30 native "EventHandler_SendData"; |
26 | 31 |
27 static EventHandler _eventHandler; | 32 static EventHandler _eventHandler; |
28 } | 33 } |
OLD | NEW |