Skip to content

Commit 99f6865

Browse files
Fix memory tests
1 parent 9387175 commit 99f6865

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

firebase-firestore/src/main/java/com/google/firebase/firestore/core/ComponentProvider.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public abstract class ComponentProvider {
4040
private RemoteStore remoteStore;
4141
private EventManager eventManager;
4242
private ConnectivityMonitor connectivityMonitor;
43-
private IndexBackfiller indexBackfiller;
43+
@Nullable private IndexBackfiller indexBackfiller;
4444
@Nullable private Scheduler garbageCollectionScheduler;
4545

4646
/** Configuration options for the component provider. */
@@ -109,6 +109,7 @@ public Scheduler getGarbageCollectionScheduler() {
109109
return garbageCollectionScheduler;
110110
}
111111

112+
@Nullable
112113
public IndexBackfiller getIndexBackfiller() {
113114
return indexBackfiller;
114115
}

firebase-firestore/src/main/java/com/google/firebase/firestore/local/LocalStore.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public final class LocalStore implements BundleCallback {
115115
private IndexManager indexManager;
116116

117117
/** Manages field index backfill. */
118-
private final IndexBackfiller indexBackfiller;
118+
private final @Nullable IndexBackfiller indexBackfiller;
119119

120120
/** The set of all mutations that have been sent but not yet been applied to the backend. */
121121
private MutationQueue mutationQueue;
@@ -152,7 +152,7 @@ public final class LocalStore implements BundleCallback {
152152

153153
public LocalStore(
154154
Persistence persistence,
155-
IndexBackfiller indexBackfiller,
155+
@Nullable IndexBackfiller indexBackfiller,
156156
QueryEngine queryEngine,
157157
User initialUser) {
158158
hardAssert(
@@ -168,15 +168,18 @@ public LocalStore(
168168
localDocuments =
169169
new LocalDocumentsView(remoteDocuments, mutationQueue, documentOverlayCache, indexManager);
170170
this.queryEngine = queryEngine;
171-
this.indexBackfiller = indexBackfiller;
172171
queryEngine.initialize(localDocuments, indexManager);
173172

174173
localViewReferences = new ReferenceSet();
175174
persistence.getReferenceDelegate().setInMemoryPins(localViewReferences);
176175

177176
remoteDocuments.setIndexManager(indexManager);
178-
indexBackfiller.setIndexManager(indexManager);
179-
indexBackfiller.setLocalDocumentsView(localDocuments);
177+
178+
this.indexBackfiller = indexBackfiller;
179+
if (indexBackfiller != null) {
180+
indexBackfiller.setIndexManager(indexManager);
181+
indexBackfiller.setLocalDocumentsView(localDocuments);
182+
}
180183

181184
queryDataByTarget = new SparseArray<>();
182185
targetIdByTarget = new HashMap<>();
@@ -218,8 +221,10 @@ public ImmutableSortedMap<DocumentKey, Document> handleUserChange(User user) {
218221

219222
// TODO(indexing): Add spec tests that test these components change after a user change
220223
remoteDocuments.setIndexManager(indexManager);
221-
indexBackfiller.setIndexManager(indexManager);
222-
indexBackfiller.setLocalDocumentsView(localDocuments);
224+
if (indexBackfiller != null) {
225+
indexBackfiller.setIndexManager(indexManager);
226+
indexBackfiller.setLocalDocumentsView(localDocuments);
227+
}
223228

224229
// Union the old/new changed keys.
225230
ImmutableSortedSet<DocumentKey> changedKeys = DocumentKey.emptyKeySet();

firebase-firestore/src/test/java/com/google/firebase/firestore/spec/SQLiteSpecTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ protected void specSetUp(JSONObject config) {
3333
super.specSetUp(config);
3434
}
3535

36-
@Override
37-
protected void specTearDown() throws Exception {
38-
super.specTearDown();
39-
}
40-
4136
@Override
4237
protected SQLiteComponentProvider initializeComponentProvider(
4338
ComponentProvider.Configuration configuration, boolean garbageCollectionEnabled) {

0 commit comments

Comments
 (0)