W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2009

Re: solving the CPU usage issue for non-visible pages

From: Brian Kardell <bkardell@gmail.com>
Date: Tue, 20 Oct 2009 20:34:40 -0700
Message-ID: <8fcaeb2c0910202034u1cfdae0ak6eda1bcb2cbd6bf1@mail.gmail.com>
To: robert@ocallahan.org
Cc: Maciej Stachowiak <mjs@apple.com>, "Ennals, Robert" <robert.ennals@intel.com>, Jonas Sicking <jonas@sicking.cc>, "public-webapps@w3.org" <public-webapps@w3.org>
I like window.hasAttention if you can even vaguely define what it
means... It's pointless to make it so vague that useful things will
work differently in different browsers by accident rather than by
design (for example, it might be ok for mobile devices to work
differently by design, but it would royally stink to have a particular
application (like gmail and wave which I think were mentioned earlier)
work fundamentally differently in different browsers - so that's kind
of what I'm trying to get at:  There really seem to be a few classes
of things, which ones mean that your window "has attention"?

Some things might be tougher than they are worth and probably exceed
the practices of even the best non-web-based solutions... I think that
primarily, relying on an OS level maintenance for things like low
power mode is more rational than requiring each JavaScript programmer
dealing with it individually..

browser windows that are minimized and inactive tabs are certainly a
related class of problem and seem like the simplest one.  Other things
I think are more debatable, but potentially useful... I'm not sure.  I
think that it would be tremendously hard for a programmer to "guess"
some of these things in such a way that they would be easily
predictable for users without some kind of prompting if you're not
careful... For example, I recently the Image Evolution demo from
http://www.canvasdemos.com/2009/07/15/image-evolution/ as a kind of a
performance test and let it run for three days - during which it was
not "visible" 99.999% of the time.  Should processing stop - or just
painting?  Painting wont happen because the OS says it wont right?





On Tue, Oct 20, 2009 at 8:16 PM, Robert O'Callahan <robert@ocallahan.org> wrote:
> On Wed, Oct 21, 2009 at 3:57 PM, Brian Kardell <bkardell@gmail.com> wrote:
>>
>> Is it really the visibility of the page that is being queried - or the
>> some kind of state of a window?  Maybe it's a silly bit of semantics,
>> but it seems clearer to me that most of the things discussed here are
>> about a whole window/tab being "minimized" (either to a taskbar or tab
>> or something).  If I have one app open and it is covering a browser
>> window - the browser window is not visible (it's lower in the stacking
>> order).  Likewise, a page is generally "partially" visible
>> (scrollbars) so that seems more confusing than it needs to be too.
>
> There are lots of reasons why the browser might deduce that the user is not
> paying attention to a document, e.g.
> -- the browser window containing the document is minimized
> -- the tab containing the document is hidden
> -- the document is in an IFRAME and scrolled offscreen
> -- the browser window is buried behind other windows on the desktop
> -- the screen is dimmed for power saving
> -- gaze tracking detects that the user is looking somewhere else
> -- ultrasonic pings detect that the user is not there
>
> If we need an API beyond just animation, you might as well call it something
> like window.hasAttention so browsers can cover all of those cases.
>
> Rob
> --
> "He was pierced for our transgressions, he was crushed for our iniquities;
> the punishment that brought us peace was upon him, and by his wounds we are
> healed. We all, like sheep, have gone astray, each of us has turned to his
> own way; and the LORD has laid on him the iniquity of us all." [Isaiah
> 53:5-6]
>
Received on Wednesday, 21 October 2009 12:21:30 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:34 GMT