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

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: 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') | runtime/vm/dart_api_impl.cc » ('J')
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 1602 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 uint8_t* native_array, 1613 uint8_t* native_array,
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
cshapiro 2012/11/01 00:40:19 Remove this line. 1 space between definitions in
Søren Gjesse 2012/11/01 07:46:03 Done.
1624 /**
1625 * Is this object an external ByteArray?
1626 *
1627 * An external ByteArray is a ByteArray which references a fixed array of
1628 * bytes which is external to the Dart heap.
1629 */
1630 DART_EXPORT bool Dart_IsExternalByteArray(Dart_Handle object);
cshapiro 2012/11/01 00:40:19 I would prefer this to be named Dart_IsByteArrayEx
Søren Gjesse 2012/11/01 07:46:03 Done.
1631
1632
cshapiro 2012/11/01 00:40:19 Remove this line. 1 space between definitions in
Søren Gjesse 2012/11/01 07:46:03 Done.
1623 /** 1633 /**
1624 * Returns a ByteArray of the desired length. 1634 * Returns a ByteArray of the desired length.
1625 * 1635 *
1626 * \param length The length of the array. 1636 * \param length The length of the array.
1627 * 1637 *
1628 * \return The ByteArray object if no error occurs. Otherwise returns 1638 * \return The ByteArray object if no error occurs. Otherwise returns
1629 * an error handle. 1639 * an error handle.
1630 */ 1640 */
1631 DART_EXPORT Dart_Handle Dart_NewByteArray(intptr_t length); 1641 DART_EXPORT Dart_Handle Dart_NewByteArray(intptr_t length);
1632 1642
1643
cshapiro 2012/11/01 00:40:19 1 space between definitions in this header.
Søren Gjesse 2012/11/01 07:46:03 Done.
1633 /** 1644 /**
1634 * Returns a ByteArray which references an external array of 8-bit bytes. 1645 * Returns a ByteArray which references an external array of 8-bit bytes.
1635 * 1646 *
1636 * \param value An array of 8-bit bytes. This array must not move. 1647 * \param value An array of 8-bit bytes. This array must not move.
1637 * \param length The length of the array. 1648 * \param length The length of the array.
1638 * \param peer An external pointer to associate with this byte array. 1649 * \param peer An external pointer to associate with this byte array.
1639 * 1650 *
1640 * \return The ByteArray object if no error occurs. Otherwise returns 1651 * \return The ByteArray object if no error occurs. Otherwise returns
1641 * an error handle. 1652 * an error handle.
1642 */ 1653 */
1643 DART_EXPORT Dart_Handle Dart_NewExternalByteArray(uint8_t* data, 1654 DART_EXPORT Dart_Handle Dart_NewExternalByteArray(uint8_t* data,
1644 intptr_t length, 1655 intptr_t length,
1645 void* peer, 1656 void* peer,
1646 Dart_PeerFinalizer callback); 1657 Dart_PeerFinalizer callback);
1647 1658
1648 /** 1659 /**
1660 * Retrieves the data pointer associated with an external ByteArray.
1661 */
1662 DART_EXPORT Dart_Handle Dart_ExternalByteArrayGetData(Dart_Handle object,
1663 void** data);
1664
1665
cshapiro 2012/11/01 00:40:19 1 space between definitions in this header.
Søren Gjesse 2012/11/01 07:46:03 Done.
1666 /**
1649 * Retrieves the peer pointer associated with an external ByteArray. 1667 * Retrieves the peer pointer associated with an external ByteArray.
1650 */ 1668 */
1651 DART_EXPORT Dart_Handle Dart_ExternalByteArrayGetPeer(Dart_Handle object, 1669 DART_EXPORT Dart_Handle Dart_ExternalByteArrayGetPeer(Dart_Handle object,
1652 void** peer); 1670 void** peer);
1653 1671
1654 /** 1672 /**
1655 * Gets an int8_t at some byte offset in a ByteArray. 1673 * Gets an int8_t at some byte offset in a ByteArray.
1656 * 1674 *
1657 * If the byte offset is out of bounds, an error occurs. 1675 * If the byte offset is out of bounds, an error occurs.
1658 * 1676 *
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
2768 * 2786 *
2769 * \param object An object. 2787 * \param object An object.
2770 * \param peer A value to store in the peer field. 2788 * \param peer A value to store in the peer field.
2771 * 2789 *
2772 * \return Returns an error if 'object' is a subtype of Null, num, or 2790 * \return Returns an error if 'object' is a subtype of Null, num, or
2773 * bool. 2791 * bool.
2774 */ 2792 */
2775 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer); 2793 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer);
2776 2794
2777 #endif // INCLUDE_DART_API_H_ 2795 #endif // INCLUDE_DART_API_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.cc » ('j') | runtime/vm/dart_api_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698