Confirmed users
205
edits
Wmccloskey (talk | contribs) (update brownbag url) |
Bevis Tseng (talk | contribs) (Update the order of Q&A and add more explanation of "Q2: How should I start labeling?" to emphasize the help we need from people in all sub-system.) |
||
| Line 238: | Line 238: | ||
= FAQ = | = FAQ = | ||
=== | === Q1: What is the impact of leaving a runnable unlabeled? === | ||
<b>A:</b> | <b>A:</b> Say the event queue contains these runnables: [F1, B1, F2, B2, F3]. Assume that the F runnables are for the foreground tab and the B runnables are for a background tab. Then we could run F1, F2, and F3 before we run any of the B runnables. That's good. | ||
However, say the event queue contains: [F1, B1, F2, B2, X, F3]. Assume that X is an unlabeled runnable dispatched using NS_DispatchToMainThread. We can run F1 and F2. However, before we can run F3, we need to run B1, B2, and X. That's bad. Why is that? | |||
If | Well, X could be an F runnable (so maybe X = F2.5). If we ran F1, F2, F3 before the other runnables, then we would run F's events out of order (since F3 would run before F2.5). Therefore we need to run X before we run F3. | ||
However, X might also be a B runnable (so X = B3). Because of that, we need to run B1 and B2 before we run X. In total, B1, B2, and X must run before F3. | |||
So if we find an unlabeled event X in the queue, we need to run all the events before it before we can run any event after it. However, if we label X as a SystemGroup runnable, then we know it has no effect on the F or the B tabs. So it's fine to run it whenever we want. Therefore we could run F1, F2, F3 before any other runnables. | |||
=== Q2: How should I start labeling? === | |||
<b>A:</b> | <b>A:</b> For people who want to participate in these labeling tasks, there is a list of good labeling bugs is linked off [https://bugzilla.mozilla.org/show_bug.cgi?id=labeling bug 1321812]. We will use telemetry to decide which runnables are most important, and updates will be posted to that bug. (Note: the analysis of the telemetry is available in [https://bugzilla.mozilla.org/show_bug.cgi?id=1333984 bug 1333984].) | ||
For sub-system experts, besides clearing the list above related to your sub-system, we need your help to look for calls to NS_DispatchTo{Main,Current}Thread or nsIThread::Dispatch, and the use cases of TimerCallback and IPC actor childs in your sub-system to file more bugs to ensure that all runnables to be labeled are covered and will be fixed. In general, no matter how frequent the runnable appears in the analysis list, '''all main-thread runnables in the content process need to be lableled''' to prevent the impact explained in Q1 because the happened rate will be the accumulation of the happened rates of all these unlabeled runnables. Otherwise, the benefit we get from Quantum-DOM will be significantly reduced. | |||
=== Q3: How do I specify a label for an nsITimer TimerCallback? === | |||
<b>A:</b> This can be done by <code>nsITimer::SetTarget(nsIEventTarget*)</code> combined with <code>EventTargetFor</code>. See the XMLHttpRequest example above. | |||
< | === Q4: Will the <code>TaskCategory</code> be used for prioritizing in the future? === | ||
If it will, how can developers ensure that the ordering won't be a problem if tasks are labeled in different categories in current developing stage? | |||
<b>A:</b> It may be used for scheduling in the future. Generally, anything that's not marked as Other should come from some outside source (usually IPC, but also from a timer). In that case, we have a lot of freedom about when to schedule it. So there shouldn't be too many concerns about breaking things as long as people follow that rule. | |||
=== Q5: Do runnables need to be labeled in the main process? === | |||
<b>A:</b> No. Only content process runnables need to be labeled. But labeling other runnables won't break anything. | |||