Files
sdk/runtime/bin/eventhandler.dart
T
asiva@google.com 9f49e2bf74 Implement automatic loading of dart:core_native_fields library
with predefined classes having native fields.
Classes that need native fields in them can import this library and
extend these predefined classes.
Review URL: http://codereview.chromium.org//8537023

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1629 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-17 21:04:43 +00:00

29 lines
791 B
Dart

// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
class EventHandler extends NativeFieldWrapperClass1 {
EventHandler() { }
static void _start() {
if (_eventHandler === null) {
_eventHandler = new EventHandler();
_eventHandler._doStart();
}
}
void _doStart() native "EventHandler_Start";
static _sendData(int id, ReceivePort receivePort, int data) {
if (_eventHandler !== null) {
_eventHandler._doSendData(id, receivePort, data);
}
}
void _doSendData(int id, ReceivePort receivePort, int data)
native "EventHandler_SendData";
static EventHandler _eventHandler;
}