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

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

Issue 8383029: Implement external strings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Finish native peer support Created 9 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/lib/string.dart » ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 #ifdef __cplusplus 8 #ifdef __cplusplus
9 #define DART_EXTERN_C extern "C" 9 #define DART_EXTERN_C extern "C"
10 #else 10 #else
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // TODO(iposva): Pass a specification of the app file being spawned. 91 // TODO(iposva): Pass a specification of the app file being spawned.
92 typedef void* (*Dart_IsolateInitCallback)(void* data); 92 typedef void* (*Dart_IsolateInitCallback)(void* data);
93 93
94 typedef void (*Dart_NativeFunction)(Dart_NativeArguments arguments); 94 typedef void (*Dart_NativeFunction)(Dart_NativeArguments arguments);
95 typedef Dart_NativeFunction (*Dart_NativeEntryResolver)(Dart_Handle name, 95 typedef Dart_NativeFunction (*Dart_NativeEntryResolver)(Dart_Handle name,
96 int num_of_arguments); 96 int num_of_arguments);
97 typedef Dart_Result (*Dart_LibraryTagHandler)(Dart_LibraryTag tag, 97 typedef Dart_Result (*Dart_LibraryTagHandler)(Dart_LibraryTag tag,
98 Dart_Handle library, 98 Dart_Handle library,
99 Dart_Handle url); 99 Dart_Handle url);
100 100
101 typedef void (*Dart_ExternalString8Finalizer)(uint8_t* codepoints,
Anton Muhin 2011/10/26 14:11:53 I think codepoints may go away---embedder should b
102 void* peer);
103 typedef void (*Dart_ExternalString16Finalizer)(uint16_t* codepoints,
104 void* peer);
105 typedef void (*Dart_ExternalString32Finalizer)(uint32_t* codepoints,
106 void* peer);
107
101 // TODO(iposva): This is a placeholder for the eventual external Dart API. 108 // TODO(iposva): This is a placeholder for the eventual external Dart API.
102 109
103 // Return value handling after a Dart API call. 110 // Return value handling after a Dart API call.
104 DART_EXPORT bool Dart_IsValidResult(const Dart_Result& result); 111 DART_EXPORT bool Dart_IsValidResult(const Dart_Result& result);
105 112
106 inline intptr_t Dart_GetResultAsCIntptr(const Dart_Result& result) { 113 inline intptr_t Dart_GetResultAsCIntptr(const Dart_Result& result) {
107 assert(result.type_ == kRetCIntptr); // Valid to access result as C int. 114 assert(result.type_ == kRetCIntptr); // Valid to access result as C int.
108 return result.retval_.int_value; 115 return result.retval_.int_value;
109 } 116 }
110 inline Dart_Result Dart_ResultAsCIntptr(intptr_t value) { 117 inline Dart_Result Dart_ResultAsCIntptr(intptr_t value) {
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 DART_EXPORT Dart_Result Dart_StringLength(Dart_Handle str); 293 DART_EXPORT Dart_Result Dart_StringLength(Dart_Handle str);
287 294
288 DART_EXPORT Dart_Handle Dart_NewString(const char* str); 295 DART_EXPORT Dart_Handle Dart_NewString(const char* str);
289 DART_EXPORT Dart_Handle Dart_NewString8(const uint8_t* codepoints, 296 DART_EXPORT Dart_Handle Dart_NewString8(const uint8_t* codepoints,
290 intptr_t length); 297 intptr_t length);
291 DART_EXPORT Dart_Handle Dart_NewString16(const uint16_t* codepoints, 298 DART_EXPORT Dart_Handle Dart_NewString16(const uint16_t* codepoints,
292 intptr_t length); 299 intptr_t length);
293 DART_EXPORT Dart_Handle Dart_NewString32(const uint32_t* codepoints, 300 DART_EXPORT Dart_Handle Dart_NewString32(const uint32_t* codepoints,
294 intptr_t length); 301 intptr_t length);
295 302
303 DART_EXPORT Dart_Handle Dart_NewExternalString8(
304 uint8_t* codepoints,
305 intptr_t length,
306 void* peer,
307 Dart_ExternalString8Finalizer finalizer);
308 DART_EXPORT Dart_Handle Dart_NewExternalString16(
309 uint16_t* codepoints,
310 intptr_t length,
311 void* peer,
312 Dart_ExternalString16Finalizer finalizer);
313 DART_EXPORT Dart_Handle Dart_NewExternalString32(
314 uint32_t* codepoints,
315 intptr_t length,
316 void* peer,
317 Dart_ExternalString32Finalizer finalizer);
318
319
296 // The functions below test whether the object is a String and its codepoints 320 // The functions below test whether the object is a String and its codepoints
297 // all fit into 8 or 16 bits respectively. 321 // all fit into 8 or 16 bits respectively.
298 DART_EXPORT bool Dart_IsString8(Dart_Handle object); 322 DART_EXPORT bool Dart_IsString8(Dart_Handle object);
299 DART_EXPORT bool Dart_IsString16(Dart_Handle object); 323 DART_EXPORT bool Dart_IsString16(Dart_Handle object);
300 324
301 DART_EXPORT Dart_Result Dart_StringGet8(Dart_Handle str, 325 DART_EXPORT Dart_Result Dart_StringGet8(Dart_Handle str,
302 uint8_t* codepoints, 326 uint8_t* codepoints,
303 intptr_t length); 327 intptr_t length);
304 DART_EXPORT Dart_Result Dart_StringGet16(Dart_Handle str, 328 DART_EXPORT Dart_Result Dart_StringGet16(Dart_Handle str,
305 uint16_t* codepoints, 329 uint16_t* codepoints,
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 // External pprof support for gathering and dumping symbolic information 459 // External pprof support for gathering and dumping symbolic information
436 // that can be used for better profile reports for dynamically generated 460 // that can be used for better profile reports for dynamically generated
437 // code. 461 // code.
438 DART_EXPORT void Dart_InitPprofSupport(); 462 DART_EXPORT void Dart_InitPprofSupport();
439 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); 463 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size);
440 464
441 // Check set vm flags. 465 // Check set vm flags.
442 DART_EXPORT bool Dart_IsVMFlagSet(const char* flag_name); 466 DART_EXPORT bool Dart_IsVMFlagSet(const char* flag_name);
443 467
444 #endif // INCLUDE_DART_API_H_ 468 #endif // INCLUDE_DART_API_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/string.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698