Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b5431c7f authored by Sam Maier's avatar Sam Maier
Browse files

Don't wait on lock in getClassLoader if already cached.

Currently, we are blocking on a lock which is not necessary if we have already cached the value. Chrome is seeing real-world pain from this - we have a background task that sits for a while in constructSplit (spinning up a large ClassLoader), and our main thread is blocking on this mLock for absolutely no purpose.

Change-Id: I9ddadde23ffd9e04988c8f1933d2c8652bc5f222
parent 8d209a38
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1129,6 +1129,10 @@ public final class LoadedApk {

    @UnsupportedAppUsage
    public ClassLoader getClassLoader() {
        ClassLoader ret = mClassLoader;
        if (ret != null) {
            return ret;
        }
        synchronized (mLock) {
            if (mClassLoader == null) {
                createOrUpdateClassLoaderLocked(null /*addedPaths*/);