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/dartutils.h" | 5 #include "bin/dartutils.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
9 | 9 |
10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 bool bytes_written = file->WriteFully(magic_number, sizeof(magic_number)); | 475 bool bytes_written = file->WriteFully(magic_number, sizeof(magic_number)); |
476 ASSERT(bytes_written); | 476 ASSERT(bytes_written); |
477 } | 477 } |
478 | 478 |
479 | 479 |
480 Dart_Handle DartUtils::LoadScript(const char* script_uri, | 480 Dart_Handle DartUtils::LoadScript(const char* script_uri, |
481 Dart_Handle builtin_lib) { | 481 Dart_Handle builtin_lib) { |
482 Dart_Handle uri = Dart_NewStringFromCString(script_uri); | 482 Dart_Handle uri = Dart_NewStringFromCString(script_uri); |
483 | 483 |
484 Dart_Port load_port = Dart_ServiceWaitForLoadPort(); | 484 Dart_Port load_port = Dart_ServiceWaitForLoadPort(); |
485 if (load_port == ILLEGAL_PORT) { | 485 if (load_port == DART_ILLEGAL_PORT) { |
486 return NewDartUnsupportedError("Service did not return load port."); | 486 return NewDartUnsupportedError("Service did not return load port."); |
487 } | 487 } |
488 Builtin::SetLoadPort(load_port); | 488 Builtin::SetLoadPort(load_port); |
489 | 489 |
490 return LoadDataAsync_Invoke(Dart_Null(), uri, Dart_Null(), builtin_lib); | 490 return LoadDataAsync_Invoke(Dart_Null(), uri, Dart_Null(), builtin_lib); |
491 } | 491 } |
492 | 492 |
493 | 493 |
494 // Callback function, gets called from asynchronous script and library | 494 // Callback function, gets called from asynchronous script and library |
495 // reading code when there is an i/o error. | 495 // reading code when there is an i/o error. |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1205 new CObjectString(CObject::NewString(os_error->message())); | 1205 new CObjectString(CObject::NewString(os_error->message())); |
1206 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); | 1206 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); |
1207 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); | 1207 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); |
1208 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); | 1208 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); |
1209 result->SetAt(2, error_message); | 1209 result->SetAt(2, error_message); |
1210 return result; | 1210 return result; |
1211 } | 1211 } |
1212 | 1212 |
1213 } // namespace bin | 1213 } // namespace bin |
1214 } // namespace dart | 1214 } // namespace dart |
OLD | NEW |