| 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/file.h" | 5 #include "bin/file.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/io_buffer.h" | 9 #include "bin/io_buffer.h" |
| 10 #include "bin/thread.h" | 10 #include "bin/thread.h" |
| 11 #include "bin/utils.h" | 11 #include "bin/utils.h" |
| 12 | 12 |
| 13 #include "include/dart_api.h" | 13 #include "include/dart_api.h" |
| 14 | 14 |
| 15 static const int kMSPerSecond = 1000; | 15 static const int kMSPerSecond = 1000; |
| 16 | 16 |
| 17 dart::Mutex File::mutex_; | 17 dart::Mutex File::mutex_; |
| 18 int File::service_ports_size_ = 0; | 18 int File::service_ports_size_ = 0; |
| 19 Dart_Port* File::service_ports_ = NULL; | 19 Dart_Port* File::service_ports_ = NULL; |
| 20 int File::service_ports_index_ = 0; | 20 int File::service_ports_index_ = 0; |
| 21 | 21 |
| 22 |
| 23 // The file pointer has been passed into Dart as an intptr_t and it is safe |
| 24 // to pull it out of Dart as a 64-bit integer, cast it to an intptr_t and |
| 25 // from there to a File pointer. |
| 26 static File* GetFilePointer(Dart_Handle handle) { |
| 27 intptr_t value = DartUtils::GetIntptrValue(handle); |
| 28 return reinterpret_cast<File*>(value); |
| 29 } |
| 30 |
| 31 |
| 22 bool File::ReadFully(void* buffer, int64_t num_bytes) { | 32 bool File::ReadFully(void* buffer, int64_t num_bytes) { |
| 23 int64_t remaining = num_bytes; | 33 int64_t remaining = num_bytes; |
| 24 char* current_buffer = reinterpret_cast<char*>(buffer); | 34 char* current_buffer = reinterpret_cast<char*>(buffer); |
| 25 while (remaining > 0) { | 35 while (remaining > 0) { |
| 26 int bytes_read = Read(current_buffer, remaining); | 36 int bytes_read = Read(current_buffer, remaining); |
| 27 if (bytes_read <= 0) { | 37 if (bytes_read <= 0) { |
| 28 return false; | 38 return false; |
| 29 } | 39 } |
| 30 remaining -= bytes_read; // Reduce the number of remaining bytes. | 40 remaining -= bytes_read; // Reduce the number of remaining bytes. |
| 31 current_buffer += bytes_read; // Move the buffer forward. | 41 current_buffer += bytes_read; // Move the buffer forward. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 60 return File::kWrite; | 70 return File::kWrite; |
| 61 } | 71 } |
| 62 return File::kRead; | 72 return File::kRead; |
| 63 } | 73 } |
| 64 | 74 |
| 65 | 75 |
| 66 void FUNCTION_NAME(File_Open)(Dart_NativeArguments args) { | 76 void FUNCTION_NAME(File_Open)(Dart_NativeArguments args) { |
| 67 Dart_EnterScope(); | 77 Dart_EnterScope(); |
| 68 const char* filename = | 78 const char* filename = |
| 69 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); | 79 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); |
| 70 int mode = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 1)); | 80 int64_t mode = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 1)); |
| 71 File::DartFileOpenMode dart_file_mode = | 81 File::DartFileOpenMode dart_file_mode = |
| 72 static_cast<File::DartFileOpenMode>(mode); | 82 static_cast<File::DartFileOpenMode>(mode); |
| 73 File::FileOpenMode file_mode = File::DartModeToFileMode(dart_file_mode); | 83 File::FileOpenMode file_mode = File::DartModeToFileMode(dart_file_mode); |
| 74 // Check that the file exists before opening it only for | 84 // Check that the file exists before opening it only for |
| 75 // reading. This is to prevent the opening of directories as | 85 // reading. This is to prevent the opening of directories as |
| 76 // files. Directories can be opened for reading using the posix | 86 // files. Directories can be opened for reading using the posix |
| 77 // 'open' call. | 87 // 'open' call. |
| 78 File* file = NULL; | 88 File* file = NULL; |
| 79 file = File::Open(filename, file_mode); | 89 file = File::Open(filename, file_mode); |
| 80 if (file != NULL) { | 90 if (file != NULL) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 94 const char* filename = | 104 const char* filename = |
| 95 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); | 105 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); |
| 96 bool exists = File::Exists(filename); | 106 bool exists = File::Exists(filename); |
| 97 Dart_SetReturnValue(args, Dart_NewBoolean(exists)); | 107 Dart_SetReturnValue(args, Dart_NewBoolean(exists)); |
| 98 Dart_ExitScope(); | 108 Dart_ExitScope(); |
| 99 } | 109 } |
| 100 | 110 |
| 101 | 111 |
| 102 void FUNCTION_NAME(File_Close)(Dart_NativeArguments args) { | 112 void FUNCTION_NAME(File_Close)(Dart_NativeArguments args) { |
| 103 Dart_EnterScope(); | 113 Dart_EnterScope(); |
| 104 intptr_t value = | 114 File* file = GetFilePointer(Dart_GetNativeArgument(args, 0)); |
| 105 DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); | |
| 106 File* file = reinterpret_cast<File*>(value); | |
| 107 ASSERT(file != NULL); | 115 ASSERT(file != NULL); |
| 108 delete file; | 116 delete file; |
| 109 Dart_SetReturnValue(args, Dart_NewInteger(0)); | 117 Dart_SetReturnValue(args, Dart_NewInteger(0)); |
| 110 Dart_ExitScope(); | 118 Dart_ExitScope(); |
| 111 } | 119 } |
| 112 | 120 |
| 113 | 121 |
| 114 void FUNCTION_NAME(File_ReadByte)(Dart_NativeArguments args) { | 122 void FUNCTION_NAME(File_ReadByte)(Dart_NativeArguments args) { |
| 115 Dart_EnterScope(); | 123 Dart_EnterScope(); |
| 116 intptr_t value = | 124 File* file = GetFilePointer(Dart_GetNativeArgument(args, 0)); |
| 117 DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); | |
| 118 File* file = reinterpret_cast<File*>(value); | |
| 119 ASSERT(file != NULL); | 125 ASSERT(file != NULL); |
| 120 uint8_t buffer; | 126 uint8_t buffer; |
| 121 int bytes_read = file->Read(reinterpret_cast<void*>(&buffer), 1); | 127 int64_t bytes_read = file->Read(reinterpret_cast<void*>(&buffer), 1); |
| 122 if (bytes_read == 1) { | 128 if (bytes_read == 1) { |
| 123 Dart_SetReturnValue(args, Dart_NewInteger(buffer)); | 129 Dart_SetReturnValue(args, Dart_NewInteger(buffer)); |
| 124 } else if (bytes_read == 0) { | 130 } else if (bytes_read == 0) { |
| 125 Dart_SetReturnValue(args, Dart_NewInteger(-1)); | 131 Dart_SetReturnValue(args, Dart_NewInteger(-1)); |
| 126 } else { | 132 } else { |
| 127 Dart_Handle err = DartUtils::NewDartOSError(); | 133 Dart_Handle err = DartUtils::NewDartOSError(); |
| 128 if (Dart_IsError(err)) Dart_PropagateError(err); | 134 if (Dart_IsError(err)) Dart_PropagateError(err); |
| 129 Dart_SetReturnValue(args, err); | 135 Dart_SetReturnValue(args, err); |
| 130 } | 136 } |
| 131 Dart_ExitScope(); | 137 Dart_ExitScope(); |
| 132 } | 138 } |
| 133 | 139 |
| 134 | 140 |
| 135 void FUNCTION_NAME(File_WriteByte)(Dart_NativeArguments args) { | 141 void FUNCTION_NAME(File_WriteByte)(Dart_NativeArguments args) { |
| 136 Dart_EnterScope(); | 142 Dart_EnterScope(); |
| 137 intptr_t file_ptr = | 143 File* file = GetFilePointer(Dart_GetNativeArgument(args, 0)); |
| 138 DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); | |
| 139 File* file = reinterpret_cast<File*>(file_ptr); | |
| 140 ASSERT(file != NULL); | 144 ASSERT(file != NULL); |
| 141 int64_t value = 0; | 145 int64_t byte = 0; |
| 142 if (DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 1), &value)) { | 146 if (DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 1), &byte)) { |
| 143 uint8_t buffer = static_cast<uint8_t>(value & 0xff); | 147 uint8_t buffer = static_cast<uint8_t>(byte & 0xff); |
| 144 int bytes_written = file->Write(reinterpret_cast<void*>(&buffer), 1); | 148 int64_t bytes_written = file->Write(reinterpret_cast<void*>(&buffer), 1); |
| 145 if (bytes_written >= 0) { | 149 if (bytes_written >= 0) { |
| 146 Dart_SetReturnValue(args, Dart_NewInteger(bytes_written)); | 150 Dart_SetReturnValue(args, Dart_NewInteger(bytes_written)); |
| 147 } else { | 151 } else { |
| 148 Dart_Handle err = DartUtils::NewDartOSError(); | 152 Dart_Handle err = DartUtils::NewDartOSError(); |
| 149 if (Dart_IsError(err)) Dart_PropagateError(err); | 153 if (Dart_IsError(err)) Dart_PropagateError(err); |
| 150 Dart_SetReturnValue(args, err); | 154 Dart_SetReturnValue(args, err); |
| 151 } | 155 } |
| 152 } else { | 156 } else { |
| 153 OSError os_error(-1, "Invalid argument", OSError::kUnknown); | 157 OSError os_error(-1, "Invalid argument", OSError::kUnknown); |
| 154 Dart_Handle err = DartUtils::NewDartOSError(&os_error); | 158 Dart_Handle err = DartUtils::NewDartOSError(&os_error); |
| 155 if (Dart_IsError(err)) Dart_PropagateError(err); | 159 if (Dart_IsError(err)) Dart_PropagateError(err); |
| 156 Dart_SetReturnValue(args, err); | 160 Dart_SetReturnValue(args, err); |
| 157 } | 161 } |
| 158 Dart_ExitScope(); | 162 Dart_ExitScope(); |
| 159 } | 163 } |
| 160 | 164 |
| 161 | 165 |
| 162 void FUNCTION_NAME(File_Read)(Dart_NativeArguments args) { | 166 void FUNCTION_NAME(File_Read)(Dart_NativeArguments args) { |
| 163 Dart_EnterScope(); | 167 Dart_EnterScope(); |
| 164 intptr_t value = | 168 File* file = GetFilePointer(Dart_GetNativeArgument(args, 0)); |
| 165 DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); | |
| 166 File* file = reinterpret_cast<File*>(value); | |
| 167 ASSERT(file != NULL); | 169 ASSERT(file != NULL); |
| 168 Dart_Handle length_object = Dart_GetNativeArgument(args, 1); | 170 Dart_Handle length_object = Dart_GetNativeArgument(args, 1); |
| 169 int64_t length = 0; | 171 int64_t length = 0; |
| 170 if (DartUtils::GetInt64Value(length_object, &length)) { | 172 if (DartUtils::GetInt64Value(length_object, &length)) { |
| 171 uint8_t* buffer = NULL; | 173 uint8_t* buffer = NULL; |
| 172 Dart_Handle external_array = IOBuffer::Allocate(length, &buffer); | 174 Dart_Handle external_array = IOBuffer::Allocate(length, &buffer); |
| 173 int bytes_read = file->Read(reinterpret_cast<void*>(buffer), length); | 175 int64_t bytes_read = file->Read(reinterpret_cast<void*>(buffer), length); |
| 174 if (bytes_read < 0) { | 176 if (bytes_read < 0) { |
| 175 Dart_Handle err = DartUtils::NewDartOSError(); | 177 Dart_Handle err = DartUtils::NewDartOSError(); |
| 176 if (Dart_IsError(err)) Dart_PropagateError(err); | 178 if (Dart_IsError(err)) Dart_PropagateError(err); |
| 177 Dart_SetReturnValue(args, err); | 179 Dart_SetReturnValue(args, err); |
| 178 } else { | 180 } else { |
| 179 if (bytes_read < length) { | 181 if (bytes_read < length) { |
| 180 // TODO(ager): cache the 'length' string if this becomes a bottle neck. | 182 // TODO(ager): cache the 'length' string if this becomes a bottle neck. |
| 181 Dart_SetField(external_array, | 183 Dart_SetField(external_array, |
| 182 DartUtils::NewString("length"), | 184 DartUtils::NewString("length"), |
| 183 Dart_NewInteger(bytes_read)); | 185 Dart_NewInteger(bytes_read)); |
| 184 } | 186 } |
| 185 Dart_SetReturnValue(args, external_array); | 187 Dart_SetReturnValue(args, external_array); |
| 186 } | 188 } |
| 187 } else { | 189 } else { |
| 188 OSError os_error(-1, "Invalid argument", OSError::kUnknown); | 190 OSError os_error(-1, "Invalid argument", OSError::kUnknown); |
| 189 Dart_Handle err = DartUtils::NewDartOSError(&os_error); | 191 Dart_Handle err = DartUtils::NewDartOSError(&os_error); |
| 190 if (Dart_IsError(err)) Dart_PropagateError(err); | 192 if (Dart_IsError(err)) Dart_PropagateError(err); |
| 191 Dart_SetReturnValue(args, err); | 193 Dart_SetReturnValue(args, err); |
| 192 } | 194 } |
| 193 Dart_ExitScope(); | 195 Dart_ExitScope(); |
| 194 } | 196 } |
| 195 | 197 |
| 196 | 198 |
| 197 void FUNCTION_NAME(File_ReadList)(Dart_NativeArguments args) { | 199 void FUNCTION_NAME(File_ReadList)(Dart_NativeArguments args) { |
| 198 Dart_EnterScope(); | 200 Dart_EnterScope(); |
| 199 intptr_t value = | 201 File* file = GetFilePointer(Dart_GetNativeArgument(args, 0)); |
| 200 DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); | |
| 201 File* file = reinterpret_cast<File*>(value); | |
| 202 ASSERT(file != NULL); | 202 ASSERT(file != NULL); |
| 203 Dart_Handle buffer_obj = Dart_GetNativeArgument(args, 1); | 203 Dart_Handle buffer_obj = Dart_GetNativeArgument(args, 1); |
| 204 ASSERT(Dart_IsList(buffer_obj)); | 204 ASSERT(Dart_IsList(buffer_obj)); |
| 205 // Offset and length arguments are checked in Dart code to be | 205 // Offset and length arguments are checked in Dart code to be |
| 206 // integers and have the property that (offset + length) <= | 206 // integers and have the property that (offset + length) <= |
| 207 // list.length. Therefore, it is safe to extract their value as | 207 // list.length. Therefore, it is safe to extract their value as |
| 208 // 64-bit integers. | 208 // intptr_t. |
| 209 int64_t offset = | 209 intptr_t offset = |
| 210 DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 2)); | 210 DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 2)); |
| 211 int64_t length = | 211 intptr_t length = |
| 212 DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 3)); | 212 DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 3)); |
| 213 intptr_t array_len = 0; | 213 intptr_t array_len = 0; |
| 214 Dart_Handle result = Dart_ListLength(buffer_obj, &array_len); | 214 Dart_Handle result = Dart_ListLength(buffer_obj, &array_len); |
| 215 if (Dart_IsError(result)) Dart_PropagateError(result); | 215 if (Dart_IsError(result)) Dart_PropagateError(result); |
| 216 ASSERT((offset + length) <= array_len); | 216 ASSERT((offset + length) <= array_len); |
| 217 uint8_t* buffer = new uint8_t[length]; | 217 uint8_t* buffer = new uint8_t[length]; |
| 218 int bytes_read = file->Read(reinterpret_cast<void*>(buffer), length); | 218 int64_t bytes_read = file->Read(reinterpret_cast<void*>(buffer), length); |
| 219 if (bytes_read >= 0) { | 219 if (bytes_read >= 0) { |
| 220 result = Dart_ListSetAsBytes(buffer_obj, offset, buffer, bytes_read); | 220 result = Dart_ListSetAsBytes(buffer_obj, offset, buffer, bytes_read); |
| 221 if (Dart_IsError(result)) { | 221 if (Dart_IsError(result)) { |
| 222 delete[] buffer; | 222 delete[] buffer; |
| 223 Dart_PropagateError(result); | 223 Dart_PropagateError(result); |
| 224 } | 224 } |
| 225 Dart_SetReturnValue(args, Dart_NewInteger(bytes_read)); | 225 Dart_SetReturnValue(args, Dart_NewInteger(bytes_read)); |
| 226 } else { | 226 } else { |
| 227 Dart_Handle err = DartUtils::NewDartOSError(); | 227 Dart_Handle err = DartUtils::NewDartOSError(); |
| 228 if (Dart_IsError(err)) Dart_PropagateError(err); | 228 if (Dart_IsError(err)) Dart_PropagateError(err); |
| 229 Dart_SetReturnValue(args, err); | 229 Dart_SetReturnValue(args, err); |
| 230 } | 230 } |
| 231 delete[] buffer; | 231 delete[] buffer; |
| 232 Dart_ExitScope(); | 232 Dart_ExitScope(); |
| 233 } | 233 } |
| 234 | 234 |
| 235 | 235 |
| 236 void FUNCTION_NAME(File_WriteList)(Dart_NativeArguments args) { | 236 void FUNCTION_NAME(File_WriteList)(Dart_NativeArguments args) { |
| 237 Dart_EnterScope(); | 237 Dart_EnterScope(); |
| 238 intptr_t value = | 238 File* file = GetFilePointer(Dart_GetNativeArgument(args, 0)); |
| 239 DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); | |
| 240 File* file = reinterpret_cast<File*>(value); | |
| 241 ASSERT(file != NULL); | 239 ASSERT(file != NULL); |
| 242 Dart_Handle buffer_obj = Dart_GetNativeArgument(args, 1); | 240 Dart_Handle buffer_obj = Dart_GetNativeArgument(args, 1); |
| 243 ASSERT(Dart_IsList(buffer_obj)); | 241 ASSERT(Dart_IsList(buffer_obj)); |
| 244 // Offset and length arguments are checked in Dart code to be | 242 // Offset and length arguments are checked in Dart code to be |
| 245 // integers and have the property that (offset + length) <= | 243 // integers and have the property that (offset + length) <= |
| 246 // list.length. Therefore, it is safe to extract their value as | 244 // list.length. Therefore, it is safe to extract their value as |
| 247 // 64-bit integers. | 245 // intptr_t. |
| 248 int64_t offset = | 246 intptr_t offset = |
| 249 DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 2)); | 247 DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 2)); |
| 250 int64_t length = | 248 intptr_t length = |
| 251 DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 3)); | 249 DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 3)); |
| 252 intptr_t buffer_len = 0; | 250 intptr_t buffer_len = 0; |
| 253 Dart_Handle result = Dart_ListLength(buffer_obj, &buffer_len); | 251 Dart_Handle result = Dart_ListLength(buffer_obj, &buffer_len); |
| 254 if (Dart_IsError(result)) Dart_PropagateError(result); | 252 if (Dart_IsError(result)) Dart_PropagateError(result); |
| 255 ASSERT((offset + length) <= buffer_len); | 253 ASSERT((offset + length) <= buffer_len); |
| 256 uint8_t* buffer = new uint8_t[length]; | 254 uint8_t* buffer = new uint8_t[length]; |
| 257 result = Dart_ListGetAsBytes(buffer_obj, offset, buffer, length); | 255 result = Dart_ListGetAsBytes(buffer_obj, offset, buffer, length); |
| 258 if (Dart_IsError(result)) { | 256 if (Dart_IsError(result)) { |
| 259 delete[] buffer; | 257 delete[] buffer; |
| 260 Dart_PropagateError(result); | 258 Dart_PropagateError(result); |
| 261 } | 259 } |
| 262 int bytes_written = file->Write(reinterpret_cast<void*>(buffer), length); | 260 int64_t bytes_written = file->Write(reinterpret_cast<void*>(buffer), length); |
| 263 if (bytes_written >= 0) { | 261 if (bytes_written >= 0) { |
| 264 Dart_SetReturnValue(args, Dart_NewInteger(bytes_written)); | 262 Dart_SetReturnValue(args, Dart_NewInteger(bytes_written)); |
| 265 } else { | 263 } else { |
| 266 Dart_Handle err = DartUtils::NewDartOSError(); | 264 Dart_Handle err = DartUtils::NewDartOSError(); |
| 267 if (Dart_IsError(err)) Dart_PropagateError(err); | 265 if (Dart_IsError(err)) Dart_PropagateError(err); |
| 268 Dart_SetReturnValue(args, err); | 266 Dart_SetReturnValue(args, err); |
| 269 } | 267 } |
| 270 delete[] buffer; | 268 delete[] buffer; |
| 271 Dart_ExitScope(); | 269 Dart_ExitScope(); |
| 272 } | 270 } |
| 273 | 271 |
| 274 | 272 |
| 275 void FUNCTION_NAME(File_Position)(Dart_NativeArguments args) { | 273 void FUNCTION_NAME(File_Position)(Dart_NativeArguments args) { |
| 276 Dart_EnterScope(); | 274 Dart_EnterScope(); |
| 277 intptr_t value = | 275 File* file = GetFilePointer(Dart_GetNativeArgument(args, 0)); |
| 278 DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); | |
| 279 File* file = reinterpret_cast<File*>(value); | |
| 280 ASSERT(file != NULL); | 276 ASSERT(file != NULL); |
| 281 intptr_t return_value = file->Position(); | 277 intptr_t return_value = file->Position(); |
| 282 if (return_value >= 0) { | 278 if (return_value >= 0) { |
| 283 Dart_SetReturnValue(args, Dart_NewInteger(return_value)); | 279 Dart_SetReturnValue(args, Dart_NewInteger(return_value)); |
| 284 } else { | 280 } else { |
| 285 Dart_Handle err = DartUtils::NewDartOSError(); | 281 Dart_Handle err = DartUtils::NewDartOSError(); |
| 286 if (Dart_IsError(err)) Dart_PropagateError(err); | 282 if (Dart_IsError(err)) Dart_PropagateError(err); |
| 287 Dart_SetReturnValue(args, err); | 283 Dart_SetReturnValue(args, err); |
| 288 } | 284 } |
| 289 Dart_ExitScope(); | 285 Dart_ExitScope(); |
| 290 } | 286 } |
| 291 | 287 |
| 292 | 288 |
| 293 void FUNCTION_NAME(File_SetPosition)(Dart_NativeArguments args) { | 289 void FUNCTION_NAME(File_SetPosition)(Dart_NativeArguments args) { |
| 294 Dart_EnterScope(); | 290 Dart_EnterScope(); |
| 295 intptr_t value = | 291 File* file = GetFilePointer(Dart_GetNativeArgument(args, 0)); |
| 296 DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); | |
| 297 File* file = reinterpret_cast<File*>(value); | |
| 298 ASSERT(file != NULL); | 292 ASSERT(file != NULL); |
| 299 int64_t position = 0; | 293 int64_t position = 0; |
| 300 if (DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 1), &position)) { | 294 if (DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 1), &position)) { |
| 301 if (file->SetPosition(position)) { | 295 if (file->SetPosition(position)) { |
| 302 Dart_SetReturnValue(args, Dart_True()); | 296 Dart_SetReturnValue(args, Dart_True()); |
| 303 } else { | 297 } else { |
| 304 Dart_Handle err = DartUtils::NewDartOSError(); | 298 Dart_Handle err = DartUtils::NewDartOSError(); |
| 305 if (Dart_IsError(err)) Dart_PropagateError(err); | 299 if (Dart_IsError(err)) Dart_PropagateError(err); |
| 306 Dart_SetReturnValue(args, err); | 300 Dart_SetReturnValue(args, err); |
| 307 } | 301 } |
| 308 } else { | 302 } else { |
| 309 OSError os_error(-1, "Invalid argument", OSError::kUnknown); | 303 OSError os_error(-1, "Invalid argument", OSError::kUnknown); |
| 310 Dart_Handle err = DartUtils::NewDartOSError(&os_error); | 304 Dart_Handle err = DartUtils::NewDartOSError(&os_error); |
| 311 if (Dart_IsError(err)) Dart_PropagateError(err); | 305 if (Dart_IsError(err)) Dart_PropagateError(err); |
| 312 Dart_SetReturnValue(args, err); | 306 Dart_SetReturnValue(args, err); |
| 313 } | 307 } |
| 314 Dart_ExitScope(); | 308 Dart_ExitScope(); |
| 315 } | 309 } |
| 316 | 310 |
| 317 | 311 |
| 318 void FUNCTION_NAME(File_Truncate)(Dart_NativeArguments args) { | 312 void FUNCTION_NAME(File_Truncate)(Dart_NativeArguments args) { |
| 319 Dart_EnterScope(); | 313 Dart_EnterScope(); |
| 320 intptr_t value = | 314 File* file = GetFilePointer(Dart_GetNativeArgument(args, 0)); |
| 321 DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); | |
| 322 File* file = reinterpret_cast<File*>(value); | |
| 323 ASSERT(file != NULL); | 315 ASSERT(file != NULL); |
| 324 int64_t length = 0; | 316 int64_t length = 0; |
| 325 if (DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 1), &length)) { | 317 if (DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 1), &length)) { |
| 326 if (file->Truncate(length)) { | 318 if (file->Truncate(length)) { |
| 327 Dart_SetReturnValue(args, Dart_True()); | 319 Dart_SetReturnValue(args, Dart_True()); |
| 328 } else { | 320 } else { |
| 329 Dart_Handle err = DartUtils::NewDartOSError(); | 321 Dart_Handle err = DartUtils::NewDartOSError(); |
| 330 if (Dart_IsError(err)) Dart_PropagateError(err); | 322 if (Dart_IsError(err)) Dart_PropagateError(err); |
| 331 Dart_SetReturnValue(args, err); | 323 Dart_SetReturnValue(args, err); |
| 332 } | 324 } |
| 333 } else { | 325 } else { |
| 334 OSError os_error(-1, "Invalid argument", OSError::kUnknown); | 326 OSError os_error(-1, "Invalid argument", OSError::kUnknown); |
| 335 Dart_Handle err = DartUtils::NewDartOSError(&os_error); | 327 Dart_Handle err = DartUtils::NewDartOSError(&os_error); |
| 336 if (Dart_IsError(err)) Dart_PropagateError(err); | 328 if (Dart_IsError(err)) Dart_PropagateError(err); |
| 337 Dart_SetReturnValue(args, err); | 329 Dart_SetReturnValue(args, err); |
| 338 } | 330 } |
| 339 Dart_ExitScope(); | 331 Dart_ExitScope(); |
| 340 } | 332 } |
| 341 | 333 |
| 342 | 334 |
| 343 void FUNCTION_NAME(File_Length)(Dart_NativeArguments args) { | 335 void FUNCTION_NAME(File_Length)(Dart_NativeArguments args) { |
| 344 Dart_EnterScope(); | 336 Dart_EnterScope(); |
| 345 intptr_t value = | 337 File* file = GetFilePointer(Dart_GetNativeArgument(args, 0)); |
| 346 DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); | |
| 347 File* file = reinterpret_cast<File*>(value); | |
| 348 ASSERT(file != NULL); | 338 ASSERT(file != NULL); |
| 349 intptr_t return_value = file->Length(); | 339 intptr_t return_value = file->Length(); |
| 350 if (return_value >= 0) { | 340 if (return_value >= 0) { |
| 351 Dart_SetReturnValue(args, Dart_NewInteger(return_value)); | 341 Dart_SetReturnValue(args, Dart_NewInteger(return_value)); |
| 352 } else { | 342 } else { |
| 353 Dart_Handle err = DartUtils::NewDartOSError(); | 343 Dart_Handle err = DartUtils::NewDartOSError(); |
| 354 if (Dart_IsError(err)) Dart_PropagateError(err); | 344 if (Dart_IsError(err)) Dart_PropagateError(err); |
| 355 Dart_SetReturnValue(args, err); | 345 Dart_SetReturnValue(args, err); |
| 356 } | 346 } |
| 357 Dart_ExitScope(); | 347 Dart_ExitScope(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 385 Dart_Handle err = DartUtils::NewDartOSError(); | 375 Dart_Handle err = DartUtils::NewDartOSError(); |
| 386 if (Dart_IsError(err)) Dart_PropagateError(err); | 376 if (Dart_IsError(err)) Dart_PropagateError(err); |
| 387 Dart_SetReturnValue(args, err); | 377 Dart_SetReturnValue(args, err); |
| 388 } | 378 } |
| 389 Dart_ExitScope(); | 379 Dart_ExitScope(); |
| 390 } | 380 } |
| 391 | 381 |
| 392 | 382 |
| 393 void FUNCTION_NAME(File_Flush)(Dart_NativeArguments args) { | 383 void FUNCTION_NAME(File_Flush)(Dart_NativeArguments args) { |
| 394 Dart_EnterScope(); | 384 Dart_EnterScope(); |
| 395 intptr_t value = | 385 File* file = GetFilePointer(Dart_GetNativeArgument(args, 0)); |
| 396 DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); | |
| 397 File* file = reinterpret_cast<File*>(value); | |
| 398 ASSERT(file != NULL); | 386 ASSERT(file != NULL); |
| 399 if (file->Flush()) { | 387 if (file->Flush()) { |
| 400 Dart_SetReturnValue(args, Dart_True()); | 388 Dart_SetReturnValue(args, Dart_True()); |
| 401 } else { | 389 } else { |
| 402 Dart_Handle err = DartUtils::NewDartOSError(); | 390 Dart_Handle err = DartUtils::NewDartOSError(); |
| 403 if (Dart_IsError(err)) Dart_PropagateError(err); | 391 if (Dart_IsError(err)) Dart_PropagateError(err); |
| 404 Dart_SetReturnValue(args, err); | 392 Dart_SetReturnValue(args, err); |
| 405 } | 393 } |
| 406 Dart_ExitScope(); | 394 Dart_ExitScope(); |
| 407 } | 395 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 Dart_Handle err = DartUtils::NewDartOSError(); | 458 Dart_Handle err = DartUtils::NewDartOSError(); |
| 471 if (Dart_IsError(err)) Dart_PropagateError(err); | 459 if (Dart_IsError(err)) Dart_PropagateError(err); |
| 472 Dart_SetReturnValue(args, err); | 460 Dart_SetReturnValue(args, err); |
| 473 } | 461 } |
| 474 Dart_ExitScope(); | 462 Dart_ExitScope(); |
| 475 } | 463 } |
| 476 | 464 |
| 477 | 465 |
| 478 void FUNCTION_NAME(File_OpenStdio)(Dart_NativeArguments args) { | 466 void FUNCTION_NAME(File_OpenStdio)(Dart_NativeArguments args) { |
| 479 Dart_EnterScope(); | 467 Dart_EnterScope(); |
| 480 int fd = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); | 468 int64_t fd = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); |
| 481 File* file = File::OpenStdio(fd); | 469 ASSERT(fd == 0 || fd == 1 || fd == 2); |
| 470 File* file = File::OpenStdio(static_cast<int>(fd)); |
| 482 Dart_SetReturnValue(args, Dart_NewInteger(reinterpret_cast<intptr_t>(file))); | 471 Dart_SetReturnValue(args, Dart_NewInteger(reinterpret_cast<intptr_t>(file))); |
| 483 Dart_ExitScope(); | 472 Dart_ExitScope(); |
| 484 } | 473 } |
| 485 | 474 |
| 486 | 475 |
| 487 void FUNCTION_NAME(File_GetStdioHandleType)(Dart_NativeArguments args) { | 476 void FUNCTION_NAME(File_GetStdioHandleType)(Dart_NativeArguments args) { |
| 488 Dart_EnterScope(); | 477 Dart_EnterScope(); |
| 489 int fd = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); | 478 int64_t fd = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); |
| 490 File::StdioHandleType type = File::GetStdioHandleType(fd); | 479 ASSERT(fd == 0 || fd == 1 || fd == 2); |
| 480 File::StdioHandleType type = File::GetStdioHandleType(static_cast<int>(fd)); |
| 491 Dart_SetReturnValue(args, Dart_NewInteger(type)); | 481 Dart_SetReturnValue(args, Dart_NewInteger(type)); |
| 492 Dart_ExitScope(); | 482 Dart_ExitScope(); |
| 493 } | 483 } |
| 494 | 484 |
| 495 | 485 |
| 496 static int64_t CObjectInt32OrInt64ToInt64(CObject* cobject) { | 486 static int64_t CObjectInt32OrInt64ToInt64(CObject* cobject) { |
| 497 ASSERT(cobject->IsInt32OrInt64()); | 487 ASSERT(cobject->IsInt32OrInt64()); |
| 498 int64_t result; | 488 int64_t result; |
| 499 if (cobject->IsInt32()) { | 489 if (cobject->IsInt32()) { |
| 500 CObjectInt32 value(cobject); | 490 CObjectInt32 value(cobject); |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 return CObject::IllegalArgumentError(); | 733 return CObject::IllegalArgumentError(); |
| 744 } | 734 } |
| 745 | 735 |
| 746 | 736 |
| 747 static CObject* FileReadByteRequest(const CObjectArray& request) { | 737 static CObject* FileReadByteRequest(const CObjectArray& request) { |
| 748 if (request.Length() == 2 && request[1]->IsIntptr()) { | 738 if (request.Length() == 2 && request[1]->IsIntptr()) { |
| 749 File* file = CObjectToFilePointer(request[1]); | 739 File* file = CObjectToFilePointer(request[1]); |
| 750 ASSERT(file != NULL); | 740 ASSERT(file != NULL); |
| 751 if (!file->IsClosed()) { | 741 if (!file->IsClosed()) { |
| 752 uint8_t buffer; | 742 uint8_t buffer; |
| 753 int bytes_read = file->Read(reinterpret_cast<void*>(&buffer), 1); | 743 int64_t bytes_read = file->Read(reinterpret_cast<void*>(&buffer), 1); |
| 754 if (bytes_read > 0) { | 744 if (bytes_read > 0) { |
| 755 return new CObjectIntptr(CObject::NewIntptr(buffer)); | 745 return new CObjectIntptr(CObject::NewIntptr(buffer)); |
| 756 } else if (bytes_read == 0) { | 746 } else if (bytes_read == 0) { |
| 757 return new CObjectIntptr(CObject::NewIntptr(-1)); | 747 return new CObjectIntptr(CObject::NewIntptr(-1)); |
| 758 } else { | 748 } else { |
| 759 return CObject::NewOSError(); | 749 return CObject::NewOSError(); |
| 760 } | 750 } |
| 761 } else { | 751 } else { |
| 762 return CObject::FileClosedError(); | 752 return CObject::FileClosedError(); |
| 763 } | 753 } |
| 764 } | 754 } |
| 765 return CObject::IllegalArgumentError(); | 755 return CObject::IllegalArgumentError(); |
| 766 } | 756 } |
| 767 | 757 |
| 768 | 758 |
| 769 static CObject* FileWriteByteRequest(const CObjectArray& request) { | 759 static CObject* FileWriteByteRequest(const CObjectArray& request) { |
| 770 if (request.Length() == 3 && | 760 if (request.Length() == 3 && |
| 771 request[1]->IsIntptr() && | 761 request[1]->IsIntptr() && |
| 772 request[2]->IsInt32OrInt64()) { | 762 request[2]->IsInt32OrInt64()) { |
| 773 File* file = CObjectToFilePointer(request[1]); | 763 File* file = CObjectToFilePointer(request[1]); |
| 774 ASSERT(file != NULL); | 764 ASSERT(file != NULL); |
| 775 if (!file->IsClosed()) { | 765 if (!file->IsClosed()) { |
| 776 int64_t byte = CObjectInt32OrInt64ToInt64(request[2]); | 766 int64_t byte = CObjectInt32OrInt64ToInt64(request[2]); |
| 777 uint8_t buffer = static_cast<uint8_t>(byte & 0xff); | 767 uint8_t buffer = static_cast<uint8_t>(byte & 0xff); |
| 778 int bytes_written = file->Write(reinterpret_cast<void*>(&buffer), 1); | 768 int64_t bytes_written = file->Write(reinterpret_cast<void*>(&buffer), 1); |
| 779 if (bytes_written > 0) { | 769 if (bytes_written > 0) { |
| 780 return new CObjectIntptr(CObject::NewIntptr(bytes_written)); | 770 return new CObjectInt64(CObject::NewInt64(bytes_written)); |
| 781 } else { | 771 } else { |
| 782 return CObject::NewOSError(); | 772 return CObject::NewOSError(); |
| 783 } | 773 } |
| 784 } else { | 774 } else { |
| 785 return CObject::FileClosedError(); | 775 return CObject::FileClosedError(); |
| 786 } | 776 } |
| 787 } | 777 } |
| 788 return CObject::IllegalArgumentError(); | 778 return CObject::IllegalArgumentError(); |
| 789 } | 779 } |
| 790 | 780 |
| 791 | 781 |
| 792 static void FinalizeExternalByteArray(void* peer) { | 782 static void FinalizeExternalByteArray(void* peer) { |
| 793 delete[] reinterpret_cast<uint8_t*>(peer); | 783 delete[] reinterpret_cast<uint8_t*>(peer); |
| 794 } | 784 } |
| 795 | 785 |
| 796 | 786 |
| 797 static CObject* FileReadRequest(const CObjectArray& request) { | 787 static CObject* FileReadRequest(const CObjectArray& request) { |
| 798 if (request.Length() == 3 && | 788 if (request.Length() == 3 && |
| 799 request[1]->IsIntptr() && | 789 request[1]->IsIntptr() && |
| 800 request[2]->IsInt32OrInt64()) { | 790 request[2]->IsInt32OrInt64()) { |
| 801 File* file = CObjectToFilePointer(request[1]); | 791 File* file = CObjectToFilePointer(request[1]); |
| 802 ASSERT(file != NULL); | 792 ASSERT(file != NULL); |
| 803 if (!file->IsClosed()) { | 793 if (!file->IsClosed()) { |
| 804 int64_t length = CObjectInt32OrInt64ToInt64(request[2]); | 794 int64_t length = CObjectInt32OrInt64ToInt64(request[2]); |
| 805 uint8_t* buffer = new uint8_t[length]; | 795 uint8_t* buffer = new uint8_t[length]; |
| 806 int bytes_read = file->Read(buffer, length); | 796 int64_t bytes_read = file->Read(buffer, length); |
| 807 if (bytes_read >= 0) { | 797 if (bytes_read >= 0) { |
| 808 void* peer = reinterpret_cast<void*>(buffer); | 798 void* peer = reinterpret_cast<void*>(buffer); |
| 809 CObject* external_array = | 799 CObject* external_array = |
| 810 new CObjectExternalUint8Array( | 800 new CObjectExternalUint8Array( |
| 811 CObject::NewExternalUint8Array(bytes_read, | 801 CObject::NewExternalUint8Array(bytes_read, |
| 812 buffer, | 802 buffer, |
| 813 peer, | 803 peer, |
| 814 FinalizeExternalByteArray)); | 804 FinalizeExternalByteArray)); |
| 815 CObjectArray* result = new CObjectArray(CObject::NewArray(2)); | 805 CObjectArray* result = new CObjectArray(CObject::NewArray(2)); |
| 816 result->SetAt(0, new CObjectIntptr(CObject::NewInt32(0))); | 806 result->SetAt(0, new CObjectIntptr(CObject::NewInt32(0))); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 829 | 819 |
| 830 static CObject* FileReadListRequest(const CObjectArray& request) { | 820 static CObject* FileReadListRequest(const CObjectArray& request) { |
| 831 if (request.Length() == 3 && | 821 if (request.Length() == 3 && |
| 832 request[1]->IsIntptr() && | 822 request[1]->IsIntptr() && |
| 833 request[2]->IsInt32OrInt64()) { | 823 request[2]->IsInt32OrInt64()) { |
| 834 File* file = CObjectToFilePointer(request[1]); | 824 File* file = CObjectToFilePointer(request[1]); |
| 835 ASSERT(file != NULL); | 825 ASSERT(file != NULL); |
| 836 if (!file->IsClosed()) { | 826 if (!file->IsClosed()) { |
| 837 int64_t length = CObjectInt32OrInt64ToInt64(request[2]); | 827 int64_t length = CObjectInt32OrInt64ToInt64(request[2]); |
| 838 uint8_t* buffer = new uint8_t[length]; | 828 uint8_t* buffer = new uint8_t[length]; |
| 839 int bytes_read = file->Read(buffer, length); | 829 int64_t bytes_read = file->Read(buffer, length); |
| 840 if (bytes_read >= 0) { | 830 if (bytes_read >= 0) { |
| 841 void* peer = reinterpret_cast<void*>(buffer); | 831 void* peer = reinterpret_cast<void*>(buffer); |
| 842 CObject* external_array = | 832 CObject* external_array = |
| 843 new CObjectExternalUint8Array( | 833 new CObjectExternalUint8Array( |
| 844 CObject::NewExternalUint8Array(length, | 834 CObject::NewExternalUint8Array(length, |
| 845 buffer, | 835 buffer, |
| 846 peer, | 836 peer, |
| 847 FinalizeExternalByteArray)); | 837 FinalizeExternalByteArray)); |
| 848 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); | 838 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); |
| 849 result->SetAt(0, new CObjectIntptr(CObject::NewInt32(0))); | 839 result->SetAt(0, new CObjectIntptr(CObject::NewInt32(0))); |
| 850 result->SetAt(1, new CObjectIntptr(CObject::NewIntptr(bytes_read))); | 840 result->SetAt(1, new CObjectInt64(CObject::NewInt64(bytes_read))); |
| 851 result->SetAt(2, external_array); | 841 result->SetAt(2, external_array); |
| 852 return result; | 842 return result; |
| 853 } else { | 843 } else { |
| 854 return CObject::NewOSError(); | 844 return CObject::NewOSError(); |
| 855 } | 845 } |
| 856 } else { | 846 } else { |
| 857 return CObject::FileClosedError(); | 847 return CObject::FileClosedError(); |
| 858 } | 848 } |
| 859 } | 849 } |
| 860 return CObject::IllegalArgumentError(); | 850 return CObject::IllegalArgumentError(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 875 uint8_t* buffer_start; | 865 uint8_t* buffer_start; |
| 876 if (request[2]->IsUint8Array()) { | 866 if (request[2]->IsUint8Array()) { |
| 877 CObjectUint8Array byte_array(request[2]); | 867 CObjectUint8Array byte_array(request[2]); |
| 878 buffer_start = byte_array.Buffer() + offset; | 868 buffer_start = byte_array.Buffer() + offset; |
| 879 } else { | 869 } else { |
| 880 CObjectArray array(request[2]); | 870 CObjectArray array(request[2]); |
| 881 buffer_start = new uint8_t[length]; | 871 buffer_start = new uint8_t[length]; |
| 882 for (int i = 0; i < length; i++) { | 872 for (int i = 0; i < length; i++) { |
| 883 if (array[i + offset]->IsInt32OrInt64()) { | 873 if (array[i + offset]->IsInt32OrInt64()) { |
| 884 int64_t value = CObjectInt32OrInt64ToInt64(array[i + offset]); | 874 int64_t value = CObjectInt32OrInt64ToInt64(array[i + offset]); |
| 885 buffer_start[i] = value & 0xFF; | 875 buffer_start[i] = static_cast<uint8_t>(value & 0xFF); |
| 886 } else { | 876 } else { |
| 887 // Unsupported type. | 877 // Unsupported type. |
| 888 delete[] buffer_start; | 878 delete[] buffer_start; |
| 889 return CObject::IllegalArgumentError(); | 879 return CObject::IllegalArgumentError(); |
| 890 } | 880 } |
| 891 } | 881 } |
| 892 offset = 0; | 882 offset = 0; |
| 893 } | 883 } |
| 894 int64_t bytes_written = | 884 int64_t bytes_written = |
| 895 file->Write(reinterpret_cast<void*>(buffer_start), length); | 885 file->Write(reinterpret_cast<void*>(buffer_start), length); |
| 896 if (!request[2]->IsUint8Array()) { | 886 if (!request[2]->IsUint8Array()) { |
| 897 delete[] buffer_start; | 887 delete[] buffer_start; |
| 898 } | 888 } |
| 899 if (bytes_written >= 0) { | 889 if (bytes_written >= 0) { |
| 900 return new CObjectIntptr(CObject::NewIntptr(bytes_written)); | 890 return new CObjectInt64(CObject::NewInt64(bytes_written)); |
| 901 } else { | 891 } else { |
| 902 return CObject::NewOSError(); | 892 return CObject::NewOSError(); |
| 903 } | 893 } |
| 904 } else { | 894 } else { |
| 905 return CObject::FileClosedError(); | 895 return CObject::FileClosedError(); |
| 906 } | 896 } |
| 907 } | 897 } |
| 908 return CObject::IllegalArgumentError(); | 898 return CObject::IllegalArgumentError(); |
| 909 } | 899 } |
| 910 | 900 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 Dart_EnterScope(); | 1004 Dart_EnterScope(); |
| 1015 Dart_SetReturnValue(args, Dart_Null()); | 1005 Dart_SetReturnValue(args, Dart_Null()); |
| 1016 Dart_Port service_port = File::GetServicePort(); | 1006 Dart_Port service_port = File::GetServicePort(); |
| 1017 if (service_port != ILLEGAL_PORT) { | 1007 if (service_port != ILLEGAL_PORT) { |
| 1018 // Return a send port for the service port. | 1008 // Return a send port for the service port. |
| 1019 Dart_Handle send_port = Dart_NewSendPort(service_port); | 1009 Dart_Handle send_port = Dart_NewSendPort(service_port); |
| 1020 Dart_SetReturnValue(args, send_port); | 1010 Dart_SetReturnValue(args, send_port); |
| 1021 } | 1011 } |
| 1022 Dart_ExitScope(); | 1012 Dart_ExitScope(); |
| 1023 } | 1013 } |
| OLD | NEW |