Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: runtime/include/dart_api.h

Issue 238063011: Modify the Weak Reference Set creation API to make it easier to create (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 * Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 * for details. All rights reserved. Use of this source code is governed by a 3 * for details. All rights reserved. Use of this source code is governed by a
4 * BSD-style license that can be found in the LICENSE file. 4 * BSD-style license that can be found in the LICENSE file.
5 */ 5 */
6 6
7 #ifndef INCLUDE_DART_API_H_ 7 #ifndef INCLUDE_DART_API_H_
8 #define INCLUDE_DART_API_H_ 8 #define INCLUDE_DART_API_H_
9 9
10 /** \mainpage Dart Embedding API Reference 10 /** \mainpage Dart Embedding API Reference
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 Dart_WeakPersistentHandleFinalizer callback); 520 Dart_WeakPersistentHandleFinalizer callback);
521 521
522 /** 522 /**
523 * Is this object a prologue weak persistent handle? 523 * Is this object a prologue weak persistent handle?
524 * 524 *
525 * Requires there to be a current isolate. 525 * Requires there to be a current isolate.
526 */ 526 */
527 DART_EXPORT bool Dart_IsPrologueWeakPersistentHandle( 527 DART_EXPORT bool Dart_IsPrologueWeakPersistentHandle(
528 Dart_WeakPersistentHandle object); 528 Dart_WeakPersistentHandle object);
529 529
530 typedef struct _Dart_WeakReferenceSetBuilder* Dart_WeakReferenceSetBuilder;
531 typedef struct _Dart_WeakReferenceSet* Dart_WeakReferenceSet;
532
533 /**
534 * Constructs a weak references set builder.
535 *
536 * \returns a pointer to the weak reference set builder if successful.
537 * Otherwise, returns NULL.
538 */
539 DART_EXPORT Dart_WeakReferenceSetBuilder Dart_NewWeakReferenceSetBuilder();
540
530 /** 541 /**
531 * Constructs a set of weak references from the Cartesian product of 542 * Constructs a set of weak references from the Cartesian product of
532 * the objects in the key set and the objects in values set. 543 * the objects in the key set and the objects in values set.
533 * 544 *
534 * \param keys A set of object references. These references will be 545 * \param set_builder The weak references set builder which was created
546 * using Dart_NewWeakReferenceSetBuilder().
547 * \param key An object reference. This references will be
535 * considered weak by the garbage collector. 548 * considered weak by the garbage collector.
536 * \param num_keys the number of objects in the keys set. 549 * \param value An object reference. This reference will be
537 * \param values A set of object references. These references will be
538 * considered weak by garbage collector unless any object reference 550 * considered weak by garbage collector unless any object reference
539 * in 'keys' is found to be strong. 551 * in 'keys' is found to be strong.
540 * \param num_values the size of the values set
541 * 552 *
542 * \return Success if the weak reference set could be created. 553 * \return a pointer to the weak reference set if successful.
543 * Otherwise, returns an error handle. 554 * Otherwise, returns NULL.
544 */ 555 */
545 DART_EXPORT Dart_Handle Dart_NewWeakReferenceSet( 556 DART_EXPORT Dart_WeakReferenceSet Dart_NewWeakReferenceSet(
546 Dart_WeakPersistentHandle* keys, 557 Dart_WeakReferenceSetBuilder set_builder,
547 intptr_t num_keys, 558 Dart_WeakPersistentHandle key,
548 Dart_WeakPersistentHandle* values, 559 Dart_WeakPersistentHandle value);
549 intptr_t num_values); 560
561 /**
562 * Append the pair of key/value object references to the weak references set.
563 *
564 * \param reference_set A weak references set into which the pair of key/value
565 * needs to be added.
566 * \param key An object reference. This references will be
567 * considered weak by the garbage collector.
568 * \param value An object reference. This reference will be
569 * considered weak by garbage collector unless any object reference
570 * in 'keys' is found to be strong.
571 *
572 * \return Success if the prologue weak persistent handle was created.
573 * Otherwise, returns an error.
574 */
575 DART_EXPORT Dart_Handle Dart_AppendToWeakReferenceSet(
576 Dart_WeakReferenceSet reference_set,
577 Dart_WeakPersistentHandle key,
578 Dart_WeakPersistentHandle value);
579
580 /**
581 * Append the key object reference to the weak references set.
582 *
583 * \param reference_set A weak references set into which the key
584 * needs to be added.
585 * \param key An object reference. This references will be
586 * considered weak by the garbage collector.
587 *
588 * \return Success if the prologue weak persistent handle was created.
589 * Otherwise, returns an error.
590 */
591 DART_EXPORT Dart_Handle Dart_AppendKeyToWeakReferenceSet(
592 Dart_WeakReferenceSet reference_set,
593 Dart_WeakPersistentHandle key);
594
595 /**
596 * Append the value object reference to the weak references set.
597 *
598 * \param reference_set A weak references set into which the key
599 * needs to be added.
600 * \param value An object reference. This references will be
601 * considered weak by the garbage collector.
602 *
603 * \return Success if the prologue weak persistent handle was created.
604 * Otherwise, returns an error.
605 */
606 DART_EXPORT Dart_Handle Dart_AppendValueToWeakReferenceSet(
607 Dart_WeakReferenceSet reference_set,
608 Dart_WeakPersistentHandle value);
550 609
551 610
552 /* 611 /*
553 * ============================ 612 * ============================
554 * Garbage Collection Callbacks 613 * Garbage Collection Callbacks
555 * ============================ 614 * ============================
556 */ 615 */
557 616
558 /** 617 /**
559 * Callbacks signal the beginning and end of a garbage collection. 618 * Callbacks signal the beginning and end of a garbage collection.
(...skipping 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after
2568 * NOTE: If multiple callbacks with the same name are registered, only the 2627 * NOTE: If multiple callbacks with the same name are registered, only the
2569 * last callback registered will be remembered. 2628 * last callback registered will be remembered.
2570 */ 2629 */
2571 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( 2630 DART_EXPORT void Dart_RegisterRootServiceRequestCallback(
2572 const char* name, 2631 const char* name,
2573 Dart_ServiceRequestCallback callback, 2632 Dart_ServiceRequestCallback callback,
2574 void* user_data); 2633 void* user_data);
2575 2634
2576 2635
2577 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ 2636 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698