зеркало из https://github.com/mozilla/pjs.git
[not part of build]
Mark cache entry meta data dirty when key/value pair added.
This commit is contained in:
Родитель
8901ec09dd
Коммит
d7b78b8520
|
@ -109,7 +109,11 @@ nsCacheEntry::SetMetaDataElement( const nsAReadableCString& key,
|
|||
if (!mMetaData)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return mMetaData->SetElement(&key, &value);
|
||||
nsresult rv = mMetaData->SetElement(key, value);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
MarkMetaDataDirty();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -84,31 +84,29 @@ nsCacheMetaData::GetElement(const nsAReadableCString * key)
|
|||
|
||||
|
||||
nsresult
|
||||
nsCacheMetaData::SetElement(const nsAReadableCString * key,
|
||||
const nsAReadableCString * value)
|
||||
nsCacheMetaData::SetElement(const nsAReadableCString& key,
|
||||
const nsAReadableCString& value)
|
||||
{
|
||||
nsCacheMetaDataHashTableEntry * metaEntry;
|
||||
|
||||
NS_ASSERTION(initialized, "nsCacheMetaDataHashTable not initialized");
|
||||
if (!key) return NS_ERROR_NULL_POINTER;
|
||||
//** should value == nsnull remove the key?
|
||||
|
||||
//** should empty value remove the key?
|
||||
|
||||
metaEntry = (nsCacheMetaDataHashTableEntry *)
|
||||
PL_DHashTableOperate(&table, key, PL_DHASH_ADD);
|
||||
PL_DHashTableOperate(&table, &key, PL_DHASH_ADD);
|
||||
if (metaEntry->key == nsnull) {
|
||||
metaEntry->key = new nsCString(*key);
|
||||
metaEntry->key = new nsCString(key);
|
||||
if (metaEntry->key == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
if (metaEntry->value != nsnull)
|
||||
delete metaEntry->value;
|
||||
|
||||
if (value) {
|
||||
metaEntry->value = new nsCString(*value);
|
||||
if (metaEntry->value == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
} else {
|
||||
metaEntry->value = nsnull;
|
||||
metaEntry->value = new nsCString(value);
|
||||
if (metaEntry->value == nsnull) {
|
||||
//** remove key?
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -53,8 +53,8 @@ public:
|
|||
|
||||
nsAReadableCString * GetElement(const nsAReadableCString * key);
|
||||
|
||||
nsresult SetElement(const nsAReadableCString * key,
|
||||
const nsAReadableCString * value);
|
||||
nsresult SetElement(const nsAReadableCString& key,
|
||||
const nsAReadableCString& value);
|
||||
|
||||
nsresult GetKeyValueArray(nsCacheMetaDataKeyValuePair ** array,
|
||||
PRUint32 * count);
|
||||
|
|
Загрузка…
Ссылка в новой задаче