diff --git a/project/include/system/System.h b/project/include/system/System.h index 23cfb7bb9..ec67cdd16 100644 --- a/project/include/system/System.h +++ b/project/include/system/System.h @@ -28,6 +28,8 @@ namespace lime { static void GCEnterBlocking (); static void GCExitBlocking (); + static void GCTryEnterBlocking (); + static void GCTryExitBlocking (); static bool GetAllowScreenTimeout (); static std::wstring* GetDeviceModel (); static std::wstring* GetDeviceVendor (); diff --git a/project/src/backend/sdl/SDLApplication.cpp b/project/src/backend/sdl/SDLApplication.cpp index 190b7e52b..85e64fa1b 100644 --- a/project/src/backend/sdl/SDLApplication.cpp +++ b/project/src/backend/sdl/SDLApplication.cpp @@ -928,8 +928,16 @@ namespace lime { void SDLApplication::UpdateFrame () { + #ifdef EMSCRIPTEN + System::GCTryExitBlocking (); + #endif + currentApplication->Update (); + #ifdef EMSCRIPTEN + System::GCTryEnterBlocking (); + #endif + } diff --git a/project/src/backend/sdl/SDLWindow.cpp b/project/src/backend/sdl/SDLWindow.cpp index 59ff7435f..e58103f3e 100644 --- a/project/src/backend/sdl/SDLWindow.cpp +++ b/project/src/backend/sdl/SDLWindow.cpp @@ -201,7 +201,9 @@ namespace lime { // if (window->flags & WINDOW_FLAG_VSYNC) { - // sdlRendererFlags |= SDL_RENDERER_PRESENTVSYNC; + #ifdef EMSCRIPTEN + sdlRendererFlags |= SDL_RENDERER_PRESENTVSYNC; + #endif // } diff --git a/project/src/system/System.cpp b/project/src/system/System.cpp index 820a3d4a6..4385ae268 100644 --- a/project/src/system/System.cpp +++ b/project/src/system/System.cpp @@ -42,6 +42,28 @@ namespace lime { } + void System::GCTryEnterBlocking () { + + if (!_isHL) { + + gc_try_blocking (); + + } + + } + + + void System::GCTryExitBlocking () { + + if (!_isHL) { + + gc_try_unblocking (); + + } + + } + + #if defined (HX_WINDOWS) && !defined (HX_WINRT) std::wstring* GetWMIValue (BSTR query, BSTR field) { diff --git a/tools/platforms/WebAssemblyPlatform.hx b/tools/platforms/WebAssemblyPlatform.hx index d79827769..b7e48b255 100644 --- a/tools/platforms/WebAssemblyPlatform.hx +++ b/tools/platforms/WebAssemblyPlatform.hx @@ -206,6 +206,10 @@ class WebAssemblyPlatform extends PlatformTarget args.push("ASSERTIONS=1"); } + // set initial size + args.push("-s"); + args.push("TOTAL_MEMORY=32MB"); + if (project.targetFlags.exists("final")) { args.push("-O3");