Chromium Code Reviews| 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 | 10 |
| 10 #include "include/dart_api.h" | 11 #include "include/dart_api.h" |
| 11 | 12 |
| 12 namespace dart { | 13 namespace dart { |
| 13 namespace bin { | 14 namespace bin { |
| 14 | 15 |
| 15 void FUNCTION_NAME(FileSystemWatcher_IsSupported)(Dart_NativeArguments args) { | 16 void FUNCTION_NAME(FileSystemWatcher_IsSupported)(Dart_NativeArguments args) { |
| 16 Dart_SetReturnValue(args, Dart_NewBoolean(FileSystemWatcher::IsSupported())); | 17 Dart_SetReturnValue(args, Dart_NewBoolean(FileSystemWatcher::IsSupported())); |
| 17 } | 18 } |
| 18 | 19 |
| 19 | 20 |
| 20 void FUNCTION_NAME(FileSystemWatcher_InitWatcher)(Dart_NativeArguments args) { | 21 void FUNCTION_NAME(FileSystemWatcher_InitWatcher)(Dart_NativeArguments args) { |
| 21 Dart_SetReturnValue(args, Dart_NewInteger(FileSystemWatcher::Init())); | 22 intptr_t id = FileSystemWatcher::Init(); |
| 23 if (id >= 0) { | |
| 24 Dart_SetReturnValue(args, Dart_NewInteger(id)); | |
| 25 } else { | |
| 26 OSError os_error; | |
| 27 Dart_Handle error = DartUtils::NewDartOSError(&os_error); | |
|
kustermann
2015/02/18 13:10:10
Would it be possible to give some error message?
| |
| 28 if (Dart_IsError(error)) Dart_PropagateError(error); | |
| 29 Dart_ThrowException(error); | |
| 30 } | |
| 22 } | 31 } |
| 23 | 32 |
| 24 | 33 |
| 25 void FUNCTION_NAME(FileSystemWatcher_CloseWatcher)(Dart_NativeArguments args) { | 34 void FUNCTION_NAME(FileSystemWatcher_CloseWatcher)(Dart_NativeArguments args) { |
| 26 intptr_t id = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 0)); | 35 intptr_t id = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 0)); |
| 27 FileSystemWatcher::Close(id); | 36 FileSystemWatcher::Close(id); |
| 28 } | 37 } |
| 29 | 38 |
| 30 | 39 |
| 31 void FUNCTION_NAME(FileSystemWatcher_WatchPath)(Dart_NativeArguments args) { | 40 void FUNCTION_NAME(FileSystemWatcher_WatchPath)(Dart_NativeArguments args) { |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 59 | 68 |
| 60 void FUNCTION_NAME(FileSystemWatcher_GetSocketId)(Dart_NativeArguments args) { | 69 void FUNCTION_NAME(FileSystemWatcher_GetSocketId)(Dart_NativeArguments args) { |
| 61 intptr_t id = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 0)); | 70 intptr_t id = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 0)); |
| 62 intptr_t path_id = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1)); | 71 intptr_t path_id = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1)); |
| 63 int socket_id = FileSystemWatcher::GetSocketId(id, path_id); | 72 int socket_id = FileSystemWatcher::GetSocketId(id, path_id); |
| 64 Dart_SetReturnValue(args, Dart_NewInteger(socket_id)); | 73 Dart_SetReturnValue(args, Dart_NewInteger(socket_id)); |
| 65 } | 74 } |
| 66 | 75 |
| 67 } // namespace bin | 76 } // namespace bin |
| 68 } // namespace dart | 77 } // namespace dart |
| OLD | NEW |