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 #include "bin/dartutils.h" | 5 #include "bin/dartutils.h" |
6 #include "bin/eventhandler.h" | 6 #include "bin/eventhandler.h" |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 | 9 |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 | 38 |
39 /* | 39 /* |
40 * Starts the EventHandler thread and stores its reference in the dart | 40 * Starts the EventHandler thread and stores its reference in the dart |
41 * EventHandler object. args[0] holds the reference to the dart EventHandler | 41 * EventHandler object. args[0] holds the reference to the dart EventHandler |
42 * object. | 42 * object. |
43 */ | 43 */ |
44 void FUNCTION_NAME(EventHandler_Start)(Dart_NativeArguments args) { | 44 void FUNCTION_NAME(EventHandler_Start)(Dart_NativeArguments args) { |
45 Dart_EnterScope(); | 45 Dart_EnterScope(); |
46 Dart_Handle handle = Dart_GetNativeArgument(args, 0); | 46 Dart_Handle handle = Dart_GetNativeArgument(args, 0); |
47 EventHandler* event_handler = EventHandler::StartEventHandler(); | 47 EventHandler* event_handler = EventHandler::Start(); |
48 SetEventHandler(handle, event_handler); | 48 SetEventHandler(handle, event_handler); |
49 Dart_ExitScope(); | 49 Dart_ExitScope(); |
50 } | 50 } |
51 | 51 |
52 | 52 |
53 /* | 53 /* |
54 * Send data to the EventHandler thread to register for a given instance | 54 * Send data to the EventHandler thread to register for a given instance |
55 * args[1] a ReceivePort args[2] with a notification event args[3]. args[0] | 55 * args[1] a ReceivePort args[2] with a notification event args[3]. args[0] |
56 * holds the reference to the dart EventHandler object. | 56 * holds the reference to the dart EventHandler object. |
57 */ | 57 */ |
58 void FUNCTION_NAME(EventHandler_SendData)(Dart_NativeArguments args) { | 58 void FUNCTION_NAME(EventHandler_SendData)(Dart_NativeArguments args) { |
59 Dart_EnterScope(); | 59 Dart_EnterScope(); |
60 Dart_Handle handle = Dart_GetNativeArgument(args, 0); | 60 Dart_Handle handle = Dart_GetNativeArgument(args, 0); |
61 EventHandler* event_handler = GetEventHandler(handle); | 61 EventHandler* event_handler = GetEventHandler(handle); |
62 intptr_t id = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 1)); | 62 intptr_t id = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 1)); |
63 handle = Dart_GetNativeArgument(args, 2); | 63 handle = Dart_GetNativeArgument(args, 2); |
64 Dart_Port dart_port = | 64 Dart_Port dart_port = |
65 DartUtils::GetIntegerField(handle, DartUtils::kIdFieldName); | 65 DartUtils::GetIntegerField(handle, DartUtils::kIdFieldName); |
66 intptr_t data = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 3)); | 66 intptr_t data = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 3)); |
67 event_handler->SendData(id, dart_port, data); | 67 event_handler->SendData(id, dart_port, data); |
68 Dart_ExitScope(); | 68 Dart_ExitScope(); |
69 } | 69 } |
OLD | NEW |