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

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

Issue 187113003: Track external allocated memory for weak persistent handles. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 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
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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 * persistent handle and the peer as arguments. This gives the native code the 427 * persistent handle and the peer as arguments. This gives the native code the
428 * ability to cleanup data associated with the object and to delete the weak 428 * ability to cleanup data associated with the object and to delete the weak
429 * persistent handle. It is illegal to call into the VM from the callback, 429 * persistent handle. It is illegal to call into the VM from the callback,
430 * except to delete the weak persistent handle. 430 * except to delete the weak persistent handle.
431 * 431 *
432 * Requires there to be a current isolate. 432 * Requires there to be a current isolate.
433 * 433 *
434 * \param object An object. 434 * \param object An object.
435 * \param peer A pointer to a native object or NULL. This value is 435 * \param peer A pointer to a native object or NULL. This value is
436 * provided to callback when it is invoked. 436 * provided to callback when it is invoked.
437 * \param external_allocation_size The number of externally allocated
438 * bytes for peer. Used to inform the garbage collector.
437 * \param callback A function pointer that will be invoked sometime 439 * \param callback A function pointer that will be invoked sometime
438 * after the object is garbage collected. 440 * after the object is garbage collected.
439 * 441 *
440 * \return Success if the weak persistent handle was 442 * \return Success if the weak persistent handle was
441 * created. Otherwise, returns an error. 443 * created. Otherwise, returns an error.
442 */ 444 */
443 DART_EXPORT Dart_WeakPersistentHandle Dart_NewWeakPersistentHandle( 445 DART_EXPORT Dart_WeakPersistentHandle Dart_NewWeakPersistentHandle(
444 Dart_Handle object, 446 Dart_Handle object,
445 void* peer, 447 void* peer,
448 intptr_t external_allocation_size,
446 Dart_WeakPersistentHandleFinalizer callback); 449 Dart_WeakPersistentHandleFinalizer callback);
447 450
448 DART_EXPORT void Dart_DeleteWeakPersistentHandle( 451 DART_EXPORT void Dart_DeleteWeakPersistentHandle(
449 Dart_WeakPersistentHandle object); 452 Dart_WeakPersistentHandle object);
450 453
451 /** 454 /**
452 * Allocates a prologue weak persistent handle for an object. 455 * Allocates a prologue weak persistent handle for an object.
453 * 456 *
454 * Prologue weak persistent handles are similar to weak persistent 457 * Prologue weak persistent handles are similar to weak persistent
455 * handles but exhibit different behavior during garbage collections 458 * handles but exhibit different behavior during garbage collections
456 * that invoke the prologue and epilogue callbacks. While weak 459 * that invoke the prologue and epilogue callbacks. While weak
457 * persistent handles always weakly reference their referents, 460 * persistent handles always weakly reference their referents,
458 * prologue weak persistent handles weakly reference their referents 461 * prologue weak persistent handles weakly reference their referents
459 * only during a garbage collection that invokes the prologue and 462 * only during a garbage collection that invokes the prologue and
460 * epilogue callbacks. During all other garbage collections, prologue 463 * epilogue callbacks. During all other garbage collections, prologue
461 * weak persistent handles strongly reference their referents. 464 * weak persistent handles strongly reference their referents.
462 * 465 *
463 * This handle has the lifetime of the current isolate unless it is 466 * This handle has the lifetime of the current isolate unless it is
464 * explicitly deallocated by calling Dart_DeleteWeakPersistentHandle. 467 * explicitly deallocated by calling Dart_DeleteWeakPersistentHandle.
465 * 468 *
466 * Requires there to be a current isolate. 469 * Requires there to be a current isolate.
467 * 470 *
468 * \param object An object. 471 * \param object An object.
469 * \param peer A pointer to a native object or NULL. This value is 472 * \param peer A pointer to a native object or NULL. This value is
470 * provided to callback when it is invoked. 473 * provided to callback when it is invoked.
474 * \param external_allocation_size The number of externally allocated
475 * bytes for peer. Used to inform the garbage collector.
471 * \param callback A function pointer that will be invoked sometime 476 * \param callback A function pointer that will be invoked sometime
472 * after the object is garbage collected. 477 * after the object is garbage collected.
473 * 478 *
474 * \return Success if the prologue weak persistent handle was created. 479 * \return Success if the prologue weak persistent handle was created.
475 * Otherwise, returns an error. 480 * Otherwise, returns an error.
476 */ 481 */
477 DART_EXPORT Dart_WeakPersistentHandle Dart_NewPrologueWeakPersistentHandle( 482 DART_EXPORT Dart_WeakPersistentHandle Dart_NewPrologueWeakPersistentHandle(
478 Dart_Handle object, 483 Dart_Handle object,
479 void* peer, 484 void* peer,
485 intptr_t external_allocation_size,
480 Dart_WeakPersistentHandleFinalizer callback); 486 Dart_WeakPersistentHandleFinalizer callback);
481 487
482 /** 488 /**
483 * Is this object a prologue weak persistent handle? 489 * Is this object a prologue weak persistent handle?
484 * 490 *
485 * Requires there to be a current isolate. 491 * Requires there to be a current isolate.
486 */ 492 */
487 DART_EXPORT bool Dart_IsPrologueWeakPersistentHandle( 493 DART_EXPORT bool Dart_IsPrologueWeakPersistentHandle(
488 Dart_WeakPersistentHandle object); 494 Dart_WeakPersistentHandle object);
489 495
(...skipping 2053 matching lines...) Expand 10 before | Expand all | Expand 10 after
2543 * NOTE: If multiple callbacks with the same name are registered, only the 2549 * NOTE: If multiple callbacks with the same name are registered, only the
2544 * last callback registered will be remembered. 2550 * last callback registered will be remembered.
2545 */ 2551 */
2546 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( 2552 DART_EXPORT void Dart_RegisterRootServiceRequestCallback(
2547 const char* name, 2553 const char* name,
2548 Dart_ServiceRequestCallback callback, 2554 Dart_ServiceRequestCallback callback,
2549 void* user_data); 2555 void* user_data);
2550 2556
2551 2557
2552 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ 2558 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698