1.1.1 Handlerefresh
From the name, this function handles "refresh." After the difference between the old and the new version, we feel that this place should be the legacy of the old version of the "Scrap." In other words, it has no effect on the handling of Messagequeue::refresh events.
void Surfaceflinger::handlerefresh ()
{
BOOL Needinvalidate =false;
Const layervector¤tlayers (MDRAWINGSTATE.LAYERSSORTEDBYZ);
Const size_t Count =currentlayers.size ();
for (size_t i=0; i<count; i++) {
constsp<layerbase>& layer (currentlayers[i]);
if (Layer->onprecomposition ()) {
Needinvalidate =true;
}
}
if (needinvalidate) {
Signallayerupdate ();
}
}
This function is very simple, first call each layer onprecomposition, to determine whether the need for needinvalidate, the condition is layer:: mqueuedframes>0.
At the end of the function, it calls Signallayerupdate:
void Surfaceflinger::signallayerupdate () {
Meventqueue.invalidate ();
}
It can be seen that it is just directly using the Messagequeue::invalidate ():
void Messagequeue::invalidate () {
Mevents->requestnextvsync ();
}
The final requestnextvsync is used to schedule the next VSync event, which is valid only if the vsync rate is 0 o'clock. That is to say, only when we shut down the active escalation of the vsync, it does not match the previous analysis. So we can ignore Handlerefresh and believe that it will be cleaned up in the next release.
Source: From Lxs. http://blog.csdn.net/uiop78uiop78/