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

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

Issue 22980022: Setup a peer for read only strings that are not externalized in (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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/benchmark_test.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 /* 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 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1403 * \param utf32_array An array of UTF-32 encoded characters. 1403 * \param utf32_array An array of UTF-32 encoded characters.
1404 * \param length The length of the codepoints array. 1404 * \param length The length of the codepoints array.
1405 * 1405 *
1406 * \return The String object if no error occurs. Otherwise returns 1406 * \return The String object if no error occurs. Otherwise returns
1407 * an error handle. 1407 * an error handle.
1408 */ 1408 */
1409 DART_EXPORT Dart_Handle Dart_NewStringFromUTF32(const int32_t* utf32_array, 1409 DART_EXPORT Dart_Handle Dart_NewStringFromUTF32(const int32_t* utf32_array,
1410 intptr_t length); 1410 intptr_t length);
1411 1411
1412 /** 1412 /**
1413 * Retrieves the peer pointer associated with an external String.
1414 */
1415 DART_EXPORT Dart_Handle Dart_ExternalStringGetPeer(Dart_Handle object,
1416 void** peer);
1417
1418 /**
1419 * Returns a String which references an external array of 1413 * Returns a String which references an external array of
1420 * Latin-1 (ISO-8859-1) encoded characters. 1414 * Latin-1 (ISO-8859-1) encoded characters.
1421 * 1415 *
1422 * \param latin1_array Array of Latin-1 encoded characters. This must not move. 1416 * \param latin1_array Array of Latin-1 encoded characters. This must not move.
1423 * \param length The length of the characters array. 1417 * \param length The length of the characters array.
1424 * \param peer An external pointer to associate with this string. 1418 * \param peer An external pointer to associate with this string.
1425 * \param cback A callback to be called when this string is finalized. 1419 * \param cback A callback to be called when this string is finalized.
1426 * 1420 *
1427 * \return The String object if no error occurs. Otherwise returns 1421 * \return The String object if no error occurs. Otherwise returns
1428 * an error handle. 1422 * an error handle.
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1529 * 1523 *
1530 * \param array External space into which the string data will be 1524 * \param array External space into which the string data will be
1531 * copied into. This must not move. 1525 * copied into. This must not move.
1532 * \param length The size in bytes of the provided external space (array). 1526 * \param length The size in bytes of the provided external space (array).
1533 * \param peer An external pointer to associate with this string. 1527 * \param peer An external pointer to associate with this string.
1534 * \param cback A callback to be called when this string is finalized. 1528 * \param cback A callback to be called when this string is finalized.
1535 * 1529 *
1536 * \return the converted ExternalString object if no error occurs. 1530 * \return the converted ExternalString object if no error occurs.
1537 * Otherwise returns an error handle. 1531 * Otherwise returns an error handle.
1538 * If the object is a valid string but if it cannot be externalized 1532 * If the object is a valid string but if it cannot be externalized
1539 * then Dart_Null() is returned and the string data is copied into 1533 * the string data is copied into the external space specified
1540 * the external space specified. 1534 * and the passed in peer is setup as a peer for this string object.
1535 * In this case the function returns the original String object as is.
1541 * 1536 *
1542 * For example: 1537 * For example:
1543 * intptr_t size; 1538 * intptr_t size;
1544 * Dart_Handle result; 1539 * Dart_Handle result;
1545 * result = DartStringStorageSize(str, &size); 1540 * result = DartStringStorageSize(str, &size);
1546 * void* data = malloc(size); 1541 * void* data = malloc(size);
1547 * result = Dart_MakeExternalString(str, data, size, NULL, NULL); 1542 * result = Dart_MakeExternalString(str, data, size, NULL, NULL);
1548 * 1543 *
1549 */ 1544 */
1550 DART_EXPORT Dart_Handle Dart_MakeExternalString(Dart_Handle str, 1545 DART_EXPORT Dart_Handle Dart_MakeExternalString(Dart_Handle str,
1551 void* array, 1546 void* array,
1552 intptr_t length, 1547 intptr_t length,
1553 void* peer, 1548 void* peer,
1554 Dart_PeerFinalizer cback); 1549 Dart_PeerFinalizer cback);
1555 1550
1556 /** 1551 /**
1557 * Retrieves some properties associated with a String. 1552 * Retrieves some properties associated with a String.
1558 * Properties retrieved are: 1553 * Properties retrieved are:
1559 * - character size of the string (one or two byte) 1554 * - character size of the string (one or two byte)
1560 * - length of the string 1555 * - length of the string
1561 * - peer pointer of string if it is an external string. 1556 * - peer pointer of string if it is an external string.
1562 * \param str A String. 1557 * \param str A String.
1563 * \param char_size Returns the character size of the String. 1558 * \param char_size Returns the character size of the String.
1564 * \param str_len Returns the length of the String. 1559 * \param str_len Returns the length of the String.
1565 * \param peer Returns the peer pointer if the String is an external String. 1560 * \param peer Returns the peer pointer if the String is an external String.
Ivan Posva 2013/08/22 15:44:51 Please update this comment.
siva 2013/08/22 16:57:08 Done.
1566 * \return Success if no error occurs. Otherwise returns 1561 * \return Success if no error occurs. Otherwise returns
1567 * an error handle. 1562 * an error handle.
1568 */ 1563 */
1569 DART_EXPORT Dart_Handle Dart_StringGetProperties(Dart_Handle str, 1564 DART_EXPORT Dart_Handle Dart_StringGetProperties(Dart_Handle str,
1570 intptr_t* char_size, 1565 intptr_t* char_size,
1571 intptr_t* str_len, 1566 intptr_t* str_len,
1572 void** peer); 1567 void** peer);
1573 1568
1574 /* 1569 /*
1575 * ===== 1570 * =====
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
1994 /** 1989 /**
1995 * Gets the native field of the receiver. 1990 * Gets the native field of the receiver.
1996 */ 1991 */
1997 DART_EXPORT Dart_Handle Dart_GetNativeReceiver(Dart_NativeArguments args, 1992 DART_EXPORT Dart_Handle Dart_GetNativeReceiver(Dart_NativeArguments args,
1998 intptr_t* value); 1993 intptr_t* value);
1999 1994
2000 /** 1995 /**
2001 * Gets a string native argument at some index. 1996 * Gets a string native argument at some index.
2002 * \param args Native arguments structure. 1997 * \param args Native arguments structure.
2003 * \param arg_index Index of the desired argument in the structure above. 1998 * \param arg_index Index of the desired argument in the structure above.
2004 * \param peer Returns the peer pointer if the String is an external String. 1999 * \param peer Returns the peer pointer if the String is an external String.
Ivan Posva 2013/08/22 15:44:51 Please update this comment.
siva 2013/08/22 16:57:08 Done.
2005 * \return the String object if no error occurs. Otherwise returns 2000 * \return the String object if no error occurs. Otherwise returns
2006 * an error handle. 2001 * an error handle.
2007 */ 2002 */
2008 DART_EXPORT Dart_Handle Dart_GetNativeStringArgument(Dart_NativeArguments args, 2003 DART_EXPORT Dart_Handle Dart_GetNativeStringArgument(Dart_NativeArguments args,
2009 int arg_index, 2004 int arg_index,
2010 void** peer); 2005 void** peer);
2011 2006
2012 /** 2007 /**
2013 * Sets the return value for a native function. 2008 * Sets the return value for a native function.
2014 */ 2009 */
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
2253 * 2248 *
2254 * \param object An object. 2249 * \param object An object.
2255 * \param peer A value to store in the peer field. 2250 * \param peer A value to store in the peer field.
2256 * 2251 *
2257 * \return Returns an error if 'object' is a subtype of Null, num, or 2252 * \return Returns an error if 'object' is a subtype of Null, num, or
2258 * bool. 2253 * bool.
2259 */ 2254 */
2260 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer); 2255 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer);
2261 2256
2262 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ 2257 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/benchmark_test.cc » ('j') | runtime/vm/dart_api_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698