| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/file_system_watcher.h" | 5 #include "bin/file_system_watcher.h" |
| 6 | 6 |
| 7 #include "bin/builtin.h" | 7 #include "bin/builtin.h" |
| 8 #include "bin/dartutils.h" | 8 #include "bin/dartutils.h" |
| 9 #include "bin/utils.h" | 9 #include "bin/utils.h" |
| 10 | 10 |
| 11 #include "include/dart_api.h" | 11 #include "include/dart_api.h" |
| 12 | 12 |
| 13 namespace dart { | 13 namespace dart { |
| 14 namespace bin { | 14 namespace bin { |
| 15 | 15 |
| 16 void FUNCTION_NAME(FileSystemWatcher_IsSupported)(Dart_NativeArguments args) { | 16 void FUNCTION_NAME(FileSystemWatcher_IsSupported)(Dart_NativeArguments args) { |
| 17 Dart_SetReturnValue(args, Dart_NewBoolean(FileSystemWatcher::IsSupported())); | 17 Dart_SetReturnValue(args, Dart_NewBoolean(FileSystemWatcher::IsSupported())); |
| 18 } | 18 } |
| 19 | 19 |
| 20 | 20 |
| 21 void FUNCTION_NAME(FileSystemWatcher_InitWatcher)(Dart_NativeArguments args) { | 21 void FUNCTION_NAME(FileSystemWatcher_InitWatcher)(Dart_NativeArguments args) { |
| 22 intptr_t id = FileSystemWatcher::Init(); | 22 intptr_t id = FileSystemWatcher::Init(); |
| 23 if (id >= 0) { | 23 if (id >= 0) { |
| 24 Dart_SetReturnValue(args, Dart_NewInteger(id)); | 24 Dart_SetReturnValue(args, Dart_NewInteger(id)); |
| 25 } else { | 25 } else { |
| 26 OSError os_error; | 26 OSError os_error; |
| 27 Dart_Handle error = DartUtils::NewDartOSError(&os_error); | 27 Dart_ThrowException(DartUtils::NewDartOSError(&os_error)); |
| 28 if (Dart_IsError(error)) Dart_PropagateError(error); | |
| 29 Dart_ThrowException(error); | |
| 30 } | 28 } |
| 31 } | 29 } |
| 32 | 30 |
| 33 | 31 |
| 34 void FUNCTION_NAME(FileSystemWatcher_CloseWatcher)(Dart_NativeArguments args) { | 32 void FUNCTION_NAME(FileSystemWatcher_CloseWatcher)(Dart_NativeArguments args) { |
| 35 intptr_t id = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 0)); | 33 intptr_t id = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 0)); |
| 36 FileSystemWatcher::Close(id); | 34 FileSystemWatcher::Close(id); |
| 37 } | 35 } |
| 38 | 36 |
| 39 | 37 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 68 | 66 |
| 69 void FUNCTION_NAME(FileSystemWatcher_GetSocketId)(Dart_NativeArguments args) { | 67 void FUNCTION_NAME(FileSystemWatcher_GetSocketId)(Dart_NativeArguments args) { |
| 70 intptr_t id = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 0)); | 68 intptr_t id = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 0)); |
| 71 intptr_t path_id = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1)); | 69 intptr_t path_id = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1)); |
| 72 int socket_id = FileSystemWatcher::GetSocketId(id, path_id); | 70 int socket_id = FileSystemWatcher::GetSocketId(id, path_id); |
| 73 Dart_SetReturnValue(args, Dart_NewInteger(socket_id)); | 71 Dart_SetReturnValue(args, Dart_NewInteger(socket_id)); |
| 74 } | 72 } |
| 75 | 73 |
| 76 } // namespace bin | 74 } // namespace bin |
| 77 } // namespace dart | 75 } // namespace dart |
| OLD | NEW |