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