Quantum/DOM: Difference between revisions

More clarification after talking to billm
(Tweak that)
(More clarification after talking to billm)
Line 19: Line 19:
= Labeling =
= Labeling =


A major task for the Quantum DOM project is to "label" runnables. with a DocGroup, TabGroup, or the SystemGroup. Using a DocGroup is preferred over using a TabGroup since TabGroup is less specific, but for some runnables the best we can do is give it a TabGroup. Runnables that do not affect web content at all should be labeled using the <b>SystemGroup</b>. However, only use the system group if you are absolutely sure that the runnable will not run any content JS code or have any affect on content DOM or layout.
A major task for the Quantum DOM project is to "label" runnables. Labeling refers to giving runnables names, and to associating them with a DocGroup, TabGroup, or the SystemGroup before they're dispatched. Associating runnables with a group is ultimately what will enable Quantum DOM to work, but at the very least runnables should be given a name (grouping can be more tricky than naming). If runnables are at least named then we can gather telemetry about which ungrouped runnables are the most common so that we can focus our efforts on grouping the most important runnables. (Ideally we'll name and group runnables at the same time though.)
 
In addition to labeling runnables with a group, it is preferred to name them at the same time to aid in debugging.


You can help by taking one of the unowned bugs to label runnables from the following list:
You can help by taking one of the unowned bugs to label runnables from the following list:
Line 34: Line 32:
</bugzilla>
</bugzilla>


== Obtaining the correct group ==
== Runnable naming ==


Given a document, you can find its DocGroup via nsIDocument::GetDocGroup.
Runnables should be named as follows:


Given an inner or outer window, you can find its TabGroup and DocGroup via nsPIDOMWindow::{TabGroup,GetDocGroup}. These methods should only be called on the main thread.
== Runnable naming convention ==
Runnables should be named as follows:
* If the runnable is a class that you define, its name should be the name of the class. Namespaces can be left off unless they are necessary for disambiguation. For example, if the runnable is simply called <code>Runnable</code>, then a namespace should be included. But if the runnable is <code>mozilla::dom::OffThreadScriptRunnable</code>, then the namespaces can be omitted.
* If the runnable is a class that you define, its name should be the name of the class. Namespaces can be left off unless they are necessary for disambiguation. For example, if the runnable is simply called <code>Runnable</code>, then a namespace should be included. But if the runnable is <code>mozilla::dom::OffThreadScriptRunnable</code>, then the namespaces can be omitted.
* If the runnable is a method (created via some variant of NewRunnableMethod), then the class name and method name should form the name. <code>"nsDocument::UpdateVisibilityState"</code> is a good example. Namespaces should be omitted as before unless they're necessary.
* If the runnable is a method (created via some variant of NewRunnableMethod), then the class name and method name should form the name. <code>"nsDocument::UpdateVisibilityState"</code> is a good example. Namespaces should be omitted as before unless they're necessary.
Line 48: Line 41:


If the runnable name would be ambiguous <i>and</i> it lives in an anonymous namespace, then make up a namespace that seems right.
If the runnable name would be ambiguous <i>and</i> it lives in an anonymous namespace, then make up a namespace that seems right.
== Runnable grouping ==
Using a DocGroup is preferred over using a TabGroup since TabGroup is less specific, but for some runnables the best we can do is give it a TabGroup. Runnables that do not affect web content at all should be labeled using the <b>SystemGroup</b>. However, only use the system group if you are absolutely sure that the runnable will not run any content JS code or have any affect on content DOM or layout.
Given a document, you can find its DocGroup via nsIDocument::GetDocGroup.
Given an inner or outer window, you can find its TabGroup and DocGroup via nsPIDOMWindow::{TabGroup,GetDocGroup}. These methods should only be called on the main thread.


== Dispatching ==
== Dispatching ==
Confirmed users, Bureaucrats and Sysops emeriti
969

edits