mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1186791 (part 3) - Replace nsBaseHashtable::EnumerateRead() calls in storage/ with iterators. r=mak.
This commit is contained in:
parent
82a0d5c8be
commit
d9a57fbac7
@ -194,30 +194,6 @@ void tracefunc (void *aClosure, const char *aStmt)
|
||||
aStmt));
|
||||
}
|
||||
|
||||
PLDHashOperator
|
||||
copyFunctionEnumerator(const nsACString &aKey,
|
||||
Connection::FunctionInfo aData,
|
||||
void *aUserArg)
|
||||
{
|
||||
NS_PRECONDITION(aData.type == Connection::FunctionInfo::SIMPLE ||
|
||||
aData.type == Connection::FunctionInfo::AGGREGATE,
|
||||
"Invalid function type!");
|
||||
|
||||
Connection *connection = static_cast<Connection *>(aUserArg);
|
||||
if (aData.type == Connection::FunctionInfo::SIMPLE) {
|
||||
mozIStorageFunction *function =
|
||||
static_cast<mozIStorageFunction *>(aData.function.get());
|
||||
(void)connection->CreateFunction(aKey, aData.numArgs, function);
|
||||
}
|
||||
else {
|
||||
mozIStorageAggregateFunction *function =
|
||||
static_cast<mozIStorageAggregateFunction *>(aData.function.get());
|
||||
(void)connection->CreateAggregateFunction(aKey, aData.numArgs, function);
|
||||
}
|
||||
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
void
|
||||
basicFunctionHelper(sqlite3_context *aCtx,
|
||||
int aArgc,
|
||||
@ -1338,7 +1314,31 @@ Connection::initializeClone(Connection* aClone, bool aReadOnly)
|
||||
|
||||
// Copy any functions that have been added to this connection.
|
||||
SQLiteMutexAutoLock lockedScope(sharedDBMutex);
|
||||
(void)mFunctions.EnumerateRead(copyFunctionEnumerator, aClone);
|
||||
for (auto iter = mFunctions.Iter(); !iter.Done(); iter.Next()) {
|
||||
const nsACString &key = iter.Key();
|
||||
Connection::FunctionInfo data = iter.UserData();
|
||||
|
||||
MOZ_ASSERT(data.type == Connection::FunctionInfo::SIMPLE ||
|
||||
data.type == Connection::FunctionInfo::AGGREGATE,
|
||||
"Invalid function type!");
|
||||
|
||||
if (data.type == Connection::FunctionInfo::SIMPLE) {
|
||||
mozIStorageFunction *function =
|
||||
static_cast<mozIStorageFunction *>(data.function.get());
|
||||
rv = aClone->CreateFunction(key, data.numArgs, function);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to copy function to cloned connection");
|
||||
}
|
||||
|
||||
} else {
|
||||
mozIStorageAggregateFunction *function =
|
||||
static_cast<mozIStorageAggregateFunction *>(data.function.get());
|
||||
rv = aClone->CreateAggregateFunction(key, data.numArgs, function);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to copy aggregate function to cloned connection");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user