nsCacheService::SetMemoryCacheEnabled(MemoryCacheEnabled());
nsCacheService::SetMemoryCache();
nsCacheProfilePrefObserver::Observe(nsISupports *     subject,                                    const char *      topic,                                    const PRUnichar * data_unicode){    nsresult rv;    NS_ConvertUCS2toUTF8 data(data_unicode);    CACHE_LOG_ALWAYS(("Observe [topic=%s data=%s]\n", topic, data.get()));    if (!strcmp(NS_XPCOM_SHUTDOWN_OBSERVER_ID, topic)) {        // xpcom going away, shutdown cache service        if (nsCacheService::GlobalInstance())            nsCacheService::GlobalInstance()->Shutdown();        } else if (!strcmp("profile-before-change", topic)) {        // profile before change        mHaveProfile = PR_FALSE;        // XXX shutdown devices        nsCacheService::OnProfileShutdown(!strcmp("shutdown-cleanse",                                                  data.get()));            } else if (!strcmp("profile-after-change", topic)) {        // profile after change        mHaveProfile = PR_TRUE;        nsCOMPtr<nsIPrefBranch> branch = do_GetService(NS_PREFSERVICE_CONTRACTID);        ReadPrefs(branch);        nsCacheService::OnProfileChanged();        } else if (!strcmp(NS_PREFBRANCH_PREFCHANGE_TOPIC_ID, topic)) {        // ignore pref changes until we're done switch profiles        if (!mHaveProfile)  return NS_OK;        nsCOMPtr<nsIPrefBranch> branch = do_QueryInterface(subject, &rv);        if (NS_FAILED(rv))  return rv;#ifdef NECKO_DISK_CACHE        // which preference changed?        if (!strcmp(DISK_CACHE_ENABLE_PREF, data.get())) {            rv = branch->GetBoolPref(DISK_CACHE_ENABLE_PREF,                                     &mDiskCacheEnabled);            if (NS_FAILED(rv))  return rv;            nsCacheService::SetDiskCacheEnabled(DiskCacheEnabled());        } else if (!strcmp(DISK_CACHE_CAPACITY_PREF, data.get())) {            PRInt32 capacity = 0;            rv = branch->GetIntPref(DISK_CACHE_CAPACITY_PREF, &capacity);            if (NS_FAILED(rv))  return rv;            mDiskCacheCapacity = PR_MAX(0, capacity);            nsCacheService::SetDiskCacheCapacity(mDiskCacheCapacity);#if 0                    } else if (!strcmp(DISK_CACHE_DIR_PREF, data.get())) {            // XXX We probaby don't want to respond to this pref except after            // XXX profile changes.  Ideally, there should be somekind of user            // XXX notification that the pref change won't take effect until            // XXX the next time the profile changes (browser launch)#endif                    } else #endif // !NECKO_DISK_CACHE        if (!strcmp(MEMORY_CACHE_ENABLE_PREF, data.get())) {            rv = branch->GetBoolPref(MEMORY_CACHE_ENABLE_PREF,                                     &mMemoryCacheEnabled);            if (NS_FAILED(rv))  return rv;            nsCacheService::SetMemoryCacheEnabled(MemoryCacheEnabled());                    } else if (!strcmp(MEMORY_CACHE_CAPACITY_PREF, data.get())) {            (void) branch->GetIntPref(MEMORY_CACHE_CAPACITY_PREF,                                      &mMemoryCacheCapacity);            nsCacheService::SetMemoryCacheCapacity(mMemoryCacheCapacity);        }    }        return NS_OK;}