-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new cross-platform APIs to Jsrt #766
Add new cross-platform APIs to Jsrt #766
Conversation
This change introduces the cross-platform API shape for JSRT. It starts with the following assumptions: - Changing the definition of existing APIs is ok, as long as the effective shape doesnt change (so it's fine to use new macros etc as long as signature/calling convention/linkage etc doesn't change) - Existing APIs which take wchar_t* as a parameter will be exposed only on Windows - New variants of these APIs that take in UTF-8 strings will be exposed on *all* platforms Here is a summary of the changes: New macros introduced: CHAKRA_CALLBACK - Calling convention attribute of callback functions consumed by jsrt APIs. Used in place of Win32 CALLBACK macro. CHAKRA_API - Calling convention, linkage and return type of Jsrt APIs (always returns JsErrorCode). Used in place of Win32 STDAPI_ macro. New types introduced ChakraCookie - Type of cookies consumed by Jsrt Apis. Used in place of Win32 DWORD_PTR datatype. JsSerializedScriptLoadUtf8SourceCallback - Callback called to load source code of serialized script encoded as utf8 Following APIs become WIN32 only: JsParseScript JsParseScriptWithFlags JsRunScript JsExperimentalApiRunModule JsSerializeScript JsParseSerializedScriptWithCallback JsRunSerializedScriptWithCallback JsParseSerializedScript JsRunSerializedScript JsGetPropertyIdFromName JsGetPropertyNameFromId JsPointerToString JsStringToPointer New APIs introduced (available on all platforms): JsParseScriptUtf8 JsParseScriptWithAttributesUtf8 JsRunScriptUtf8 JsExperimentalApiRunModuleUtf8 JsRunScriptUtf8 JsExperimentalApiRunModuleUtf8 JsSerializeScriptUtf8 JsParseSerializedScriptUtf8 JsRunSerializedScriptUtf8 JsGetPropertyIdFromNameUtf8 JsGetPropertyNameFromIdUtf8 JsPointerToStringUtf8 JsStringToPointerUtf8 Couple notes: - All utf8 strings are passed in as char* - All string parameters in the new APIs are utf8 (e.g source, url etc).
@dilijev fixed the whitespace issue. @agarwal-sandeep @ianwjhalliday any comments? I think @curtisman @Yongqu @liminzhu have already reviewed so if you guys are fine with this, I'll merge to master |
|
||
typedef uintptr_t ChakraCookie; | ||
typedef unsigned char* ChakraBytePtr; | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add comments at all #else and #endif to mark which #if it refers to? makes it easier to read the definition blocks
3f5047d
to
63eb00e
Compare
Thanks @agarwal-sandeep. Updated the PR. |
LGTM |
👍 |
@agarwal-sandeep Do you know why the majority of ChakraCommon.h is indented without a block wrapping it? (Starting at line 69) |
LGTM |
@dilijev it has been like this when we split jsrt.h for USE_EDGEMODE_JSRT |
Thanks all- going to merge this guy to master |
Merge pull request #766 from digitalinfinity:linux_jsrt_master This change introduces the cross-platform API shape for JSRT. It starts with the following assumptions: - Changing the definition of existing APIs is ok, as long as the effective shape doesnt change (so it's fine to use new macros etc as long as signature/calling convention/linkage etc doesn't change) - Existing APIs which take wchar_t* as a parameter will be exposed only on Windows - New variants of these APIs that take in UTF-8 strings will be exposed on *all* platforms Here is a summary of the changes: New macros introduced: CHAKRA_CALLBACK - Calling convention attribute of callback functions consumed by jsrt APIs. Used in place of Win32 CALLBACK macro. CHAKRA_API - Calling convention, linkage and return type of Jsrt APIs (always returns JsErrorCode). Used in place of Win32 STDAPI_ macro. New types introduced ChakraCookie - Type of cookies consumed by Jsrt Apis. Used in place of Win32 DWORD_PTR datatype. JsSerializedScriptLoadUtf8SourceCallback - Callback called to load source code of serialized script encoded as utf8 Following APIs become WIN32 only: JsParseScript JsParseScriptWithFlags JsRunScript JsExperimentalApiRunModule JsSerializeScript JsParseSerializedScriptWithCallback JsRunSerializedScriptWithCallback JsParseSerializedScript JsRunSerializedScript JsGetPropertyIdFromName JsGetPropertyNameFromId JsPointerToString JsStringToPointer New APIs introduced (available on all platforms): JsParseScriptUtf8 JsParseScriptWithAttributesUtf8 JsRunScriptUtf8 JsExperimentalApiRunModuleUtf8 JsRunScriptUtf8 JsExperimentalApiRunModuleUtf8 JsSerializeScriptUtf8 JsParseSerializedScriptUtf8 JsRunSerializedScriptUtf8 JsGetPropertyIdFromNameUtf8 JsGetPropertyNameFromIdUtf8 JsPointerToStringUtf8 JsStringToPointerUtf8 Couple notes: - All utf8 strings are passed in as char* - All string parameters in the new APIs are utf8 (e.g source, url etc).
This change introduces the cross-platform API shape for JSRT.
It starts with the following assumptions:
(so it's fine to use new macros etc as long as signature/calling convention/linkage etc doesn't change)
Here is a summary of the changes:
New macros introduced:
CHAKRA_CALLBACK - Calling convention attribute of callback functions consumed by jsrt APIs. Used in place of Win32 CALLBACK macro.
CHAKRA_API - Calling convention, linkage and return type of Jsrt APIs (always returns JsErrorCode). Used in place of Win32 STDAPI_ macro.
New types introduced
ChakraCookie - Type of cookies consumed by Jsrt Apis. Used in place of Win32 DWORD_PTR datatype.
JsSerializedScriptLoadUtf8SourceCallback - Callback called to load source code of serialized script encoded as utf8
Following APIs become WIN32 only:
JsParseScript
JsParseScriptWithFlags
JsRunScript
JsExperimentalApiRunModule
JsSerializeScript
JsParseSerializedScriptWithCallback
JsRunSerializedScriptWithCallback
JsParseSerializedScript
JsRunSerializedScript
JsGetPropertyIdFromName
JsGetPropertyNameFromId
JsPointerToString
JsStringToPointer
New APIs introduced (available on all platforms):
JsParseScriptUtf8
JsParseScriptWithAttributesUtf8
JsRunScriptUtf8
JsExperimentalApiRunModuleUtf8
JsRunScriptUtf8
JsExperimentalApiRunModuleUtf8
JsSerializeScriptUtf8
JsParseSerializedScriptUtf8
JsRunSerializedScriptUtf8
JsGetPropertyIdFromNameUtf8
JsGetPropertyNameFromIdUtf8
JsPointerToStringUtf8
JsStringToPointerUtf8
Couple notes: