Bug 1041082 - Don't perform double-checked locking in GeckoInputConnection; r=rnewman

This commit is contained in:
Jim Chen 2014-08-05 12:41:09 -04:00
Родитель 9e51ca16d9
Коммит 9e9c77463b
1 изменённых файлов: 3 добавлений и 6 удалений

Просмотреть файл

@ -517,7 +517,8 @@ class GeckoInputConnection
GeckoInputConnection.class.notify();
}
Looper.loop();
sBackgroundHandler = null;
// We should never be exiting the thread loop.
throw new IllegalThreadStateException("unreachable code");
}
}, LOGTAG);
backgroundThread.setDaemon(true);
@ -562,11 +563,7 @@ class GeckoInputConnection
if (!canReturnCustomHandler()) {
return defHandler;
}
// getBackgroundHandler() is synchronized and requires locking,
// but if we already have our handler, we don't have to lock
final Handler newHandler = sBackgroundHandler != null
? sBackgroundHandler
: getBackgroundHandler();
final Handler newHandler = getBackgroundHandler();
if (mEditableClient.setInputConnectionHandler(newHandler)) {
return newHandler;
}