mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1014988 - Use Context.MODE_ENABLE_WRITE_AHEAD_LOGGING when opening databases. r=bnicholson
This commit is contained in:
parent
711a65f180
commit
c325343b1d
@ -1722,8 +1722,13 @@ final class BrowserDatabaseHelper extends SQLiteOpenHelper {
|
||||
// From Honeycomb on, it's possible to run several db
|
||||
// commands in parallel using multiple connections.
|
||||
if (Build.VERSION.SDK_INT >= 11) {
|
||||
db.enableWriteAheadLogging();
|
||||
db.setLockingEnabled(false);
|
||||
// Modern Android allows WAL to be enabled through a mode flag.
|
||||
if (Build.VERSION.SDK_INT < 16) {
|
||||
db.enableWriteAheadLogging();
|
||||
|
||||
// This does nothing on 16+.
|
||||
db.setLockingEnabled(false);
|
||||
}
|
||||
} else {
|
||||
// Pre-Honeycomb, we can do some lesser optimizations.
|
||||
cursor = null;
|
||||
|
@ -8,6 +8,7 @@ import org.mozilla.gecko.db.PerProfileDatabases.DatabaseHelperFactory;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.os.Build;
|
||||
|
||||
/**
|
||||
* Abstract class containing methods needed to make a SQLite-based content
|
||||
@ -40,7 +41,11 @@ public abstract class PerProfileDatabaseProvider<T extends SQLiteOpenHelper> ext
|
||||
getContext(), getDatabaseName(), new DatabaseHelperFactory<T>() {
|
||||
@Override
|
||||
public T makeDatabaseHelper(Context context, String databasePath) {
|
||||
return createDatabaseHelper(context, databasePath);
|
||||
final T helper = createDatabaseHelper(context, databasePath);
|
||||
if (Build.VERSION.SDK_INT >= 16) {
|
||||
helper.setWriteAheadLoggingEnabled(true);
|
||||
}
|
||||
return helper;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
@ -48,7 +49,11 @@ public abstract class SharedBrowserDatabaseProvider extends AbstractPerProfileDa
|
||||
final DatabaseHelperFactory<BrowserDatabaseHelper> helperFactory = new DatabaseHelperFactory<BrowserDatabaseHelper>() {
|
||||
@Override
|
||||
public BrowserDatabaseHelper makeDatabaseHelper(Context context, String databasePath) {
|
||||
return new BrowserDatabaseHelper(context, databasePath);
|
||||
final BrowserDatabaseHelper helper = new BrowserDatabaseHelper(context, databasePath);
|
||||
if (Build.VERSION.SDK_INT >= 16) {
|
||||
helper.setWriteAheadLoggingEnabled(true);
|
||||
}
|
||||
return helper;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -20,6 +20,7 @@ import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.database.sqlite.SQLiteQueryBuilder;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
|
||||
public class TabsProvider extends PerProfileDatabaseProvider<TabsProvider.TabsDatabaseHelper> {
|
||||
@ -154,7 +155,10 @@ public class TabsProvider extends PerProfileDatabaseProvider<TabsProvider.TabsDa
|
||||
db.rawQuery("PRAGMA synchronous=OFF", null).close();
|
||||
|
||||
if (shouldUseTransactions()) {
|
||||
db.enableWriteAheadLogging();
|
||||
// Modern Android allows WAL to be enabled through a mode flag.
|
||||
if (Build.VERSION.SDK_INT < 16) {
|
||||
db.enableWriteAheadLogging();
|
||||
}
|
||||
db.setLockingEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user