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

Commit 8ac14f5a authored by Ebrahem Qassem's avatar Ebrahem Qassem Committed by Steve Kondik
Browse files

net: customize memory cache size

Change-Id: I2b7cc83707a567676550be2639095c5bb28dc6dc
parent ac187b6f
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
/*
 * Copyright (C) 2006 The Android Open Source Project
 * Copyright (C) 2011, 2012 Code Aurora Forum. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -32,6 +33,7 @@ import android.net.http.SslCertificate;
import android.net.http.SslError;
import android.os.Handler;
import android.os.Message;
import android.os.SystemProperties;
import android.util.Log;
import android.util.TypedValue;
import android.view.Surface;
@@ -212,11 +214,13 @@ class BrowserFrame extends Handler {
            // set WebCore native cache size
            ActivityManager am = (ActivityManager) context
                    .getSystemService(Context.ACTIVITY_SERVICE);
            if (am.getMemoryClass() > 16) {
                sJavaBridge.setCacheSize(8 * 1024 * 1024);
            } else {
                sJavaBridge.setCacheSize(4 * 1024 * 1024);
            int defCacheSize = am.getMemoryClass() > 16 ?
                8 * 1024 * 1024 : 4 * 1024 * 1024;
            int cacheSize = SystemProperties.getInt("net.webkit.cache.size", defCacheSize);
            if ((cacheSize < 0) || (cacheSize > (100 * 1024 * 1024))) {
                cacheSize = defCacheSize;
            }
            sJavaBridge.setCacheSize(cacheSize);
            // initialize CacheManager
            CacheManager.init(appContext);
            // create CookieSyncManager with current Context