Closed Bug 492857 Opened 15 years ago Closed 15 years ago

Suspend API for XPCJSRuntime::WatchdogMain

Categories

(Core :: JavaScript Engine, defect)

Other
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 477850

People

(Reporter: romaxa, Unassigned)

References

Details

On mobile it is very important to have possibility to suspend all not active applications.

On N810 and friends we have gecko process running as daemon in background, and usually it is consumes battery in just initialized state, even if there are no any page has been loaded.

"powertop -d -t 30" shows:

   6.7% (  2.0)          browserd : futex_wait (hrtimer_wakeup) 

And backtrace is:
(gdb) bt
#0  0x414e1be0 in pthread_cond_timedwait@@GLIBC_2.4 () from
/lib/libpthread.so.0
#1  0x414bc7e0 in pt_TimedWait (cv=0xcc188, ml=0xcb760, timeout=1000)
    at nsprpub/pr/src/pthreads/ptsynch.c:292
#2  0x414bd330 in PR_WaitCondVar (cvar=0xcc180, timeout=1000)
    at nsprpub/pr/src/pthreads/ptsynch.c:419
#3  0x408c699c in XPCJSRuntime::WatchdogMain (arg=<value optimized out>)
    at js/src/xpconnect/src/xpcjsruntime.cpp:816
#4  0x414c2ef4 in _pt_root (arg=<value optimized out>)
    at nsprpub/pr/src/pthreads/ptthread.c:228
#5  0x414da934 in start_thread () from /lib/libpthread.so.0
#6  0x4189abd8 in clone () from /lib/libc.so.6

I'm not sure what is the best way to solve this problem, but would it be possible to suspend WatchdogMain via some API, or by some other condition... when there are no active windows, or by some device state notifications.
We talked about this before, but we felt its not really that urgent atm since the browser itself wakes up a lot even when not looking at any pages or just having an empty page open.
> the browser itself wakes up a lot even when not looking at any pages or just
> having an empty page open.
I'm not sure what else is wakes up browser... but in our case after browserd restart only this function consumes battery, and we are restarting browserd process when last page is closed or browserui is closed.
Would it be possible to not start watchdog if there are no any events in nsAppShell? and somehow suspend watchdog if nsAppShell not processing any events for some time...
We have a suspend/resume patch. Maybe you want to give that a try?
Maybe dup this against this bug?

https://bugzilla.mozilla.org/show_bug.cgi?id=477850

I won't have time for this until after 3.5 but I can help if you want to get it landed.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.