Skip to content

Commit cc39044

Browse files
author
Thomas Moore (CHAKRA)
committed
Update new JSRT with Experimental postfixes
To indicate that these APIs are still in progress, add the postfixes to indicate changes are possible. Also updates comments for API declearations.
1 parent c1d9a77 commit cc39044

File tree

4 files changed

+51
-15
lines changed

4 files changed

+51
-15
lines changed

bin/ChakraCore/ChakraCore.def

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,6 @@ JsRunScriptWithParserState
7171
JsGetPromiseState
7272
JsGetPromiseResult
7373

74-
JsQueueBackgroundParse
75-
JsDiscardBackgroundParse
76-
JsExecuteBackgroundParse
74+
JsQueueBackgroundParse_Experimental
75+
JsDiscardBackgroundParse_Experimental
76+
JsExecuteBackgroundParse_Experimental

bin/ch/ChakraRtInterface.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,9 @@ bool ChakraRTInterface::LoadChakraDll(ArgInfo* argInfo, HINSTANCE *outLibrary)
160160
m_jsApiHooks.pfJsrtSerializeParserState = (JsAPIHooks::JsrtSerializeParserState)GetChakraCoreSymbol(library, "JsSerializeParserState");
161161
m_jsApiHooks.pfJsrtRunScriptWithParserState = (JsAPIHooks::JsrtRunScriptWithParserState)GetChakraCoreSymbol(library, "JsRunScriptWithParserState");
162162

163-
m_jsApiHooks.pfJsrtQueueBackgroundParse = (JsAPIHooks::JsrtQueueBackgroundParse)GetChakraCoreSymbol(library, "JsQueueBackgroundParse");
164-
m_jsApiHooks.pfJsrtDiscardBackgroundParse = (JsAPIHooks::JsrtDiscardBackgroundParse)GetChakraCoreSymbol(library, "JsDiscardBackgroundParse");
165-
m_jsApiHooks.pfJsrtExecuteBackgroundParse = (JsAPIHooks::JsrtExecuteBackgroundParse)GetChakraCoreSymbol(library, "JsExecuteBackgroundParse");
166-
167-
163+
m_jsApiHooks.pfJsrtQueueBackgroundParse = (JsAPIHooks::JsrtQueueBackgroundParse)GetChakraCoreSymbol(library, "JsQueueBackgroundParse_Experimental");
164+
m_jsApiHooks.pfJsrtDiscardBackgroundParse = (JsAPIHooks::JsrtDiscardBackgroundParse)GetChakraCoreSymbol(library, "JsDiscardBackgroundParse_Experimental");
165+
m_jsApiHooks.pfJsrtExecuteBackgroundParse = (JsAPIHooks::JsrtExecuteBackgroundParse)GetChakraCoreSymbol(library, "JsExecuteBackgroundParse_Experimental");
168166

169167
m_jsApiHooks.pfJsrtTTDCreateRecordRuntime = (JsAPIHooks::JsrtTTDCreateRecordRuntimePtr)GetChakraCoreSymbol(library, "JsTTDCreateRecordRuntime");
170168
m_jsApiHooks.pfJsrtTTDCreateReplayRuntime = (JsAPIHooks::JsrtTTDCreateReplayRuntimePtr)GetChakraCoreSymbol(library, "JsTTDCreateReplayRuntime");

lib/Jsrt/ChakraCommon.h

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2434,22 +2434,60 @@ typedef unsigned short uint16_t;
24342434
_In_opt_ JsPromiseContinuationCallback promiseContinuationCallback,
24352435
_In_opt_ void *callbackState);
24362436

2437+
/// <summary>
2438+
/// Note: Experimental API
2439+
/// Starts a request for background script parsing on another thread
2440+
/// </summary>
2441+
/// <param name="contents">ScriptContents struct with data needed to start parsing</param>
2442+
/// <param name="dwBgParseCookie">Identifier for subsequent BGParse operations</param>
2443+
/// <returns>
2444+
/// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.
2445+
/// </returns>
24372446
CHAKRA_API
2438-
JsQueueBackgroundParse(JsScriptContents* contents, DWORD* dwBgParseCookie);
2447+
JsQueueBackgroundParse_Experimental(
2448+
_In_ JsScriptContents* contents,
2449+
_Out_ DWORD* dwBgParseCookie);
24392450

2451+
/// <summary>
2452+
/// Note: Experimental API
2453+
/// Appropriately frees resources associated with a previously queued background parse
2454+
/// </summary>
2455+
/// <param name="dwBgParseCookie">Identifier for BGParse operation</param>
2456+
/// <param name="buffer">Pointer to script source buffer, used for validation</param>
2457+
/// <param name="callerOwnsBuffer">When <c>true</c>, caller is responsible for freeing buffer</param>
2458+
/// <returns>
2459+
/// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.
2460+
/// </returns>
24402461
CHAKRA_API
2441-
JsDiscardBackgroundParse(DWORD dwBgParseCookie, void* buffer, bool* callerOwnsBuffer);
2462+
JsDiscardBackgroundParse_Experimental(
2463+
_In_ DWORD dwBgParseCookie,
2464+
_In_ void* buffer,
2465+
_Out_ bool* callerOwnsBuffer);
24422466

2467+
/// <summary>
2468+
/// Note: Experimental API
2469+
/// Executes the background parsed script
2470+
/// </summary>
2471+
/// <param name="dwBgParseCookie">Identifier for subsequent BGParse operations</param>
2472+
/// <param name="script">Pointer to script source</param>
2473+
/// <param name="sourceContext">JsSourceContext identifier</param>
2474+
/// <param name="url">Path to the parsed script</param>
2475+
/// <param name="parseAttributes"></param>
2476+
/// <param name="parserState">[May not be needed]</param>
2477+
/// <param name="result">Result of script execution</param>
2478+
/// <returns>
2479+
/// The code <c>JsNoError</c> if the operation succeeded, a failure code otherwise.
2480+
/// </returns>
24432481
CHAKRA_API
2444-
JsExecuteBackgroundParse(_In_ DWORD dwBgParseCookie,
2482+
JsExecuteBackgroundParse_Experimental(
2483+
_In_ DWORD dwBgParseCookie,
24452484
_In_ JsValueRef script,
24462485
_In_ JsSourceContext sourceContext,
24472486
_In_ WCHAR *url,
24482487
_In_ JsParseScriptAttributes parseAttributes,
24492488
_In_ JsValueRef parserState,
24502489
_Out_ JsValueRef *result);
24512490

2452-
24532491
#ifdef _WIN32
24542492
#include "ChakraCommonWindows.h"
24552493
#endif // _WIN32

lib/Jsrt/Jsrt.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5839,7 +5839,7 @@ CHAKRA_API JsRunScriptWithParserState(
58395839
}
58405840

58415841
CHAKRA_API
5842-
JsQueueBackgroundParse(JsScriptContents* contents, DWORD* dwBgParseCookie)
5842+
JsQueueBackgroundParse_Experimental(JsScriptContents* contents, DWORD* dwBgParseCookie)
58435843
{
58445844
HRESULT hr;
58455845
if (Js::Configuration::Global.flags.BgParse && !CONFIG_FLAG(ForceDiagnosticsMode)
@@ -5862,14 +5862,14 @@ JsQueueBackgroundParse(JsScriptContents* contents, DWORD* dwBgParseCookie)
58625862
}
58635863

58645864
CHAKRA_API
5865-
JsDiscardBackgroundParse(DWORD dwBgParseCookie, void* buffer, bool* callerOwnsBuffer)
5865+
JsDiscardBackgroundParse_Experimental(DWORD dwBgParseCookie, void* buffer, bool* callerOwnsBuffer)
58665866
{
58675867
(*callerOwnsBuffer) = BGParseManager::GetBGParseManager()->DiscardParseResults(dwBgParseCookie, buffer);
58685868
return JsNoError;
58695869
}
58705870

58715871
CHAKRA_API
5872-
JsExecuteBackgroundParse(
5872+
JsExecuteBackgroundParse_Experimental(
58735873
_In_ DWORD dwBgParseCookie,
58745874
_In_ JsValueRef script,
58755875
_In_ JsSourceContext sourceContext,

0 commit comments

Comments
 (0)