| 15 | } |
| 16 | |
| 17 | void FrameRedrawRequest::requestFrame( size_t millisecondsInterval ) |
| 18 | { |
| 19 | // do not do it too frequently not to overload the renderer |
| 20 | auto minInterval = std::chrono::milliseconds( millisecondsInterval ); |
| 21 | // make request |
| 22 | #ifdef __EMSCRIPTEN__ |
| 23 | bool testFrameOrder = false; |
| 24 | if ( frameRequested_.compare_exchange_strong( testFrameOrder, true ) ) |
| 25 | { |
| 26 | #pragma clang diagnostic push |
| 27 | #pragma clang diagnostic ignored "-Wdollar-in-identifier-extension" |
| 28 | MAIN_THREAD_EM_ASM( postEmptyEvent( $0, 2 ), int( minInterval.count() ) ); |
| 29 | #pragma clang diagnostic pop |
| 30 | } |
| 31 | #else |
| 32 | asyncRequest_.requestIfNotSet( std::chrono::system_clock::now() + minInterval, [] () |
| 33 | { |
| 34 | getViewerInstance().postEmptyEvent(); |
| 35 | } ); |
| 36 | #endif |
| 37 | } |
| 38 | |
| 39 | } |
no test coverage detected