Commit ce943ff
committed
[MERGE chakra-core#766] Add new cross-platform APIs to Jsrt
Merge pull request chakra-core#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).3 files changed
Lines changed: 816 additions & 467 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
0 commit comments