View serialize.cpp
JsErrorCode LoadByteCode(const wchar_t* szPath, BYTE** pData)
{
FILE *file;
*pData = nullptr;
if (_wfopen_s(&file, szPath, L"rb"))
{
return JsErrorInvalidArgument;
}
View compare.cpp
bool CompareLastWrite(const wchar_t* szPath1, const wchar_t* szPath2)
{
HANDLE hPath1, hPath2;
FILETIME ftPath1Create, ftPath1Access, ftPath1Write;
FILETIME ftPath2Create, ftPath2Access, ftPath2Write;
hPath1 = CreateFile2(szPath1, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, nullptr);
if (hPath1 == INVALID_HANDLE_VALUE && GetLastError() == ERROR_FILE_NOT_FOUND) {
return false;
}
View foo.cs
private void RunSerializedScript(string script, string sourceUrl)
{
var localFolder = ApplicationData.Current.LocalFolder;
var binFile = "ReactNativeSerializedBundle.bin";
var binPath = Path.Combine(localFolder.Path, binFile);
try
{
if(!EnsureSerializedScriptAsync(script, binFile).Result)
{
View log-managed.txt
RCTDeviceEventEmitter-emit
App Report: private: 70991872, peak private: 75780096, total commit: 149377024
App Report: private working set: 45342720, total working set: 85127168
Elapsed: 6624
App Report: private: 71069696, peak private: 75780096, total commit: 149454848
App Report: private working set: 45768704, total working set: 85630976
App Report: private: 71102464, peak private: 75780096, total commit: 149487616
App Report: private working set: 45830144, total working set: 86016000
View calc.txt
C# P/Invoke ChakraJavaScript Executor:
Before Invoking:
App Report: private commit usage: 62676992, peak private commit usage: 62676992, total commit usage: 141225984
Process Report: private working set: 35823616, total working set: 82153472
Ticks Elapsed: 351260
After Invoking:
App Report: private commit usage: 85008384, peak private commit usage: 85118976, total commit usage: 163557376
Process Report: private working set: 55824384, total working set: 102326272
View foo.cs
private static void SerializeScript(string scriptFile, string binFile)
{
var executor = new ChakraBridge.NativeJavaScriptExecutor();
Native.ThrowIfError((JavaScriptErrorCode)executor.InitializeHost());
Native.ThrowIfError((JavaScriptErrorCode)executor.SerializeScriptFromFile(scriptFile, binFile));
Native.ThrowIfError((JavaScriptErrorCode)executor.DisposeHost());
}
View RTL.cs
string resourceFlowDirection = ResourceContext.GetForCurrentView().QualifierValues["LayoutDirection"];
if (resourceFlowDirection == "LTR")
{
RootFrame.FlowDirection = FlowDirection.LeftToRight;
}
else
{
RootFrame.FlowDirection = FlowDirection.RightToLeft;
}
View debug.cpp
JsErrorCode Stringify(JsValueRef value, ChakraHost* self)
{
JsValueType type;
IfFailRet(JsGetValueType(value, &type));
switch (type)
{
case JsUndefined:
OutputDebugStringW(L"undefined");
break;
View foo.cpp
JsErrorCode Stringify(JsValueRef value, ChakraHost* self, const wchar_t** szResult, size_t* sResult)
{
JsValueType type;
IfFailRet(JsGetValueType(value, &type));
switch (type)
{
case JsUndefined:
*szResult = L"undefined";
*sResult = wcslen(*szResult);
View lodash.cpp
int SerializeScript()
{
ChakraHost host;
JsErrorCode status = JsNoError;
status = host.Init();
if (status != JsNoError)
{
wprintf(L"Error in initializing runtime\n");
goto cleanup;