[Libreoffice-bugs] [Bug 107561] New: The while loop for Javascript presentation engine

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Tue May 2 10:56:43 UTC 2017


https://bugs.documentfoundation.org/show_bug.cgi?id=107561

            Bug ID: 107561
           Summary: The while loop for Javascript presentation engine
           Product: LibreOffice
           Version: 5.3.2.2 release
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Impress
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: wanliyou at gmail.com

Description:
Seems like exported JS presentation engine is directly generated from cpp
version, here:
https://github.com/LibreOffice/core/blob/2eae33e82e5f91d6dbaf7e8e848f53644596059d/slideshow/source/engine/slideshowimpl.cxx#L2370

The generated JS looks like this:
FrameSynchronization.prototype.synchronize = function()
{
if( this.bIsActive )
{
while( this.aTimer.getElapsedTime() < this.nNextFrameTargetTime )
;
} 
this.markCurrentFrame();
}

The while loop will be CPU hogging and make the UI no response, so I think this
kind of code should be optimized to schedule in a Timer/requestAnimationFrame.

FrameSynchronization.prototype.synchronize = function()
{
if ( this.bIsActive && ( this.aTimer.getElapsedTime() <
this.nNextFrameTargetTime )) {
   setTimeout(this.synchronize.bind(this), 16);
}
else {
   this.markCurrentFrame();
}
}



Steps to Reproduce:
1. Open a slide with long time animations
2.
3.

Actual Results:  
CPU hogging and janky animation

Expected Results:
Smooth animation and use much lesser CPU cycles.


Reproducible: Always

User Profile Reset: No

Additional Info:


User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20170502/6ed13fb2/attachment.html>


More information about the Libreoffice-bugs mailing list