| 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 | 6 |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 "%s expects argument 'num_values' to be greater than 0.", | 483 "%s expects argument 'num_values' to be greater than 0.", |
| 484 CURRENT_FUNC); | 484 CURRENT_FUNC); |
| 485 } | 485 } |
| 486 | 486 |
| 487 WeakReference* reference = new WeakReference(keys, num_keys, | 487 WeakReference* reference = new WeakReference(keys, num_keys, |
| 488 values, num_values); | 488 values, num_values); |
| 489 state->DelayWeakReference(reference); | 489 state->DelayWeakReference(reference); |
| 490 return Api::Success(); | 490 return Api::Success(); |
| 491 } | 491 } |
| 492 | 492 |
| 493 |
| 494 // --- Garbage Collection Callbacks -- |
| 495 |
| 496 |
| 497 DART_EXPORT Dart_Handle Dart_AddGcPrologueCallback( |
| 498 Dart_GcPrologueCallback callback) { |
| 499 Isolate* isolate = Isolate::Current(); |
| 500 CHECK_ISOLATE(isolate); |
| 501 GcPrologueCallbacks& callbacks = isolate->gc_prologue_callbacks(); |
| 502 if (callbacks.Contains(callback)) { |
| 503 return Api::NewError( |
| 504 "%s permits only one instance of 'callback' to be present in the " |
| 505 "prologue callback list.", |
| 506 CURRENT_FUNC); |
| 507 } |
| 508 callbacks.Add(callback); |
| 509 return Api::Success(); |
| 510 } |
| 511 |
| 512 |
| 513 DART_EXPORT Dart_Handle Dart_RemoveGcPrologueCallback( |
| 514 Dart_GcPrologueCallback callback) { |
| 515 Isolate* isolate = Isolate::Current(); |
| 516 CHECK_ISOLATE(isolate); |
| 517 GcPrologueCallbacks& callbacks = isolate->gc_prologue_callbacks(); |
| 518 if (!callbacks.Contains(callback)) { |
| 519 return Api::NewError( |
| 520 "%s expects 'callback' to be present in the prologue callback list.", |
| 521 CURRENT_FUNC); |
| 522 } |
| 523 callbacks.Remove(callback); |
| 524 return Api::Success(); |
| 525 } |
| 526 |
| 527 |
| 528 DART_EXPORT Dart_Handle Dart_AddGcEpilogueCallback( |
| 529 Dart_GcEpilogueCallback callback) { |
| 530 Isolate* isolate = Isolate::Current(); |
| 531 CHECK_ISOLATE(isolate); |
| 532 GcEpilogueCallbacks& callbacks = isolate->gc_epilogue_callbacks(); |
| 533 if (callbacks.Contains(callback)) { |
| 534 return Api::NewError( |
| 535 "%s permits only one instance of 'callback' to be present in the " |
| 536 "epilogue callback list.", |
| 537 CURRENT_FUNC); |
| 538 } |
| 539 callbacks.Add(callback); |
| 540 return Api::Success(); |
| 541 } |
| 542 |
| 543 |
| 544 DART_EXPORT Dart_Handle Dart_RemoveGcEpilogueCallback( |
| 545 Dart_GcEpilogueCallback callback) { |
| 546 Isolate* isolate = Isolate::Current(); |
| 547 CHECK_ISOLATE(isolate); |
| 548 GcEpilogueCallbacks& callbacks = isolate->gc_epilogue_callbacks(); |
| 549 if (!callbacks.Contains(callback)) { |
| 550 return Api::NewError( |
| 551 "%s expects 'callback' to be present in the epilogue callback list.", |
| 552 CURRENT_FUNC); |
| 553 } |
| 554 callbacks.Remove(callback); |
| 555 return Api::Success(); |
| 556 } |
| 557 |
| 558 |
| 493 // --- Initialization and Globals --- | 559 // --- Initialization and Globals --- |
| 494 | 560 |
| 495 | 561 |
| 496 DART_EXPORT bool Dart_Initialize(Dart_IsolateCreateCallback create, | 562 DART_EXPORT bool Dart_Initialize(Dart_IsolateCreateCallback create, |
| 497 Dart_IsolateInterruptCallback interrupt) { | 563 Dart_IsolateInterruptCallback interrupt) { |
| 498 return Dart::InitOnce(create, interrupt); | 564 return Dart::InitOnce(create, interrupt); |
| 499 } | 565 } |
| 500 | 566 |
| 501 DART_EXPORT bool Dart_SetVMFlags(int argc, const char** argv) { | 567 DART_EXPORT bool Dart_SetVMFlags(int argc, const char** argv) { |
| 502 return Flags::ProcessCommandLineFlags(argc, argv); | 568 return Flags::ProcessCommandLineFlags(argc, argv); |
| (...skipping 2240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2743 *buffer = NULL; | 2809 *buffer = NULL; |
| 2744 } | 2810 } |
| 2745 delete debug_region; | 2811 delete debug_region; |
| 2746 } else { | 2812 } else { |
| 2747 *buffer = NULL; | 2813 *buffer = NULL; |
| 2748 *buffer_size = 0; | 2814 *buffer_size = 0; |
| 2749 } | 2815 } |
| 2750 } | 2816 } |
| 2751 | 2817 |
| 2752 } // namespace dart | 2818 } // namespace dart |
| OLD | NEW |