Bug 734469 - Clients stage table missing during sync. r=rnewman

This commit is contained in:
Marina Samuel 2012-03-15 16:19:28 -07:00
Родитель ad304c263e
Коммит 8c83218e3b
4 изменённых файлов: 30 добавлений и 2 удалений

Просмотреть файл

@ -121,4 +121,7 @@ public class AndroidBrowserHistoryDataAccessor extends AndroidBrowserRepositoryD
dataExtender.delete(guid); dataExtender.delete(guid);
} }
public void closeExtender() {
dataExtender.close();
}
} }

Просмотреть файл

@ -6,8 +6,10 @@ package org.mozilla.gecko.sync.repositories.android;
import org.json.simple.JSONArray; import org.json.simple.JSONArray;
import org.json.simple.JSONObject; import org.json.simple.JSONObject;
import org.mozilla.gecko.sync.repositories.InactiveSessionException;
import org.mozilla.gecko.sync.repositories.NullCursorException; import org.mozilla.gecko.sync.repositories.NullCursorException;
import org.mozilla.gecko.sync.repositories.Repository; import org.mozilla.gecko.sync.repositories.Repository;
import org.mozilla.gecko.sync.repositories.delegates.RepositorySessionFinishDelegate;
import org.mozilla.gecko.sync.repositories.domain.HistoryRecord; import org.mozilla.gecko.sync.repositories.domain.HistoryRecord;
import org.mozilla.gecko.sync.repositories.domain.Record; import org.mozilla.gecko.sync.repositories.domain.Record;
@ -96,4 +98,16 @@ public class AndroidBrowserHistoryRepositorySession extends AndroidBrowserReposi
protected Record prepareRecord(Record record) { protected Record prepareRecord(Record record) {
return record; return record;
} }
@Override
public void abort() {
((AndroidBrowserHistoryDataAccessor) dbHelper).closeExtender();
super.abort();
}
@Override
public void finish(final RepositorySessionFinishDelegate delegate) throws InactiveSessionException {
((AndroidBrowserHistoryDataAccessor) dbHelper).closeExtender();
super.finish(delegate);
}
} }

Просмотреть файл

@ -649,4 +649,9 @@ public abstract class AndroidBrowserRepositorySession extends StoreTrackingRepos
delegate.onWipeSucceeded(); delegate.onWipeSucceeded();
} }
} }
// For testing purposes.
public AndroidBrowserRepositoryDataAccessor getDBHelper() {
return dbHelper;
}
} }

Просмотреть файл

@ -18,8 +18,8 @@ public abstract class CachedSQLiteOpenHelper extends SQLiteOpenHelper {
// Cache these so we don't have to track them across cursors. Call `close` // Cache these so we don't have to track them across cursors. Call `close`
// when you're done. // when you're done.
private static SQLiteDatabase readableDatabase; private SQLiteDatabase readableDatabase;
private static SQLiteDatabase writableDatabase; private SQLiteDatabase writableDatabase;
synchronized protected SQLiteDatabase getCachedReadableDatabase() { synchronized protected SQLiteDatabase getCachedReadableDatabase() {
if (readableDatabase == null) { if (readableDatabase == null) {
@ -52,4 +52,10 @@ public abstract class CachedSQLiteOpenHelper extends SQLiteOpenHelper {
} }
super.close(); super.close();
} }
// Used for testing.
public boolean isClosed() {
return readableDatabase == null &&
writableDatabase == null;
}
} }