| 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/thread.h" | 9 #include "bin/thread.h" |
| 10 #include "bin/utils.h" | 10 #include "bin/utils.h" |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 } | 346 } |
| 347 Dart_SetReturnValue(args, err); | 347 Dart_SetReturnValue(args, err); |
| 348 } | 348 } |
| 349 } | 349 } |
| 350 Dart_ExitScope(); | 350 Dart_ExitScope(); |
| 351 } | 351 } |
| 352 | 352 |
| 353 | 353 |
| 354 void FUNCTION_NAME(File_Flush)(Dart_NativeArguments args) { | 354 void FUNCTION_NAME(File_Flush)(Dart_NativeArguments args) { |
| 355 Dart_EnterScope(); | 355 Dart_EnterScope(); |
| 356 intptr_t return_value = -1; | |
| 357 intptr_t value = | 356 intptr_t value = |
| 358 DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); | 357 DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); |
| 359 File* file = reinterpret_cast<File*>(value); | 358 File* file = reinterpret_cast<File*>(value); |
| 360 if (file != NULL) { | 359 if (file != NULL) { |
| 361 if (file->Flush()) { | 360 if (file->Flush()) { |
| 362 Dart_SetReturnValue(args, Dart_True()); | 361 Dart_SetReturnValue(args, Dart_True()); |
| 363 } else { | 362 } else { |
| 364 Dart_Handle err = DartUtils::NewDartOSError(); | 363 Dart_Handle err = DartUtils::NewDartOSError(); |
| 365 if (Dart_IsError(err)) { | 364 if (Dart_IsError(err)) { |
| 366 Dart_PropagateError(err); | 365 Dart_PropagateError(err); |
| 367 } | 366 } |
| 368 Dart_SetReturnValue(args, err); | 367 Dart_SetReturnValue(args, err); |
| 369 } | 368 } |
| 370 return_value = 0; | |
| 371 } | 369 } |
| 372 Dart_ExitScope(); | 370 Dart_ExitScope(); |
| 373 } | 371 } |
| 374 | 372 |
| 375 | 373 |
| 376 void FUNCTION_NAME(File_Create)(Dart_NativeArguments args) { | 374 void FUNCTION_NAME(File_Create)(Dart_NativeArguments args) { |
| 377 Dart_EnterScope(); | 375 Dart_EnterScope(); |
| 378 const char* str = | 376 const char* str = |
| 379 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); | 377 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); |
| 380 bool result = File::Create(str); | 378 bool result = File::Create(str); |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 Dart_EnterScope(); | 921 Dart_EnterScope(); |
| 924 Dart_SetReturnValue(args, Dart_Null()); | 922 Dart_SetReturnValue(args, Dart_Null()); |
| 925 Dart_Port service_port = File::GetServicePort(); | 923 Dart_Port service_port = File::GetServicePort(); |
| 926 if (service_port != kIllegalPort) { | 924 if (service_port != kIllegalPort) { |
| 927 // Return a send port for the service port. | 925 // Return a send port for the service port. |
| 928 Dart_Handle send_port = Dart_NewSendPort(service_port); | 926 Dart_Handle send_port = Dart_NewSendPort(service_port); |
| 929 Dart_SetReturnValue(args, send_port); | 927 Dart_SetReturnValue(args, send_port); |
| 930 } | 928 } |
| 931 Dart_ExitScope(); | 929 Dart_ExitScope(); |
| 932 } | 930 } |
| OLD | NEW |