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

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

Issue 8401010: Add DART_CHECKVALID (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' 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/vm/dart_api_impl.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) 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 typedef void (*Dart_NativeFunction)(Dart_NativeArguments arguments); 73 typedef void (*Dart_NativeFunction)(Dart_NativeArguments arguments);
74 typedef Dart_NativeFunction (*Dart_NativeEntryResolver)(Dart_Handle name, 74 typedef Dart_NativeFunction (*Dart_NativeEntryResolver)(Dart_Handle name,
75 int num_of_arguments); 75 int num_of_arguments);
76 typedef Dart_Handle (*Dart_LibraryTagHandler)(Dart_LibraryTag tag, 76 typedef Dart_Handle (*Dart_LibraryTagHandler)(Dart_LibraryTag tag,
77 Dart_Handle library, 77 Dart_Handle library,
78 Dart_Handle url); 78 Dart_Handle url);
79 79
80 // TODO(iposva): This is a placeholder for the eventual external Dart API. 80 // TODO(iposva): This is a placeholder for the eventual external Dart API.
81 81
82 // Return value handling after a Dart API call. 82 // Returns true if 'handle' is valid and false if invalid.
83 DART_EXPORT bool Dart_IsValid(const Dart_Handle& result); 83 DART_EXPORT bool Dart_IsValid(const Dart_Handle& handle);
84 84
85 DART_EXPORT const char* Dart_GetError(const Dart_Handle& result); 85 // Internal routine used for reporting invalid handles.
86 DART_EXPORT Dart_Handle Dart_Error(const char* value); 86 DART_EXPORT void _Dart_ReportInvalidHandle(const char* file,
87 int line,
88 const char* handle_string,
89 const char* error);
87 90
91 // Aborts the process if 'handle' is invalid.
92 #define DART_CHECK_VALID(handle) \
93 if (!Dart_IsValid((handle))) { \
94 _Dart_ReportInvalidHandle(__FILE__, __LINE__, \
95 #handle, Dart_GetError(handle)); \
96 }
97
98 // Gets the error message associated with an invalid handle.
99 DART_EXPORT const char* Dart_GetError(const Dart_Handle& handle);
100
101 // Produces an invalid handle with an associated error message
102 DART_EXPORT Dart_Handle Dart_Error(const char* error);
88 103
89 // Initialize the VM with commmand line flags. 104 // Initialize the VM with commmand line flags.
90 DART_EXPORT bool Dart_Initialize(int argc, char** argv, 105 DART_EXPORT bool Dart_Initialize(int argc, char** argv,
91 Dart_IsolateInitCallback callback); 106 Dart_IsolateInitCallback callback);
92 107
93 108
94 // Isolate handling. 109 // Isolate handling.
95 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const Dart_Snapshot* snapshot, 110 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const Dart_Snapshot* snapshot,
96 void* data); 111 void* data);
97 DART_EXPORT void Dart_ShutdownIsolate(); 112 DART_EXPORT void Dart_ShutdownIsolate();
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 // External pprof support for gathering and dumping symbolic information 378 // External pprof support for gathering and dumping symbolic information
364 // that can be used for better profile reports for dynamically generated 379 // that can be used for better profile reports for dynamically generated
365 // code. 380 // code.
366 DART_EXPORT void Dart_InitPprofSupport(); 381 DART_EXPORT void Dart_InitPprofSupport();
367 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); 382 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size);
368 383
369 // Check set vm flags. 384 // Check set vm flags.
370 DART_EXPORT bool Dart_IsVMFlagSet(const char* flag_name); 385 DART_EXPORT bool Dart_IsVMFlagSet(const char* flag_name);
371 386
372 #endif // INCLUDE_DART_API_H_ 387 #endif // INCLUDE_DART_API_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698