clang-formats remaining files and adds a presubmit check.

R=asiva@google.com, johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2483363002 .
This commit is contained in:
Zachary Anderson 2016-11-09 12:43:57 -08:00
parent 050e16d221
commit 630d24bec8
12 changed files with 220 additions and 211 deletions

19
DEPS
View file

@ -32,6 +32,7 @@ vars = {
# Revisions of GN related dependencies.
"buildtools_revision": "@39b1db2ab4aa4b2ccaa263c29bdf63e7c1ee28aa",
"clang_format_rev": "@0ed791d1387a3c9146ea6c453c646f3c0fc97784",
"gperftools_revision": "@02eeed29df112728564a5dde6417fa4622b57a06",
@ -134,6 +135,9 @@ deps = {
Var("dart_root") + "/buildtools":
Var('chromium_git') + '/chromium/buildtools.git' +
Var('buildtools_revision'),
Var("dart_root") + "/buildtools/clang_format/script":
Var("chromium_git") + "/chromium/llvm-project/cfe/tools/clang-format.git" +
Var("clang_format_rev"),
Var("dart_root") + "/tests/co19/src":
(Var("github_mirror") % "co19") + Var("co19_rev"),
@ -405,6 +409,21 @@ hooks = [
],
},
# Pull clang-format binaries using checked-in hashes.
{
'name': 'clang_format_win',
'pattern': '.',
'action': [
'download_from_google_storage',
'--no_auth',
'--no_resume',
'--quiet',
'--platform=win32',
'--bucket',
'chromium-clang-format',
'-s',
Var('dart_root') + '/buildtools/win/clang-format.exe.sha1',
],
},
{
'name': 'clang_format_linux',
'pattern': '.',

View file

@ -4,4 +4,7 @@ set noparent
# Do not limit function size. For example parts of
# the simulator are really large.
filter=-readability/fn_size
#
# Do not complain about whitespace. That is handled
# by the clang format presubmit check.
filter=-readability/fn_size,-whitespace/indent

View file

@ -48,11 +48,17 @@ def CheckGn(input_api, output_api):
return input_api.canned_checks.CheckGNFormatted(input_api, output_api)
def CheckFormatted(input_api, output_api):
return input_api.canned_checks.CheckPatchFormatted(input_api, output_api)
def CheckChangeOnUpload(input_api, output_api):
return (RunLint(input_api, output_api) +
CheckGn(input_api, output_api))
CheckGn(input_api, output_api) +
CheckFormatted(input_api, output_api))
def CheckChangeOnCommit(input_api, output_api):
return (RunLint(input_api, output_api) +
CheckGn(input_api, output_api))
CheckGn(input_api, output_api) +
CheckFormatted(input_api, output_api))

View file

@ -449,7 +449,7 @@ void Loader::InitForSnapshot(const char* snapshot_uri) {
}
#define RETURN_ERROR(result) \
#define RETURN_ERROR(result) \
if (Dart_IsError(result)) return result;
Dart_Handle Loader::ReloadNativeExtensions() {

197
runtime/include/dart_api.h Executable file → Normal file
View file

@ -54,8 +54,8 @@ typedef unsigned __int64 uint64_t;
#include <stdbool.h>
#if __GNUC__ >= 4
#if defined(DART_SHARED_LIB)
#define DART_EXPORT DART_EXTERN_C __attribute__ ((visibility("default"))) \
__attribute((used))
#define DART_EXPORT \
DART_EXTERN_C __attribute__((visibility("default"))) __attribute((used))
#else
#define DART_EXPORT DART_EXTERN_C
#endif
@ -418,10 +418,10 @@ DART_EXPORT void _Dart_ReportErrorHandle(const char* file,
{ \
Dart_Handle __handle = handle; \
if (Dart_IsError((__handle))) { \
_Dart_ReportErrorHandle(__FILE__, __LINE__, \
#handle, Dart_GetError(__handle)); \
_Dart_ReportErrorHandle(__FILE__, __LINE__, #handle, \
Dart_GetError(__handle)); \
} \
} \
}
/**
* Converts an object to a string.
@ -467,8 +467,8 @@ DART_EXPORT Dart_Handle Dart_HandleFromPersistent(Dart_PersistentHandle object);
/**
* Allocates a handle in the current scope from a weak persistent handle.
*/
DART_EXPORT Dart_Handle Dart_HandleFromWeakPersistent(
Dart_WeakPersistentHandle object);
DART_EXPORT Dart_Handle
Dart_HandleFromWeakPersistent(Dart_WeakPersistentHandle object);
/**
* Allocates a persistent handle for an object.
@ -532,11 +532,11 @@ DART_EXPORT void Dart_DeletePersistentHandle(Dart_PersistentHandle object);
* \return The weak persistent handle or NULL. NULL is returned in case of bad
* parameters.
*/
DART_EXPORT Dart_WeakPersistentHandle Dart_NewWeakPersistentHandle(
Dart_Handle object,
void* peer,
intptr_t external_allocation_size,
Dart_WeakPersistentHandleFinalizer callback);
DART_EXPORT Dart_WeakPersistentHandle
Dart_NewWeakPersistentHandle(Dart_Handle object,
void* peer,
intptr_t external_allocation_size,
Dart_WeakPersistentHandleFinalizer callback);
DART_EXPORT void Dart_DeleteWeakPersistentHandle(
Dart_Isolate isolate,
@ -582,9 +582,9 @@ typedef void (*Dart_GcEpilogueCallback)();
* \return Success if the callbacks were added. Otherwise, returns an
* error handle.
*/
DART_EXPORT Dart_Handle Dart_SetGcCallbacks(
Dart_GcPrologueCallback prologue_callback,
Dart_GcEpilogueCallback epilogue_callback);
DART_EXPORT Dart_Handle
Dart_SetGcCallbacks(Dart_GcPrologueCallback prologue_callback,
Dart_GcEpilogueCallback epilogue_callback);
/*
@ -793,19 +793,19 @@ typedef Dart_Handle (*Dart_GetVMServiceAssetsArchive)();
* See Dart_GetVMServiceAssetsArchive.
*/
typedef struct {
int32_t version;
const uint8_t* vm_isolate_snapshot;
const uint8_t* instructions_snapshot;
const uint8_t* data_snapshot;
Dart_IsolateCreateCallback create;
Dart_IsolateShutdownCallback shutdown;
Dart_ThreadExitCallback thread_exit;
Dart_FileOpenCallback file_open;
Dart_FileReadCallback file_read;
Dart_FileWriteCallback file_write;
Dart_FileCloseCallback file_close;
Dart_EntropySource entropy_source;
Dart_GetVMServiceAssetsArchive get_service_assets;
int32_t version;
const uint8_t* vm_isolate_snapshot;
const uint8_t* instructions_snapshot;
const uint8_t* data_snapshot;
Dart_IsolateCreateCallback create;
Dart_IsolateShutdownCallback shutdown;
Dart_ThreadExitCallback thread_exit;
Dart_FileOpenCallback file_open;
Dart_FileReadCallback file_read;
Dart_FileWriteCallback file_write;
Dart_FileCloseCallback file_close;
Dart_EntropySource entropy_source;
Dart_GetVMServiceAssetsArchive get_service_assets;
} Dart_InitializeParams;
/**
@ -979,11 +979,11 @@ DART_EXPORT void Dart_ExitIsolate();
*
* \return A valid handle if no error occurs during the operation.
*/
DART_EXPORT Dart_Handle Dart_CreateSnapshot(
uint8_t** vm_isolate_snapshot_buffer,
intptr_t* vm_isolate_snapshot_size,
uint8_t** isolate_snapshot_buffer,
intptr_t* isolate_snapshot_size);
DART_EXPORT Dart_Handle
Dart_CreateSnapshot(uint8_t** vm_isolate_snapshot_buffer,
intptr_t* vm_isolate_snapshot_size,
uint8_t** isolate_snapshot_buffer,
intptr_t* isolate_snapshot_size);
/**
* Creates a snapshot of the application script loaded in the isolate.
@ -1064,7 +1064,7 @@ typedef int64_t Dart_Port;
* ILLEGAL_PORT is a port number guaranteed never to be associated with a valid
* port.
*/
#define ILLEGAL_PORT ((Dart_Port) 0)
#define ILLEGAL_PORT ((Dart_Port)0)
/**
* A message notification callback.
@ -1434,7 +1434,7 @@ DART_EXPORT bool Dart_IsInteger(Dart_Handle object);
DART_EXPORT bool Dart_IsDouble(Dart_Handle object);
DART_EXPORT bool Dart_IsBoolean(Dart_Handle object);
DART_EXPORT bool Dart_IsString(Dart_Handle object);
DART_EXPORT bool Dart_IsStringLatin1(Dart_Handle object); /* (ISO-8859-1) */
DART_EXPORT bool Dart_IsStringLatin1(Dart_Handle object); /* (ISO-8859-1) */
DART_EXPORT bool Dart_IsExternalString(Dart_Handle object);
DART_EXPORT bool Dart_IsList(Dart_Handle object);
DART_EXPORT bool Dart_IsMap(Dart_Handle object);
@ -1718,11 +1718,11 @@ DART_EXPORT Dart_Handle Dart_NewStringFromUTF32(const int32_t* utf32_array,
* \return The String object if no error occurs. Otherwise returns
* an error handle.
*/
DART_EXPORT Dart_Handle Dart_NewExternalLatin1String(
const uint8_t* latin1_array,
intptr_t length,
void* peer,
Dart_PeerFinalizer cback);
DART_EXPORT Dart_Handle
Dart_NewExternalLatin1String(const uint8_t* latin1_array,
intptr_t length,
void* peer,
Dart_PeerFinalizer cback);
/**
* Returns a String which references an external array of UTF-16 encoded
@ -1840,12 +1840,12 @@ DART_EXPORT Dart_Handle Dart_StringStorageSize(Dart_Handle str, intptr_t* size);
* result = Dart_MakeExternalString(str, data, size, NULL, NULL);
*
*/
DART_EXPORT Dart_Handle Dart_MakeExternalString(
Dart_Handle str,
void* array,
intptr_t external_allocation_size,
void* peer,
Dart_PeerFinalizer cback);
DART_EXPORT Dart_Handle
Dart_MakeExternalString(Dart_Handle str,
void* array,
intptr_t external_allocation_size,
void* peer,
Dart_PeerFinalizer cback);
/**
* Retrieves some properties associated with a String.
@ -1907,8 +1907,7 @@ DART_EXPORT Dart_Handle Dart_ListLength(Dart_Handle list, intptr_t* length);
* \return The Object in the List at the specified index if no error
* occurs. Otherwise returns an error handle.
*/
DART_EXPORT Dart_Handle Dart_ListGetAt(Dart_Handle list,
intptr_t index);
DART_EXPORT Dart_Handle Dart_ListGetAt(Dart_Handle list, intptr_t index);
/**
* Gets a range of Objects from a List.
@ -2044,8 +2043,8 @@ DART_EXPORT Dart_TypedData_Type Dart_GetTypeOfTypedData(Dart_Handle object);
* \return kInvalid if the object is not an external TypedData object or
* the appropriate Dart_TypedData_Type.
*/
DART_EXPORT Dart_TypedData_Type Dart_GetTypeOfExternalTypedData(
Dart_Handle object);
DART_EXPORT Dart_TypedData_Type
Dart_GetTypeOfExternalTypedData(Dart_Handle object);
/**
* Returns a TypedData object of the desired length and type.
@ -2183,10 +2182,10 @@ DART_EXPORT Dart_Handle Dart_Allocate(Dart_Handle type);
* \return The new object. If an error occurs during execution, then an
* error handle is returned.
*/
DART_EXPORT Dart_Handle Dart_AllocateWithNativeFields(
Dart_Handle type,
intptr_t num_native_fields,
const intptr_t* native_fields);
DART_EXPORT Dart_Handle
Dart_AllocateWithNativeFields(Dart_Handle type,
intptr_t num_native_fields,
const intptr_t* native_fields);
/**
* Invokes a method or function.
@ -2275,8 +2274,7 @@ DART_EXPORT Dart_Handle Dart_InvokeConstructor(Dart_Handle object,
* \return If no error occurs, then the value of the field is
* returned. Otherwise an error handle is returned.
*/
DART_EXPORT Dart_Handle Dart_GetField(Dart_Handle container,
Dart_Handle name);
DART_EXPORT Dart_Handle Dart_GetField(Dart_Handle container, Dart_Handle name);
/**
* Sets the value of a field.
@ -2448,7 +2446,7 @@ enum {
#define BITMASK(size) ((1 << size) - 1)
#define DART_NATIVE_ARG_DESCRIPTOR(type, position) \
(((type & BITMASK(kNativeArgTypeSize)) << kNativeArgTypePos) | \
(position & BITMASK(kNativeArgNumberSize)))
(position & BITMASK(kNativeArgNumberSize))) // NOLINT
/**
* Gets the native arguments based on the types passed in and populates
@ -2471,11 +2469,11 @@ enum {
* returns an error handle if there were any errors while extracting the
* arguments (mismatched number of arguments, incorrect types, etc.).
*/
DART_EXPORT Dart_Handle Dart_GetNativeArguments(
Dart_NativeArguments args,
int num_arguments,
const Dart_NativeArgument_Descriptor* arg_descriptors,
Dart_NativeArgument_Value* arg_values);
DART_EXPORT Dart_Handle
Dart_GetNativeArguments(Dart_NativeArguments args,
int num_arguments,
const Dart_NativeArgument_Descriptor* arg_descriptors,
Dart_NativeArgument_Value* arg_values);
/**
@ -2502,11 +2500,11 @@ DART_EXPORT int Dart_GetNativeArgumentCount(Dart_NativeArguments args);
* null object then 0 is copied as the native field values into the
* 'field_values' array.
*/
DART_EXPORT Dart_Handle Dart_GetNativeFieldsOfArgument(
Dart_NativeArguments args,
int arg_index,
int num_fields,
intptr_t* field_values);
DART_EXPORT Dart_Handle
Dart_GetNativeFieldsOfArgument(Dart_NativeArguments args,
int arg_index,
int num_fields,
intptr_t* field_values);
/**
* Gets the native field of the receiver.
@ -2659,8 +2657,8 @@ typedef Dart_Handle (*Dart_EnvironmentCallback)(Dart_Handle name);
* the const constructors bool.fromEnvironment, int.fromEnvironment
* and String.fromEnvironment.
*/
DART_EXPORT Dart_Handle Dart_SetEnvironmentCallback(
Dart_EnvironmentCallback callback);
DART_EXPORT Dart_Handle
Dart_SetEnvironmentCallback(Dart_EnvironmentCallback callback);
/**
* Sets the callback used to resolve native functions for a library.
@ -2670,10 +2668,10 @@ DART_EXPORT Dart_Handle Dart_SetEnvironmentCallback(
*
* \return A valid handle if the native resolver was set successfully.
*/
DART_EXPORT Dart_Handle Dart_SetNativeResolver(
Dart_Handle library,
Dart_NativeEntryResolver resolver,
Dart_NativeEntrySymbol symbol);
DART_EXPORT Dart_Handle
Dart_SetNativeResolver(Dart_Handle library,
Dart_NativeEntryResolver resolver,
Dart_NativeEntrySymbol symbol);
/* TODO(turnidge): Rename to Dart_LibrarySetNativeResolver? */
@ -2744,8 +2742,8 @@ typedef Dart_Handle (*Dart_LibraryTagHandler)(Dart_LibraryTag tag,
*
* TODO(turnidge): Document.
*/
DART_EXPORT Dart_Handle Dart_SetLibraryTagHandler(
Dart_LibraryTagHandler handler);
DART_EXPORT Dart_Handle
Dart_SetLibraryTagHandler(Dart_LibraryTagHandler handler);
/**
* Canonicalizes a url with respect to some library.
@ -3119,9 +3117,8 @@ typedef struct {
* \return An error handle if a compilation error or runtime error running const
* constructors was encountered.
*/
DART_EXPORT Dart_Handle Dart_Precompile(
Dart_QualifiedFunctionName entry_points[],
bool reset_fields);
DART_EXPORT Dart_Handle
Dart_Precompile(Dart_QualifiedFunctionName entry_points[], bool reset_fields);
/**
@ -3143,9 +3140,9 @@ DART_EXPORT Dart_Handle Dart_Precompile(
*
* \return A valid handle if no error occurs during the operation.
*/
DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotAssembly(
uint8_t** assembly_buffer,
intptr_t* assembly_size);
DART_EXPORT Dart_Handle
Dart_CreatePrecompiledSnapshotAssembly(uint8_t** assembly_buffer,
intptr_t* assembly_size);
/**
@ -3154,15 +3151,15 @@ DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotAssembly(
* load with mmap. The instructions piece must be loaded with read and
* execute permissions; the rodata piece may be loaded as read-only.
*/
DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotBlob(
uint8_t** vm_isolate_snapshot_buffer,
intptr_t* vm_isolate_snapshot_size,
uint8_t** isolate_snapshot_buffer,
intptr_t* isolate_snapshot_size,
uint8_t** instructions_blob_buffer,
intptr_t* instructions_blob_size,
uint8_t** rodata_blob_buffer,
intptr_t* rodata_blob_size);
DART_EXPORT Dart_Handle
Dart_CreatePrecompiledSnapshotBlob(uint8_t** vm_isolate_snapshot_buffer,
intptr_t* vm_isolate_snapshot_size,
uint8_t** isolate_snapshot_buffer,
intptr_t* isolate_snapshot_size,
uint8_t** instructions_blob_buffer,
intptr_t* instructions_blob_size,
uint8_t** rodata_blob_buffer,
intptr_t* rodata_blob_size);
DART_EXPORT Dart_Handle Dart_PrecompileJIT();
@ -3191,15 +3188,15 @@ DART_EXPORT Dart_Handle Dart_PrecompileJIT();
*
* \return A valid handle if no error occurs during the operation.
*/
DART_EXPORT Dart_Handle Dart_CreateAppJITSnapshot(
uint8_t** vm_isolate_snapshot_buffer,
intptr_t* vm_isolate_snapshot_size,
uint8_t** isolate_snapshot_buffer,
intptr_t* isolate_snapshot_size,
uint8_t** instructions_blob_buffer,
intptr_t* instructions_blob_size,
uint8_t** rodata_blob_buffer,
intptr_t* rodata_blob_size);
DART_EXPORT Dart_Handle
Dart_CreateAppJITSnapshot(uint8_t** vm_isolate_snapshot_buffer,
intptr_t* vm_isolate_snapshot_size,
uint8_t** isolate_snapshot_buffer,
intptr_t* isolate_snapshot_size,
uint8_t** instructions_blob_buffer,
intptr_t* instructions_blob_size,
uint8_t** rodata_blob_buffer,
intptr_t* rodata_blob_size);
/**
@ -3209,4 +3206,4 @@ DART_EXPORT Dart_Handle Dart_CreateAppJITSnapshot(
*/
DART_EXPORT bool Dart_IsPrecompiledRuntime();
#endif /* INCLUDE_DART_API_H_ */ /* NOLINT */
#endif /* INCLUDE_DART_API_H_ */ /* NOLINT */

View file

@ -139,4 +139,4 @@ DART_EXPORT Dart_Handle Dart_LibraryGetClassNames(Dart_Handle library);
DART_EXPORT Dart_Handle Dart_ClosureFunction(Dart_Handle closure);
#endif /* INCLUDE_DART_MIRRORS_API_H_ */ /* NOLINT */
#endif /* INCLUDE_DART_MIRRORS_API_H_ */ /* NOLINT */

View file

@ -176,4 +176,4 @@ DART_EXPORT Dart_Handle Dart_CompileAll();
*/
DART_EXPORT Dart_Handle Dart_ParseAll();
#endif /* INCLUDE_DART_NATIVE_API_H_ */ /* NOLINT */
#endif /* INCLUDE_DART_NATIVE_API_H_ */ /* NOLINT */

View file

@ -18,7 +18,7 @@
*/
/*
/*
* ========
* Debugger
* ========
@ -155,9 +155,8 @@ DART_EXPORT Dart_Handle Dart_GetScriptURLs(Dart_Handle library_url);
* \return A handle to string containing the source text if no error
* occurs.
*/
DART_EXPORT Dart_Handle Dart_ScriptGetSource(
intptr_t library_id,
Dart_Handle script_url_in);
DART_EXPORT Dart_Handle Dart_ScriptGetSource(intptr_t library_id,
Dart_Handle script_url_in);
/**
@ -177,9 +176,8 @@ DART_EXPORT Dart_Handle Dart_ScriptGetSource(
*
* \return A handle to an array or an error object.
*/
DART_EXPORT Dart_Handle Dart_ScriptGetTokenInfo(
intptr_t library_id,
Dart_Handle script_url_in);
DART_EXPORT Dart_Handle Dart_ScriptGetTokenInfo(intptr_t library_id,
Dart_Handle script_url_in);
/**
@ -205,9 +203,8 @@ DART_EXPORT Dart_Handle Dart_GenerateScriptSource(Dart_Handle library_url_in,
* \return A handle containing the breakpoint id, which is an integer
* value, or an error object if a breakpoint could not be set.
*/
DART_EXPORT Dart_Handle Dart_SetBreakpoint(
Dart_Handle script_url,
intptr_t line_number);
DART_EXPORT Dart_Handle Dart_SetBreakpoint(Dart_Handle script_url,
intptr_t line_number);
/**
* Deletes the breakpoint with the given id \pb_id.
@ -251,10 +248,9 @@ DART_EXPORT Dart_Handle Dart_GetBreakpointLine(intptr_t bp_id);
* \return A handle containing the breakpoint id, which is an integer
* value, or an error object if a breakpoint could not be set.
*/
DART_EXPORT Dart_Handle Dart_SetBreakpointAtEntry(
Dart_Handle library,
Dart_Handle class_name,
Dart_Handle function_name);
DART_EXPORT Dart_Handle Dart_SetBreakpointAtEntry(Dart_Handle library,
Dart_Handle class_name,
Dart_Handle function_name);
/**
@ -266,10 +262,9 @@ DART_EXPORT Dart_Handle Dart_SetBreakpointAtEntry(
*
* \return A handle to the True object if no error occurs.
*/
DART_EXPORT Dart_Handle Dart_OneTimeBreakAtEntry(
Dart_Handle library,
Dart_Handle class_name,
Dart_Handle function_name);
DART_EXPORT Dart_Handle Dart_OneTimeBreakAtEntry(Dart_Handle library,
Dart_Handle class_name,
Dart_Handle function_name);
/**
@ -305,8 +300,7 @@ DART_EXPORT Dart_Handle Dart_SetStepOut();
*
* Requires there to be a current isolate.
*/
DART_EXPORT void Dart_SetPausedEventHandler(
Dart_PausedEventHandler handler);
DART_EXPORT void Dart_SetPausedEventHandler(Dart_PausedEventHandler handler);
/**
@ -316,7 +310,7 @@ DART_EXPORT void Dart_SetPausedEventHandler(
* Requires there to be a current isolate.
*/
DART_EXPORT void Dart_SetBreakpointResolvedHandler(
Dart_BreakpointResolvedHandler handler);
Dart_BreakpointResolvedHandler handler);
/**
* Installs a callback function that gets called by the VM when
@ -325,7 +319,7 @@ DART_EXPORT void Dart_SetBreakpointResolvedHandler(
* Requires there to be a current isolate.
*/
DART_EXPORT void Dart_SetExceptionThrownHandler(
Dart_ExceptionThrownHandler handler);
Dart_ExceptionThrownHandler handler);
/**
* Installs a callback function that gets called by the VM when
@ -349,8 +343,8 @@ typedef enum {
*
* Requires there to be a current isolate.
*/
DART_EXPORT Dart_Handle Dart_SetExceptionPauseInfo(
Dart_ExceptionPauseInfo pause_info);
DART_EXPORT Dart_Handle
Dart_SetExceptionPauseInfo(Dart_ExceptionPauseInfo pause_info);
/**
@ -390,9 +384,8 @@ DART_EXPORT Dart_Handle Dart_GetStackTraceFromError(Dart_Handle error,
*
* \return A handle to the True object if no error occurs.
*/
DART_EXPORT Dart_Handle Dart_StackTraceLength(
Dart_StackTrace trace,
intptr_t* length);
DART_EXPORT Dart_Handle Dart_StackTraceLength(Dart_StackTrace trace,
intptr_t* length);
/**
@ -403,10 +396,9 @@ DART_EXPORT Dart_Handle Dart_StackTraceLength(
*
* \return A handle to the True object if no error occurs.
*/
DART_EXPORT Dart_Handle Dart_GetActivationFrame(
Dart_StackTrace trace,
int frame_index,
Dart_ActivationFrame* frame);
DART_EXPORT Dart_Handle Dart_GetActivationFrame(Dart_StackTrace trace,
int frame_index,
Dart_ActivationFrame* frame);
/**
@ -425,12 +417,12 @@ DART_EXPORT Dart_Handle Dart_GetActivationFrame(
*
* \return A valid handle if no error occurs during the operation.
*/
DART_EXPORT Dart_Handle Dart_ActivationFrameInfo(
Dart_ActivationFrame activation_frame,
Dart_Handle* function_name,
Dart_Handle* script_url,
intptr_t* line_number,
intptr_t* column_number);
DART_EXPORT Dart_Handle
Dart_ActivationFrameInfo(Dart_ActivationFrame activation_frame,
Dart_Handle* function_name,
Dart_Handle* script_url,
intptr_t* line_number,
intptr_t* column_number);
/**
@ -456,11 +448,11 @@ DART_EXPORT Dart_Handle Dart_ActivationFrameInfo(
* A handle to the False object if there is no text
* position for the frame.
*/
DART_EXPORT Dart_Handle Dart_ActivationFrameGetLocation(
Dart_ActivationFrame activation_frame,
Dart_Handle* function_name,
Dart_Handle* function,
Dart_CodeLocation* location);
DART_EXPORT Dart_Handle
Dart_ActivationFrameGetLocation(Dart_ActivationFrame activation_frame,
Dart_Handle* function_name,
Dart_Handle* function,
Dart_CodeLocation* location);
/**
* Returns frame pointer of the given activation frame.
@ -471,9 +463,9 @@ DART_EXPORT Dart_Handle Dart_ActivationFrameGetLocation(
*
* \return A handle to the True object if no error occurs.
*/
DART_EXPORT Dart_Handle Dart_ActivationFrameGetFramePointer(
Dart_ActivationFrame activation_frame,
uintptr_t* frame_pointer);
DART_EXPORT Dart_Handle
Dart_ActivationFrameGetFramePointer(Dart_ActivationFrame activation_frame,
uintptr_t* frame_pointer);
/**
* Returns an array containing all the local variable names and values of
@ -486,8 +478,8 @@ DART_EXPORT Dart_Handle Dart_ActivationFrameGetFramePointer(
* no variables. If non-empty, variable names are at array offsets 2*n,
* values at offset 2*n+1.
*/
DART_EXPORT Dart_Handle Dart_GetLocalVariables(
Dart_ActivationFrame activation_frame);
DART_EXPORT Dart_Handle
Dart_GetLocalVariables(Dart_ActivationFrame activation_frame);
/**
@ -519,9 +511,9 @@ DART_EXPORT Dart_Handle Dart_GetGlobalVariables(intptr_t library_id);
* Execute the expression given in string \expr in the context
* of stack frame \activation_frame.
*/
DART_EXPORT Dart_Handle Dart_ActivationFrameEvaluate(
Dart_ActivationFrame activation_frame,
Dart_Handle expr_in);
DART_EXPORT Dart_Handle
Dart_ActivationFrameEvaluate(Dart_ActivationFrame activation_frame,
Dart_Handle expr_in);
/**
@ -542,8 +534,7 @@ DART_EXPORT Dart_Handle Dart_ActivationFrameEvaluate(
* the compilation of the expression fails, or if the evaluation throws
* an error.
*/
DART_EXPORT Dart_Handle Dart_EvaluateExpr(Dart_Handle target,
Dart_Handle expr);
DART_EXPORT Dart_Handle Dart_EvaluateExpr(Dart_Handle target, Dart_Handle expr);
/**
@ -783,13 +774,12 @@ DART_EXPORT Dart_IsolateId Dart_GetIsolateId(Dart_Isolate isolate);
* \return True if the result is a regular JSON-RPC response, false if the
* result is a JSON-RPC error.
*/
typedef bool (*Dart_ServiceRequestCallback)(
const char* method,
const char** param_keys,
const char** param_values,
intptr_t num_params,
void* user_data,
const char** json_object);
typedef bool (*Dart_ServiceRequestCallback)(const char* method,
const char** param_keys,
const char** param_values,
intptr_t num_params,
void* user_data,
const char** json_object);
/**
@ -913,8 +903,8 @@ DART_EXPORT Dart_Handle Dart_ServiceSendDataEvent(const char* stream_id,
*/
typedef bool (*Dart_FileModifiedCallback)(const char* url, int64_t since);
DART_EXPORT Dart_Handle Dart_SetFileModifiedCallback(
Dart_FileModifiedCallback file_modified_callback);
DART_EXPORT Dart_Handle
Dart_SetFileModifiedCallback(Dart_FileModifiedCallback file_modified_callback);
/*
* ========
@ -948,14 +938,11 @@ DART_EXPORT int64_t Dart_TimelineGetMicros();
#define DART_TIMELINE_STREAM_VM (1 << 7)
/** All timeline streams */
#define DART_TIMELINE_STREAM_ALL (DART_TIMELINE_STREAM_API | \
DART_TIMELINE_STREAM_COMPILER | \
DART_TIMELINE_STREAM_DART | \
DART_TIMELINE_STREAM_DEBUGGER | \
DART_TIMELINE_STREAM_EMBEDDER | \
DART_TIMELINE_STREAM_GC | \
DART_TIMELINE_STREAM_ISOLATE | \
DART_TIMELINE_STREAM_VM)
#define DART_TIMELINE_STREAM_ALL \
(DART_TIMELINE_STREAM_API | DART_TIMELINE_STREAM_COMPILER | \
DART_TIMELINE_STREAM_DART | DART_TIMELINE_STREAM_DEBUGGER | \
DART_TIMELINE_STREAM_EMBEDDER | DART_TIMELINE_STREAM_GC | \
DART_TIMELINE_STREAM_ISOLATE | DART_TIMELINE_STREAM_VM)
/** Disable all timeline stream recording */
#define DART_TIMELINE_STREAM_DISABLE 0
@ -1001,12 +988,11 @@ typedef enum {
* At the end of each stream state will be DART_STREAM_CONSUMER_STATE_FINISH
* and buffer will be NULL.
*/
typedef void (*Dart_StreamConsumer)(
Dart_StreamConsumer_State state,
const char* stream_name,
const uint8_t* buffer,
intptr_t buffer_length,
void* stream_callback_data);
typedef void (*Dart_StreamConsumer)(Dart_StreamConsumer_State state,
const char* stream_name,
const uint8_t* buffer,
intptr_t buffer_length,
void* stream_callback_data);
/**
* Get the timeline for entire VM (including all isolates).

View file

@ -39,16 +39,11 @@ const char** Bootstrap::typed_data_patch_paths_ = NULL;
#define MAKE_PROPERTIES(CamelName, name) \
{ ObjectStore::k##CamelName, \
"dart:" #name, \
Bootstrap::name##_source_paths_, \
"dart:" #name "-patch", \
Bootstrap::name##_patch_paths_ \
},
{ObjectStore::k##CamelName, "dart:" #name, Bootstrap::name##_source_paths_, \
"dart:" #name "-patch", Bootstrap::name##_patch_paths_},
static const BootstrapLibProps bootstrap_libraries[] = {
FOR_EACH_BOOTSTRAP_LIBRARY(MAKE_PROPERTIES)
};
FOR_EACH_BOOTSTRAP_LIBRARY(MAKE_PROPERTIES)};
#undef MAKE_PROPERTIES

View file

@ -264,8 +264,8 @@ class ObjectStore {
RawLibrary* bootstrap_library(BootstrapLibraryId index) {
switch (index) {
#define MAKE_CASE(CamelName, name) \
case k##CamelName: \
return name##_library_;
case k##CamelName: \
return name##_library_;
FOR_EACH_BOOTSTRAP_LIBRARY(MAKE_CASE)
#undef MAKE_CASE
@ -279,9 +279,9 @@ class ObjectStore {
void set_bootstrap_library(BootstrapLibraryId index, const Library& value) {
switch (index) {
#define MAKE_CASE(CamelName, name) \
case k##CamelName: \
name##_library_ = value.raw(); \
break;
case k##CamelName: \
name##_library_ = value.raw(); \
break;
FOR_EACH_BOOTSTRAP_LIBRARY(MAKE_CASE)
#undef MAKE_CASE

View file

@ -144,12 +144,18 @@ static intptr_t GetTypeIndex(ObjectStore* object_store,
const char* Snapshot::KindToCString(Kind kind) {
switch (kind) {
case kCore: return "core";
case kScript: return "script";
case kMessage: return "message";
case kAppWithJIT: return "app-jit";
case kAppNoJIT: return "app-aot";
case kNone: return "none";
case kCore:
return "core";
case kScript:
return "script";
case kMessage:
return "message";
case kAppWithJIT:
return "app-jit";
case kAppNoJIT:
return "app-aot";
case kNone:
return "none";
case kInvalid:
default:
return "invalid";

View file

@ -1635,8 +1635,7 @@ UNIT_TEST_CASE(ScriptSnapshot2) {
UNIT_TEST_CASE(MismatchedSnapshotKinds) {
const char* kScriptChars =
"main() { print('Hello, world!'); }";
const char* kScriptChars = "main() { print('Hello, world!'); }";
Dart_Handle result;
uint8_t* buffer;
@ -1657,10 +1656,8 @@ UNIT_TEST_CASE(MismatchedSnapshotKinds) {
Dart_EnterScope(); // Start a Dart API scope for invoking API functions.
// Write out the script snapshot.
result = Dart_CreateSnapshot(NULL,
&vm_isolate_snapshot_size,
&isolate_snapshot,
&isolate_snapshot_size);
result = Dart_CreateSnapshot(NULL, &vm_isolate_snapshot_size,
&isolate_snapshot, &isolate_snapshot_size);
EXPECT_VALID(result);
full_snapshot = reinterpret_cast<uint8_t*>(malloc(isolate_snapshot_size));
memmove(full_snapshot, isolate_snapshot, isolate_snapshot_size);
@ -1692,9 +1689,8 @@ UNIT_TEST_CASE(MismatchedSnapshotKinds) {
{
// Use a script snapshot where a full snapshot is expected.
char* error = NULL;
Dart_Isolate isolate = Dart_CreateIsolate("script-uri", "main",
script_snapshot, NULL, NULL,
&error);
Dart_Isolate isolate = Dart_CreateIsolate(
"script-uri", "main", script_snapshot, NULL, NULL, &error);
EXPECT(isolate == NULL);
EXPECT(error != NULL);
EXPECT_SUBSTRING("got 'script', expected 'core'", error);
@ -1706,8 +1702,9 @@ UNIT_TEST_CASE(MismatchedSnapshotKinds) {
// Use a full snapshot where a script snapshot is expected.
Dart_Handle result = Dart_LoadScriptFromSnapshot(full_snapshot, size);
EXPECT_ERROR(result, "Dart_LoadScriptFromSnapshot expects parameter"
" 'buffer' to be a script type snapshot.");
EXPECT_ERROR(result,
"Dart_LoadScriptFromSnapshot expects parameter"
" 'buffer' to be a script type snapshot.");
Dart_ExitScope();
}