| 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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 | 452 |
| 453 DART_EXPORT bool Dart_IsWeakPersistentHandle(Dart_Handle object) { | 453 DART_EXPORT bool Dart_IsWeakPersistentHandle(Dart_Handle object) { |
| 454 Isolate* isolate = Isolate::Current(); | 454 Isolate* isolate = Isolate::Current(); |
| 455 CHECK_ISOLATE(isolate); | 455 CHECK_ISOLATE(isolate); |
| 456 ApiState* state = isolate->api_state(); | 456 ApiState* state = isolate->api_state(); |
| 457 ASSERT(state != NULL); | 457 ASSERT(state != NULL); |
| 458 return state->IsValidWeakPersistentHandle(object); | 458 return state->IsValidWeakPersistentHandle(object); |
| 459 } | 459 } |
| 460 | 460 |
| 461 | 461 |
| 462 DART_EXPORT Dart_Handle Dart_NewWeakReferenceSet(Dart_Handle* keys, |
| 463 intptr_t num_keys, |
| 464 Dart_Handle* values, |
| 465 intptr_t num_values) { |
| 466 Isolate* isolate = Isolate::Current(); |
| 467 CHECK_ISOLATE(isolate); |
| 468 ApiState* state = isolate->api_state(); |
| 469 ASSERT(state != NULL); |
| 470 if (keys == NULL) { |
| 471 return Api::NewError("%s expects argument 'keys' to be non-null.", |
| 472 CURRENT_FUNC); |
| 473 } |
| 474 if (num_keys <= 0) { |
| 475 return Api::NewError( |
| 476 "%s expects argument 'num_keys' to be greater than 0.", |
| 477 CURRENT_FUNC); |
| 478 } |
| 479 if (values == NULL) { |
| 480 return Api::NewError("%s expects argument 'values' to be non-null.", |
| 481 CURRENT_FUNC); |
| 482 } |
| 483 if (num_values <= 0) { |
| 484 return Api::NewError( |
| 485 "%s expects argument 'num_values' to be greater than 0.", |
| 486 CURRENT_FUNC); |
| 487 } |
| 488 |
| 489 WeakReference* reference = new WeakReference(keys, num_keys, |
| 490 values, num_values); |
| 491 state->DelayWeakReference(reference); |
| 492 return Api::Success(); |
| 493 } |
| 494 |
| 462 // --- Initialization and Globals --- | 495 // --- Initialization and Globals --- |
| 463 | 496 |
| 464 | 497 |
| 465 DART_EXPORT bool Dart_Initialize(Dart_IsolateCreateCallback create, | 498 DART_EXPORT bool Dart_Initialize(Dart_IsolateCreateCallback create, |
| 466 Dart_IsolateInterruptCallback interrupt) { | 499 Dart_IsolateInterruptCallback interrupt) { |
| 467 return Dart::InitOnce(create, interrupt); | 500 return Dart::InitOnce(create, interrupt); |
| 468 } | 501 } |
| 469 | 502 |
| 470 DART_EXPORT bool Dart_SetVMFlags(int argc, const char** argv) { | 503 DART_EXPORT bool Dart_SetVMFlags(int argc, const char** argv) { |
| 471 return Flags::ProcessCommandLineFlags(argc, argv); | 504 return Flags::ProcessCommandLineFlags(argc, argv); |
| (...skipping 2233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2705 *buffer = NULL; | 2738 *buffer = NULL; |
| 2706 } | 2739 } |
| 2707 delete debug_region; | 2740 delete debug_region; |
| 2708 } else { | 2741 } else { |
| 2709 *buffer = NULL; | 2742 *buffer = NULL; |
| 2710 *buffer_size = 0; | 2743 *buffer_size = 0; |
| 2711 } | 2744 } |
| 2712 } | 2745 } |
| 2713 | 2746 |
| 2714 } // namespace dart | 2747 } // namespace dart |
| OLD | NEW |