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 // This is done mainly to make the subsequent definition of | |
8 // class EventHandler more readable. | |
Ivan Posva
2011/11/16 19:19:53
Not sure if I agree with the statement that this e
siva
2011/11/17 00:04:28
I will just get rid of this empty class.
On 2011/
| |
9 class EventHandlerNativeWrapper extends NativeFieldWrapperClass1 { | |
10 } | |
11 | |
5 class EventHandler extends EventHandlerNativeWrapper { | 12 class EventHandler extends EventHandlerNativeWrapper { |
6 EventHandler() { } | 13 EventHandler() { } |
7 | 14 |
8 static void _start() { | 15 static void _start() { |
9 if (_eventHandler === null) { | 16 if (_eventHandler === null) { |
10 _eventHandler = new EventHandler(); | 17 _eventHandler = new EventHandler(); |
11 _eventHandler._doStart(); | 18 _eventHandler._doStart(); |
12 } | 19 } |
13 } | 20 } |
14 | 21 |
15 void _doStart() native "EventHandler_Start"; | 22 void _doStart() native "EventHandler_Start"; |
16 | 23 |
17 static _sendData(int id, ReceivePort receivePort, int data) { | 24 static _sendData(int id, ReceivePort receivePort, int data) { |
18 if (_eventHandler !== null) { | 25 if (_eventHandler !== null) { |
19 _eventHandler._doSendData(id, receivePort, data); | 26 _eventHandler._doSendData(id, receivePort, data); |
20 } | 27 } |
21 } | 28 } |
22 | 29 |
23 | 30 |
24 void _doSendData(int id, ReceivePort receivePort, int data) | 31 void _doSendData(int id, ReceivePort receivePort, int data) |
25 native "EventHandler_SendData"; | 32 native "EventHandler_SendData"; |
26 | 33 |
27 static EventHandler _eventHandler; | 34 static EventHandler _eventHandler; |
28 } | 35 } |
OLD | NEW |