зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1118216 - Stop recycling Message instances, as it's unnecessary r=rnewman
This commit is contained in:
Родитель
ff5cd770b3
Коммит
e2f3783376
|
@ -2460,27 +2460,21 @@ public class GeckoAppShell
|
|||
Handler geckoHandler = ThreadUtils.sGeckoHandler;
|
||||
Message msg = getNextMessageFromQueue(ThreadUtils.sGeckoQueue);
|
||||
|
||||
if (msg == null)
|
||||
if (msg == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (msg.obj == geckoHandler && msg.getTarget() == geckoHandler) {
|
||||
// Our "queue is empty" message; see runGecko()
|
||||
msg.recycle();
|
||||
return false;
|
||||
}
|
||||
if (msg.getTarget() == null)
|
||||
Looper.myLooper().quit();
|
||||
else
|
||||
msg.getTarget().dispatchMessage(msg);
|
||||
|
||||
try {
|
||||
// Bug 1055166 - this sometimes throws IllegalStateException on Android L.
|
||||
// There appears to be no way to figure out if a message is in use or not, let
|
||||
// alone receive a notification when it is no longer being used. Just catch
|
||||
// the exception for now, and if a better solution comes along we can use it.
|
||||
msg.recycle();
|
||||
} catch (IllegalStateException e) {
|
||||
// There is nothing we can do here so just eat it
|
||||
if (msg.getTarget() == null) {
|
||||
Looper.myLooper().quit();
|
||||
} else {
|
||||
msg.getTarget().dispatchMessage(msg);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче