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

Commit f9580d59 authored by Ben Murdoch's avatar Ben Murdoch Committed by Android (Google) Code Review
Browse files

Merge "Cleanup for bug 5278763"

parents c70f6af3 87af7314
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -88,6 +88,10 @@ public final class CookieSyncManager extends WebSyncManager {
     */
    public static synchronized CookieSyncManager createInstance(
            Context context) {
        if (context == null) {
            throw new IllegalArgumentException("Invalid context argument");
        }

        JniUtil.setContext(context);
        Context appContext = context.getApplicationContext();
        if (sRef == null) {
+7 −9
Original line number Diff line number Diff line
@@ -39,25 +39,21 @@ class JniUtil {
    private static Boolean sUseChromiumHttpStack;
    private static Context sContext;

    private static boolean initialized = false;

    private static void checkInitialized() {
        if (!initialized) {
        if (sContext == null) {
            throw new IllegalStateException("Call CookieSyncManager::createInstance() or create a webview before using this class");
        }
    }

    protected static synchronized void setContext(Context context) {
        if (initialized)
        if (sContext != null) {
            return;
        }

        sContext = context.getApplicationContext();
        initialized = true;
    }

    protected static synchronized Context getContext() {
        if (!initialized)
            return null;
        return sContext;
    }

@@ -68,8 +64,9 @@ class JniUtil {
    private static synchronized String getDatabaseDirectory() {
        checkInitialized();

        if (sDatabaseDirectory == null)
        if (sDatabaseDirectory == null) {
            sDatabaseDirectory = sContext.getDatabasePath("dummy").getParent();
        }

        return sDatabaseDirectory;
    }
@@ -81,8 +78,9 @@ class JniUtil {
    private static synchronized String getCacheDirectory() {
        checkInitialized();

        if (sCacheDirectory == null)
        if (sCacheDirectory == null) {
            sCacheDirectory = sContext.getCacheDir().getAbsolutePath();
        }

        return sCacheDirectory;
    }
+4 −0
Original line number Diff line number Diff line
@@ -1055,6 +1055,10 @@ public class WebView extends AbsoluteLayout
        super(context, attrs, defStyle);
        checkThread();

        if (context == null) {
            throw new IllegalArgumentException("Invalid context argument");
        }

        // Used by the chrome stack to find application paths
        JniUtil.setContext(context);