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

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

Issue 2275803002: Assign external sizes to external strings and to external typed data created by the VM. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: sync Created 4 years, 3 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
« no previous file with comments | « no previous file | runtime/vm/clustered_snapshot.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 /* 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 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after
1802 * \return A valid handle if no error occurs during the operation. 1802 * \return A valid handle if no error occurs during the operation.
1803 */ 1803 */
1804 DART_EXPORT Dart_Handle Dart_StringStorageSize(Dart_Handle str, intptr_t* size); 1804 DART_EXPORT Dart_Handle Dart_StringStorageSize(Dart_Handle str, intptr_t* size);
1805 1805
1806 /** 1806 /**
1807 * Converts a String into an ExternalString. 1807 * Converts a String into an ExternalString.
1808 * The original object is morphed into an external string object. 1808 * The original object is morphed into an external string object.
1809 * 1809 *
1810 * \param array External space into which the string data will be 1810 * \param array External space into which the string data will be
1811 * copied into. This must not move. 1811 * copied into. This must not move.
1812 * \param length The size in bytes of the provided external space (array). 1812 * \param external_allocation_size The size in bytes of the provided external
1813 * space (array). Used to inform the garbage collector.
1813 * \param peer An external pointer to associate with this string. 1814 * \param peer An external pointer to associate with this string.
1814 * \param cback A callback to be called when this string is finalized. 1815 * \param cback A callback to be called when this string is finalized.
1815 * 1816 *
1816 * \return the converted ExternalString object if no error occurs. 1817 * \return the converted ExternalString object if no error occurs.
1817 * Otherwise returns an error handle. 1818 * Otherwise returns an error handle.
1818 * If the object is a valid string but if it cannot be externalized 1819 * If the object is a valid string but if it cannot be externalized
1819 * the string data is copied into the external space specified 1820 * the string data is copied into the external space specified
1820 * and the passed in peer is setup as a peer for this string object. 1821 * and the passed in peer is setup as a peer for this string object.
1821 * In this case the function returns the original String object as is. 1822 * In this case the function returns the original String object as is.
1822 * 1823 *
1823 * For example: 1824 * For example:
1824 * intptr_t size; 1825 * intptr_t size;
1825 * Dart_Handle result; 1826 * Dart_Handle result;
1826 * result = DartStringStorageSize(str, &size); 1827 * result = DartStringStorageSize(str, &size);
1827 * void* data = malloc(size); 1828 * void* data = malloc(size);
1828 * result = Dart_MakeExternalString(str, data, size, NULL, NULL); 1829 * result = Dart_MakeExternalString(str, data, size, NULL, NULL);
1829 * 1830 *
1830 */ 1831 */
1831 DART_EXPORT Dart_Handle Dart_MakeExternalString(Dart_Handle str, 1832 DART_EXPORT Dart_Handle Dart_MakeExternalString(
1832 void* array, 1833 Dart_Handle str,
1833 intptr_t length, 1834 void* array,
1834 void* peer, 1835 intptr_t external_allocation_size,
1835 Dart_PeerFinalizer cback); 1836 void* peer,
1837 Dart_PeerFinalizer cback);
1836 1838
1837 /** 1839 /**
1838 * Retrieves some properties associated with a String. 1840 * Retrieves some properties associated with a String.
1839 * Properties retrieved are: 1841 * Properties retrieved are:
1840 * - character size of the string (one or two byte) 1842 * - character size of the string (one or two byte)
1841 * - length of the string 1843 * - length of the string
1842 * - peer pointer of string if it is an external string. 1844 * - peer pointer of string if it is an external string.
1843 * \param str A String. 1845 * \param str A String.
1844 * \param char_size Returns the character size of the String. 1846 * \param char_size Returns the character size of the String.
1845 * \param str_len Returns the length of the String. 1847 * \param str_len Returns the length of the String.
(...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after
3177 /** 3179 /**
3178 * Returns whether the VM was initialized with a precompiled snapshot. Only 3180 * Returns whether the VM was initialized with a precompiled snapshot. Only
3179 * valid after Dart_Initialize. 3181 * valid after Dart_Initialize.
3180 * DEPRECATED. This is currently used to disable Platform.executable and 3182 * DEPRECATED. This is currently used to disable Platform.executable and
3181 * Platform.resolvedExecutable under precompilation to prevent process 3183 * Platform.resolvedExecutable under precompilation to prevent process
3182 * spawning tests from becoming fork-bombs. 3184 * spawning tests from becoming fork-bombs.
3183 */ 3185 */
3184 DART_EXPORT bool Dart_IsRunningPrecompiledCode(); 3186 DART_EXPORT bool Dart_IsRunningPrecompiledCode();
3185 3187
3186 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ 3188 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/clustered_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698