| 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 "bin/crypto.h" | 7 #include "bin/crypto.h" |
| 8 #include "bin/directory.h" | 8 #include "bin/directory.h" |
| 9 #include "bin/extensions.h" | 9 #include "bin/extensions.h" |
| 10 #include "bin/file.h" | 10 #include "bin/file.h" |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 | 491 |
| 492 | 492 |
| 493 void DartUtils::WriteMagicNumber(File* file) { | 493 void DartUtils::WriteMagicNumber(File* file) { |
| 494 // Write a magic number and version information into the snapshot file. | 494 // Write a magic number and version information into the snapshot file. |
| 495 bool bytes_written = file->WriteFully(magic_number, sizeof(magic_number)); | 495 bool bytes_written = file->WriteFully(magic_number, sizeof(magic_number)); |
| 496 ASSERT(bytes_written); | 496 ASSERT(bytes_written); |
| 497 } | 497 } |
| 498 | 498 |
| 499 | 499 |
| 500 Dart_Handle DartUtils::LoadScript(const char* script_uri) { | 500 Dart_Handle DartUtils::LoadScript(const char* script_uri) { |
| 501 Dart_TimelineEvent("LoadScript", |
| 502 Dart_TimelineGetMicros(), |
| 503 Dart_GetMainPortId(), |
| 504 Dart_Timeline_Event_Async_Begin, |
| 505 0, NULL, NULL); |
| 501 Dart_Handle uri = Dart_NewStringFromCString(script_uri); | 506 Dart_Handle uri = Dart_NewStringFromCString(script_uri); |
| 502 IsolateData* isolate_data = | |
| 503 reinterpret_cast<IsolateData*>(Dart_CurrentIsolateData()); | |
| 504 Dart_TimelineAsyncBegin("LoadScript", &(isolate_data->load_async_id)); | |
| 505 return LoadDataAsync_Invoke(Dart_Null(), uri, Dart_Null()); | 507 return LoadDataAsync_Invoke(Dart_Null(), uri, Dart_Null()); |
| 506 } | 508 } |
| 507 | 509 |
| 508 | 510 |
| 509 // Callback function, gets called from asynchronous script and library | 511 // Callback function, gets called from asynchronous script and library |
| 510 // reading code when there is an i/o error. | 512 // reading code when there is an i/o error. |
| 511 void FUNCTION_NAME(Builtin_AsyncLoadError)(Dart_NativeArguments args) { | 513 void FUNCTION_NAME(Builtin_AsyncLoadError)(Dart_NativeArguments args) { |
| 512 // Dart_Handle source_uri = Dart_GetNativeArgument(args, 0); | 514 // Dart_Handle source_uri = Dart_GetNativeArgument(args, 0); |
| 513 Dart_Handle library_uri = Dart_GetNativeArgument(args, 1); | 515 Dart_Handle library_uri = Dart_GetNativeArgument(args, 1); |
| 514 Dart_Handle error = Dart_GetNativeArgument(args, 2); | 516 Dart_Handle error = Dart_GetNativeArgument(args, 2); |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1259 new CObjectString(CObject::NewString(os_error->message())); | 1261 new CObjectString(CObject::NewString(os_error->message())); |
| 1260 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); | 1262 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); |
| 1261 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); | 1263 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); |
| 1262 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); | 1264 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); |
| 1263 result->SetAt(2, error_message); | 1265 result->SetAt(2, error_message); |
| 1264 return result; | 1266 return result; |
| 1265 } | 1267 } |
| 1266 | 1268 |
| 1267 } // namespace bin | 1269 } // namespace bin |
| 1268 } // namespace dart | 1270 } // namespace dart |
| OLD | NEW |