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

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

Issue 12093071: - Change the layout of external typed array objects to avoid the extra indirection when accessing e… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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 | « runtime/bin/io_buffer.cc ('k') | runtime/lib/byte_array.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 940 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 struct _Dart_CObject** values; 951 struct _Dart_CObject** values;
952 } as_array; 952 } as_array;
953 struct { 953 struct {
954 int length; 954 int length;
955 uint8_t* values; 955 uint8_t* values;
956 } as_byte_array; 956 } as_byte_array;
957 struct { 957 struct {
958 int length; 958 int length;
959 uint8_t* data; 959 uint8_t* data;
960 void* peer; 960 void* peer;
961 Dart_PeerFinalizer callback; 961 Dart_WeakPersistentHandleFinalizer callback;
962 } as_external_byte_array; 962 } as_external_byte_array;
963 } value; 963 } value;
964 } Dart_CObject; 964 } Dart_CObject;
965 965
966 /** 966 /**
967 * Posts a message on some port. The message will contain the 967 * Posts a message on some port. The message will contain the
968 * Dart_CObject object graph rooted in 'message'. 968 * Dart_CObject object graph rooted in 'message'.
969 * 969 *
970 * While the message is being sent the state of the graph of 970 * While the message is being sent the state of the graph of
971 * Dart_CObject structures rooted in 'message' should not be accessed, 971 * Dart_CObject structures rooted in 'message' should not be accessed,
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
1657 DART_EXPORT Dart_Handle Dart_NewByteArray(intptr_t length); 1657 DART_EXPORT Dart_Handle Dart_NewByteArray(intptr_t length);
1658 1658
1659 /** 1659 /**
1660 * Returns a ByteArray which references an external array of 8-bit bytes. 1660 * Returns a ByteArray which references an external array of 8-bit bytes.
1661 * 1661 *
1662 * \param value An array of 8-bit bytes. This array must not move. 1662 * \param value An array of 8-bit bytes. This array must not move.
1663 * \param length The length of the array. 1663 * \param length The length of the array.
1664 * \param peer An external pointer to associate with this byte array. 1664 * \param peer An external pointer to associate with this byte array.
1665 * 1665 *
1666 * \return The ByteArray object if no error occurs. Otherwise returns 1666 * \return The ByteArray object if no error occurs. Otherwise returns
1667 * an error handle. 1667 * an error handle. The ByteArray object is returned in a
1668 * WeakPersistentHandle which needs to be deleted in the specified callback
1669 * using Dart_DeletePersistentHandle.
1668 */ 1670 */
1669 DART_EXPORT Dart_Handle Dart_NewExternalByteArray(uint8_t* data, 1671 DART_EXPORT Dart_Handle Dart_NewExternalByteArray(
1670 intptr_t length, 1672 uint8_t* data,
1671 void* peer, 1673 intptr_t length,
1672 Dart_PeerFinalizer callback); 1674 void* peer,
1675 Dart_WeakPersistentHandleFinalizer callback);
1673 1676
1674 /** 1677 /**
1675 * Returns a clamped ByteArray which references an external array of 1678 * Returns a clamped ByteArray which references an external array of
1676 * 8-bit bytes. 1679 * 8-bit bytes.
1677 * A clamped ByteArray differs from ByteArray above in the indexed store 1680 * A clamped ByteArray differs from ByteArray above in the indexed store
1678 * operation where negative values are clamped to 0 and values above 255 are 1681 * operation where negative values are clamped to 0 and values above 255 are
1679 * clamped to 255. 1682 * clamped to 255.
1680 * 1683 *
1681 * \param value An array of 8-bit bytes. This array must not move. 1684 * \param value An array of 8-bit bytes. This array must not move.
1682 * \param length The length of the array. 1685 * \param length The length of the array.
1683 * \param peer An external pointer to associate with this byte array. 1686 * \param peer An external pointer to associate with this byte array.
1684 * 1687 *
1685 * \return The clamped ByteArray object if no error occurs. Otherwise returns 1688 * \return The clamped ByteArray object if no error occurs. Otherwise returns
1686 * an error handle. 1689 * an error handle. The clamped ByteArray object is returned in a
1690 * WeakPersistentHandle which needs to be deleted in the specified callback
1691 * using Dart_DeletePersistentHandle.
1687 */ 1692 */
1688 DART_EXPORT Dart_Handle Dart_NewExternalClampedByteArray( 1693 DART_EXPORT Dart_Handle Dart_NewExternalClampedByteArray(
1689 uint8_t* data, 1694 uint8_t* data,
1690 intptr_t length, 1695 intptr_t length,
1691 void* peer, 1696 void* peer,
1692 Dart_PeerFinalizer callback); 1697 Dart_WeakPersistentHandleFinalizer callback);
1693 1698
1694 /** 1699 /**
1695 * Retrieves the data pointer associated with an external ByteArray. 1700 * Retrieves the data pointer associated with an external ByteArray.
1696 */ 1701 */
1697 DART_EXPORT Dart_Handle Dart_ExternalByteArrayGetData(Dart_Handle object, 1702 DART_EXPORT Dart_Handle Dart_ExternalByteArrayGetData(Dart_Handle object,
1698 void** data); 1703 void** data);
1699 1704
1700 /** 1705 /**
1701 * Retrieves the peer pointer associated with an external ByteArray. 1706 * Retrieves the peer pointer associated with an external ByteArray.
1702 */ 1707 */
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
2827 * 2832 *
2828 * \param object An object. 2833 * \param object An object.
2829 * \param peer A value to store in the peer field. 2834 * \param peer A value to store in the peer field.
2830 * 2835 *
2831 * \return Returns an error if 'object' is a subtype of Null, num, or 2836 * \return Returns an error if 'object' is a subtype of Null, num, or
2832 * bool. 2837 * bool.
2833 */ 2838 */
2834 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer); 2839 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer);
2835 2840
2836 #endif // INCLUDE_DART_API_H_ 2841 #endif // INCLUDE_DART_API_H_
OLDNEW
« no previous file with comments | « runtime/bin/io_buffer.cc ('k') | runtime/lib/byte_array.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698