public long getTotalUsage() { long usage = 0; if (mLocalStorageInfo != null) { usage += mLocalStorageInfo.getSize(); } for (StorageInfo info : mStorageInfo) { usage += info.getSize(); } return usage; }
public void clearAllStoredData(final StoredDataClearedCallback callback) { if (mLocalStorageInfo != null) { mLocalStorageInfo.clear(); mLocalStorageInfo = null; } mStorageInfoCallbacksLeft = mStorageInfo.size(); if (mStorageInfoCallbacksLeft > 0) { for (StorageInfo info : mStorageInfo) { info.clear( new WebsitePreferenceBridge.StorageInfoClearedCallback() { @Override public void onStorageInfoCleared() { if (--mStorageInfoCallbacksLeft == 0) callback.onStoredDataCleared(); } }); } mStorageInfo.clear(); } else { callback.onStoredDataCleared(); } }