OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 patch class _EventHandler { | 5 patch class _EventHandler { |
6 /* patch */ static void _start() { | 6 /* patch */ static void _start() { |
7 if (_eventHandler === null) { | 7 if (_eventHandler == null) { |
8 _eventHandler = new _EventHandlerImpl(); | 8 _eventHandler = new _EventHandlerImpl(); |
9 _eventHandler._start(); | 9 _eventHandler._start(); |
10 } | 10 } |
11 } | 11 } |
12 | 12 |
13 /* patch */ static _sendData(Object sender, | 13 /* patch */ static _sendData(Object sender, |
14 ReceivePort receivePort, | 14 ReceivePort receivePort, |
15 int data) { | 15 int data) { |
16 if (_eventHandler !== null) { | 16 if (_eventHandler != null) { |
17 _eventHandler._sendData(sender, receivePort, data); | 17 _eventHandler._sendData(sender, receivePort, data); |
18 } | 18 } |
19 } | 19 } |
20 | 20 |
21 static _EventHandlerImpl _eventHandler; | 21 static _EventHandlerImpl _eventHandler; |
22 } | 22 } |
23 | 23 |
24 | 24 |
25 class _EventHandlerImpl extends NativeFieldWrapperClass1 { | 25 class _EventHandlerImpl extends NativeFieldWrapperClass1 { |
26 _EventHandlerImpl() { } | 26 _EventHandlerImpl() { } |
27 void _start() native "EventHandler_Start"; | 27 void _start() native "EventHandler_Start"; |
28 void _sendData(Object sender, ReceivePort receivePort, int data) | 28 void _sendData(Object sender, ReceivePort receivePort, int data) |
29 native "EventHandler_SendData"; | 29 native "EventHandler_SendData"; |
30 } | 30 } |
OLD | NEW |