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

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

Issue 11362009: New APIs for external byte arrays (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 8 years, 1 month 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 // 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 #ifndef INCLUDE_DART_API_H_ 5 #ifndef INCLUDE_DART_API_H_
6 #define INCLUDE_DART_API_H_ 6 #define INCLUDE_DART_API_H_
7 7
8 /** \mainpage Dart Embedding API Reference 8 /** \mainpage Dart Embedding API Reference
9 * 9 *
10 * Dart is a class-based programming language for creating structured 10 * Dart is a class-based programming language for creating structured
(...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 intptr_t length); 1614 intptr_t length);
1615 1615
1616 // --- Byte Arrays --- 1616 // --- Byte Arrays ---
1617 1617
1618 /** 1618 /**
1619 * Is this object a ByteArray? 1619 * Is this object a ByteArray?
1620 */ 1620 */
1621 DART_EXPORT bool Dart_IsByteArray(Dart_Handle object); 1621 DART_EXPORT bool Dart_IsByteArray(Dart_Handle object);
1622 1622
1623 /** 1623 /**
1624 * Is this object an external ByteArray?
1625 *
1626 * An external ByteArray is a ByteArray which references a fixed array of
1627 * bytes which is external to the Dart heap.
1628 */
1629 DART_EXPORT bool Dart_IsByteArrayExternal(Dart_Handle object);
1630
1631 /**
1624 * Returns a ByteArray of the desired length. 1632 * Returns a ByteArray of the desired length.
1625 * 1633 *
1626 * \param length The length of the array. 1634 * \param length The length of the array.
1627 * 1635 *
1628 * \return The ByteArray object if no error occurs. Otherwise returns 1636 * \return The ByteArray object if no error occurs. Otherwise returns
1629 * an error handle. 1637 * an error handle.
1630 */ 1638 */
1631 DART_EXPORT Dart_Handle Dart_NewByteArray(intptr_t length); 1639 DART_EXPORT Dart_Handle Dart_NewByteArray(intptr_t length);
1632 1640
1633 /** 1641 /**
1634 * Returns a ByteArray which references an external array of 8-bit bytes. 1642 * Returns a ByteArray which references an external array of 8-bit bytes.
1635 * 1643 *
1636 * \param value An array of 8-bit bytes. This array must not move. 1644 * \param value An array of 8-bit bytes. This array must not move.
1637 * \param length The length of the array. 1645 * \param length The length of the array.
1638 * \param peer An external pointer to associate with this byte array. 1646 * \param peer An external pointer to associate with this byte array.
1639 * 1647 *
1640 * \return The ByteArray object if no error occurs. Otherwise returns 1648 * \return The ByteArray object if no error occurs. Otherwise returns
1641 * an error handle. 1649 * an error handle.
1642 */ 1650 */
1643 DART_EXPORT Dart_Handle Dart_NewExternalByteArray(uint8_t* data, 1651 DART_EXPORT Dart_Handle Dart_NewExternalByteArray(uint8_t* data,
1644 intptr_t length, 1652 intptr_t length,
1645 void* peer, 1653 void* peer,
1646 Dart_PeerFinalizer callback); 1654 Dart_PeerFinalizer callback);
1647 1655
1648 /** 1656 /**
1657 * Retrieves the data pointer associated with an external ByteArray.
1658 */
1659 DART_EXPORT Dart_Handle Dart_ExternalByteArrayGetData(Dart_Handle object,
1660 void** data);
1661
1662 /**
1649 * Retrieves the peer pointer associated with an external ByteArray. 1663 * Retrieves the peer pointer associated with an external ByteArray.
1650 */ 1664 */
1651 DART_EXPORT Dart_Handle Dart_ExternalByteArrayGetPeer(Dart_Handle object, 1665 DART_EXPORT Dart_Handle Dart_ExternalByteArrayGetPeer(Dart_Handle object,
1652 void** peer); 1666 void** peer);
1653 1667
1654 /** 1668 /**
1655 * Gets an int8_t at some byte offset in a ByteArray. 1669 * Gets an int8_t at some byte offset in a ByteArray.
1656 * 1670 *
1657 * If the byte offset is out of bounds, an error occurs. 1671 * If the byte offset is out of bounds, an error occurs.
1658 * 1672 *
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
2768 * 2782 *
2769 * \param object An object. 2783 * \param object An object.
2770 * \param peer A value to store in the peer field. 2784 * \param peer A value to store in the peer field.
2771 * 2785 *
2772 * \return Returns an error if 'object' is a subtype of Null, num, or 2786 * \return Returns an error if 'object' is a subtype of Null, num, or
2773 * bool. 2787 * bool.
2774 */ 2788 */
2775 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer); 2789 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer);
2776 2790
2777 #endif // INCLUDE_DART_API_H_ 2791 #endif // INCLUDE_DART_API_H_
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