зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1698595) for causing android bustages.
CLOSED TREE Backed out changeset 7499c42b9196 (bug 1698595) Backed out changeset 063efdbdbb14 (bug 1698595)
This commit is contained in:
Родитель
8031c3a6ce
Коммит
2408151c29
|
@ -90,13 +90,6 @@ elif CONFIG['HAVE_64BIT_BUILD']:
|
|||
# vs files created by other Sqlite instances in the system.
|
||||
DEFINES['SQLITE_TEMP_FILE_PREFIX'] = '"mz_etilqs_"'
|
||||
|
||||
# Enabling sqlite math functions
|
||||
DEFINES['SQLITE_ENABLE_MATH_FUNCTIONS'] = True
|
||||
if CONFIG["OS_TARGET"] == "Linux":
|
||||
OS_LIBS += [
|
||||
"m"
|
||||
]
|
||||
|
||||
# Suppress warnings in third-party code.
|
||||
if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
|
||||
CFLAGS += [
|
||||
|
|
|
@ -1506,6 +1506,8 @@ nsresult Database::InitFunctions() {
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = IsFrecencyDecayingFunction::create(mMainConn);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = SqrtFunction::create(mMainConn);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = NoteSyncChangeFunction::create(mMainConn);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = InvalidateDaysOfHistoryFunction::create(mMainConn);
|
||||
|
|
|
@ -1128,6 +1128,39 @@ IsFrecencyDecayingFunction::OnFunctionCall(mozIStorageValueArray* aArgs,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//// sqrt function
|
||||
|
||||
/* static */
|
||||
nsresult SqrtFunction::create(mozIStorageConnection* aDBConn) {
|
||||
RefPtr<SqrtFunction> function = new SqrtFunction();
|
||||
nsresult rv = aDBConn->CreateFunction("sqrt"_ns, 1, function);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(SqrtFunction, mozIStorageFunction)
|
||||
|
||||
NS_IMETHODIMP
|
||||
SqrtFunction::OnFunctionCall(mozIStorageValueArray* aArgs,
|
||||
nsIVariant** _result) {
|
||||
MOZ_ASSERT(aArgs);
|
||||
|
||||
uint32_t numArgs;
|
||||
nsresult rv = aArgs->GetNumEntries(&numArgs);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
MOZ_ASSERT(numArgs == 1);
|
||||
|
||||
double value = aArgs->AsDouble(0);
|
||||
|
||||
RefPtr<nsVariant> result = new nsVariant();
|
||||
rv = result->SetAsDouble(sqrt(value));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
result.forget(_result);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//// Note Sync Change Function
|
||||
|
||||
|
|
|
@ -518,6 +518,29 @@ class IsFrecencyDecayingFunction final : public mozIStorageFunction {
|
|||
~IsFrecencyDecayingFunction() = default;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//// sqrt function
|
||||
|
||||
/**
|
||||
* Gets the square root of a given value.
|
||||
*/
|
||||
class SqrtFunction final : public mozIStorageFunction {
|
||||
public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_MOZISTORAGEFUNCTION
|
||||
|
||||
/**
|
||||
* Registers the function with the specified database connection.
|
||||
*
|
||||
* @param aDBConn
|
||||
* The database connection to register with.
|
||||
*/
|
||||
static nsresult create(mozIStorageConnection* aDBConn);
|
||||
|
||||
private:
|
||||
~SqrtFunction() = default;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//// Note Sync Change Function
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче