Open Bug 535583 Opened 15 years ago Updated 2 years ago

high CPU when animated image no longer active (chrome - nsITreeView imageSrc)

Categories

(Core :: Layout: Images, Video, and HTML Frames, defect)

1.9.2 Branch
x86_64
Windows Vista
defect

Tracking

()

People

(Reporter: alta88, Unassigned)

References

Details

Attachments

(1 file)

2.21 KB, application/x-javascript
Details
i have the below nsITreeView code and css pseudoclass rule.  if the |busy| condition is no longer true, the throbber image no longer displays.  but cpu is very high, and only when Fx is in the foreground and the formerly busy tree row(s) is/are visible.  in this case, it seems the row(s) keeps getting invalidated many times a second (by either invalidate() or invalidateRow() or invalidateRange()) and no nulling of the view breaks the cycle.

this may be related to Bug 526718 but that seems more for content.

getCellProperties: function(aRow, aColumn, aProperties) {
  ..
  if (busy)
    aProperties.AppendElement(this._getAtomFor("isBusy"));
  ..
}
getImageSrc: function(aRow, aColumn) {
  ..
  if (busy)
    return "";  // Let css set the image.
  ..
}
treechildren::-moz-tree-image(isBusy) {
  list-style-image: url("chrome://global/skin/icons/loading_16.png");
}
copying marco as i'm using the Places treeview.
Depends on: 666446
alta88 can you confirm this is still an issue?
Also, would it be possible for you to post a self-contained test case (one that isn't working for you) as a link?
Attached file testcase
the problem seems lessened but not eliminated.  cpu is not as high as before (from memory clearly), it remains ~5% (on a dual processor) even after the image is no longer animated, about the same as when animated.  treeview runs high merely mousing over, its just its nature.  but no mouse, no focus, no activity should not have any cpu when the image is no longer animated.

attached is a userChromJS[1] script.  open Library and use DOMi to set an attribute of "busy" = "true" on <tree> #placesList. focus Library to start the throbber in the Downloads folder.  set "busy" to "false" to stop.

this was for the old Snowl project which is no longer active, which reused the places code, thus the testcase.  tested on recent Nightly 11.

[1] http://userchromejs.mozdev.org/
I'm seeing something similar to this in Komodo 7.0, built on Mozilla 7.0.0

My code is very similar to alta88's, except I don't implement getImageSrc.
I just rely on CSS -moz-tree-image properties to use the appropriate icon.

You can repro it by downloading Komodo IDE (Mozilla has a site license,
others can get a free trial license), selecting the Database explorer
in the left sidebar, and loading the two sqlite databases that can be
found in the Komodo profile dir.

The simply open and close one of the nodes.  When a node is opened or closed,
its icon is temporarily changed to an animated png (a loading throbber).
For a local sqlite file, the throbber is only up for about 200 msec, but
putting in a delay of up to a second changes nothing.

CPU will go up and stay up.

Digging in, I find that imgRequest::FrameChanged is getting invoked repeatedly,
although I didn't determine what code is calling that method.  Debugging
with gdb wasn't working -- I had to use print statements, and couldn't
find the code that was invoking that, so it's most likely called from a
dispatch table.

The high CPU and unexplained calls to imgRequest::FrameChanged stop
happening when I comment out the icon-changing code.
This happens on any platform

Please change "hi" in title to "high" to improve chances of finding this bug via search.
Workaround: 

In the CSS rule
treechildren#dbexplorer-body::-moz-tree-image(busy) {

/*replace*/
  list-style-image: url("chrome://global/skin/icons/loading_16.png");
/* with */
  list-style-image: url("chrome://dbexplorer/skin/hourglass.png");
}

where hourglass.png is a static image from the famfamfam icon set.
  

Komodo bug ref: http://bugs.activestate.com/show_bug.cgi?id=94411
Summary: Hi CPU when animated image no longer active (chrome - nsITreeView imageSrc) → high CPU when animated image no longer active (chrome - nsITreeView imageSrc)
(In reply to Eric Promislow from comment #7)
> Workaround: 

well, a workaround to not use an animated image isn't really a workaround ;)

i would like to consider implementing the treeview throbber for busy thunderbird feeds, the animation makes a very large difference in UX imo.  it would be nice to finish off the remaining part of the original bug.
Product: Core → Core Graveyard
Product: Core Graveyard → Core
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: