| 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 #if !defined(DART_IO_DISABLED) | 5 #if !defined(DART_IO_DISABLED) |
| 6 | 6 |
| 7 #include "bin/file.h" | 7 #include "bin/file.h" |
| 8 | 8 |
| 9 #include "bin/builtin.h" | 9 #include "bin/builtin.h" |
| 10 #include "bin/dartutils.h" | 10 #include "bin/dartutils.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 const char* filename = | 106 const char* filename = |
| 107 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); | 107 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); |
| 108 bool exists = File::Exists(filename); | 108 bool exists = File::Exists(filename); |
| 109 Dart_SetReturnValue(args, Dart_NewBoolean(exists)); | 109 Dart_SetReturnValue(args, Dart_NewBoolean(exists)); |
| 110 } | 110 } |
| 111 | 111 |
| 112 | 112 |
| 113 void FUNCTION_NAME(File_Close)(Dart_NativeArguments args) { | 113 void FUNCTION_NAME(File_Close)(Dart_NativeArguments args) { |
| 114 File* file = GetFile(args); | 114 File* file = GetFile(args); |
| 115 ASSERT(file != NULL); | 115 ASSERT(file != NULL); |
| 116 file->Close(); |
| 116 file->DeleteWeakHandle(Dart_CurrentIsolate()); | 117 file->DeleteWeakHandle(Dart_CurrentIsolate()); |
| 117 file->Release(); | 118 file->Release(); |
| 118 | 119 |
| 119 // NULL-out the now potentially dangling pointer. | 120 // NULL-out the now potentially dangling pointer. |
| 120 Dart_Handle dart_this = Dart_GetNativeArgument(args, 0); | 121 Dart_Handle dart_this = Dart_GetNativeArgument(args, 0); |
| 121 SetFile(dart_this, 0); | 122 SetFile(dart_this, 0); |
| 122 Dart_SetReturnValue(args, Dart_NewInteger(0)); | 123 Dart_SetReturnValue(args, Dart_NewInteger(0)); |
| 123 } | 124 } |
| 124 | 125 |
| 125 | 126 |
| (...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1229 return CObject::IllegalArgumentError(); | 1230 return CObject::IllegalArgumentError(); |
| 1230 } | 1231 } |
| 1231 } | 1232 } |
| 1232 return CObject::IllegalArgumentError(); | 1233 return CObject::IllegalArgumentError(); |
| 1233 } | 1234 } |
| 1234 | 1235 |
| 1235 } // namespace bin | 1236 } // namespace bin |
| 1236 } // namespace dart | 1237 } // namespace dart |
| 1237 | 1238 |
| 1238 #endif // !defined(DART_IO_DISABLED) | 1239 #endif // !defined(DART_IO_DISABLED) |
| OLD | NEW |