| 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 #include "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
| 7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
| 8 | 8 |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "lib/stacktrace.h" | 10 #include "lib/stacktrace.h" |
| (...skipping 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1459 } | 1459 } |
| 1460 | 1460 |
| 1461 | 1461 |
| 1462 DART_EXPORT Dart_Handle Dart_CreateSnapshot( | 1462 DART_EXPORT Dart_Handle Dart_CreateSnapshot( |
| 1463 uint8_t** vm_isolate_snapshot_buffer, | 1463 uint8_t** vm_isolate_snapshot_buffer, |
| 1464 intptr_t* vm_isolate_snapshot_size, | 1464 intptr_t* vm_isolate_snapshot_size, |
| 1465 uint8_t** isolate_snapshot_buffer, | 1465 uint8_t** isolate_snapshot_buffer, |
| 1466 intptr_t* isolate_snapshot_size) { | 1466 intptr_t* isolate_snapshot_size) { |
| 1467 ASSERT(FLAG_load_deferred_eagerly); | 1467 ASSERT(FLAG_load_deferred_eagerly); |
| 1468 DARTSCOPE(Thread::Current()); | 1468 DARTSCOPE(Thread::Current()); |
| 1469 API_TIMELINE_DURATION; |
| 1469 Isolate* I = T->isolate(); | 1470 Isolate* I = T->isolate(); |
| 1470 if (vm_isolate_snapshot_buffer != NULL && | 1471 if (vm_isolate_snapshot_buffer != NULL && |
| 1471 vm_isolate_snapshot_size == NULL) { | 1472 vm_isolate_snapshot_size == NULL) { |
| 1472 RETURN_NULL_ERROR(vm_isolate_snapshot_size); | 1473 RETURN_NULL_ERROR(vm_isolate_snapshot_size); |
| 1473 } | 1474 } |
| 1474 if (isolate_snapshot_buffer == NULL) { | 1475 if (isolate_snapshot_buffer == NULL) { |
| 1475 RETURN_NULL_ERROR(isolate_snapshot_buffer); | 1476 RETURN_NULL_ERROR(isolate_snapshot_buffer); |
| 1476 } | 1477 } |
| 1477 if (isolate_snapshot_size == NULL) { | 1478 if (isolate_snapshot_size == NULL) { |
| 1478 RETURN_NULL_ERROR(isolate_snapshot_size); | 1479 RETURN_NULL_ERROR(isolate_snapshot_size); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1530 #endif // #if defined(DEBUG). | 1531 #endif // #if defined(DEBUG). |
| 1531 ScriptSnapshotWriter writer(buffer, ApiReallocate); | 1532 ScriptSnapshotWriter writer(buffer, ApiReallocate); |
| 1532 writer.WriteScriptSnapshot(lib); | 1533 writer.WriteScriptSnapshot(lib); |
| 1533 *size = writer.BytesWritten(); | 1534 *size = writer.BytesWritten(); |
| 1534 return Api::Success(); | 1535 return Api::Success(); |
| 1535 } | 1536 } |
| 1536 | 1537 |
| 1537 | 1538 |
| 1538 DART_EXPORT Dart_Handle Dart_CreateScriptSnapshot(uint8_t** buffer, | 1539 DART_EXPORT Dart_Handle Dart_CreateScriptSnapshot(uint8_t** buffer, |
| 1539 intptr_t* size) { | 1540 intptr_t* size) { |
| 1541 API_TIMELINE_DURATION; |
| 1540 return createLibrarySnapshot(Dart_Null(), buffer, size); | 1542 return createLibrarySnapshot(Dart_Null(), buffer, size); |
| 1541 } | 1543 } |
| 1542 | 1544 |
| 1543 | 1545 |
| 1544 DART_EXPORT Dart_Handle Dart_CreateLibrarySnapshot(Dart_Handle library, | 1546 DART_EXPORT Dart_Handle Dart_CreateLibrarySnapshot(Dart_Handle library, |
| 1545 uint8_t** buffer, | 1547 uint8_t** buffer, |
| 1546 intptr_t* size) { | 1548 intptr_t* size) { |
| 1549 API_TIMELINE_DURATION; |
| 1547 return createLibrarySnapshot(library, buffer, size); | 1550 return createLibrarySnapshot(library, buffer, size); |
| 1548 } | 1551 } |
| 1549 | 1552 |
| 1550 | 1553 |
| 1551 DART_EXPORT void Dart_InterruptIsolate(Dart_Isolate isolate) { | 1554 DART_EXPORT void Dart_InterruptIsolate(Dart_Isolate isolate) { |
| 1552 if (isolate == NULL) { | 1555 if (isolate == NULL) { |
| 1553 FATAL1("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC); | 1556 FATAL1("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC); |
| 1554 } | 1557 } |
| 1555 // TODO(16615): Validate isolate parameter. | 1558 // TODO(16615): Validate isolate parameter. |
| 1556 Isolate* iso = reinterpret_cast<Isolate*>(isolate); | 1559 Isolate* iso = reinterpret_cast<Isolate*>(isolate); |
| (...skipping 4639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6196 return Api::Success(); | 6199 return Api::Success(); |
| 6197 } | 6200 } |
| 6198 #endif // DART_PRECOMPILER | 6201 #endif // DART_PRECOMPILER |
| 6199 | 6202 |
| 6200 | 6203 |
| 6201 DART_EXPORT bool Dart_IsRunningPrecompiledCode() { | 6204 DART_EXPORT bool Dart_IsRunningPrecompiledCode() { |
| 6202 return Dart::IsRunningPrecompiledCode(); | 6205 return Dart::IsRunningPrecompiledCode(); |
| 6203 } | 6206 } |
| 6204 | 6207 |
| 6205 } // namespace dart | 6208 } // namespace dart |
| OLD | NEW |