Skip to content

Commit b70157c

Browse files
committed
Review feedback
1 parent 36d8596 commit b70157c

File tree

3 files changed

+23
-18
lines changed

3 files changed

+23
-18
lines changed

Firestore/Example/Firestore.xcodeproj/project.pbxproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@
283283
132E36BB104830BD806351AC /* FSTLevelDBTransactionTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FSTLevelDBTransactionTests.mm; sourceTree = "<group>"; };
284284
2A0CF41BA5AED6049B0BEB2C /* type_traits_apple_test.mm */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.objcpp; path = type_traits_apple_test.mm; sourceTree = "<group>"; };
285285
2B50B3A0DF77100EEE887891 /* Pods_Firestore_Tests_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Firestore_Tests_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
286-
358C3B5FE573B1D60A4F7592 /* strerror_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; path = strerror_test.cc; sourceTree = "<group>"; };
286+
358C3B5FE573B1D60A4F7592 /* strerror_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; path = strerror_test.cc; sourceTree = "<group>"; };
287287
379B34A1536045869826D82A /* Pods_Firestore_Example_iOS_SwiftBuildTest.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Firestore_Example_iOS_SwiftBuildTest.framework; sourceTree = BUILT_PRODUCTS_DIR; };
288288
3B843E4A1F3930A400548890 /* remote_store_spec_test.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = remote_store_spec_test.json; sourceTree = "<group>"; };
289289
3C81DE3772628FE297055662 /* Pods-Firestore_Example_iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Firestore_Example_iOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Firestore_Example_iOS/Pods-Firestore_Example_iOS.debug.xcconfig"; sourceTree = "<group>"; };
@@ -517,7 +517,7 @@
517517
E592181BFD7C53C305123739 /* Pods-Firestore_Tests_iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Firestore_Tests_iOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Firestore_Tests_iOS/Pods-Firestore_Tests_iOS.debug.xcconfig"; sourceTree = "<group>"; };
518518
ECEBABC7E7B693BE808A1052 /* Pods_Firestore_IntegrationTests_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Firestore_IntegrationTests_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
519519
F354C0FE92645B56A6C6FD44 /* Pods-Firestore_IntegrationTests_iOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Firestore_IntegrationTests_iOS.release.xcconfig"; path = "Pods/Target Support Files/Pods-Firestore_IntegrationTests_iOS/Pods-Firestore_IntegrationTests_iOS.release.xcconfig"; sourceTree = "<group>"; };
520-
F8043813A5D16963EC02B182 /* local_serializer_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; path = local_serializer_test.cc; sourceTree = "<group>"; };
520+
F8043813A5D16963EC02B182 /* local_serializer_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; path = local_serializer_test.cc; sourceTree = "<group>"; };
521521
/* End PBXFileReference section */
522522

523523
/* Begin PBXFrameworksBuildPhase section */
@@ -2124,6 +2124,7 @@
21242124
isa = XCBuildConfiguration;
21252125
baseConfigurationReference = 3C81DE3772628FE297055662 /* Pods-Firestore_Example_iOS.debug.xcconfig */;
21262126
buildSettings = {
2127+
ARCHS = "$(ARCHS_STANDARD)";
21272128
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
21282129
GCC_PRECOMPILE_PREFIX_HEADER = YES;
21292130
GCC_PREFIX_HEADER = "";
@@ -2148,6 +2149,7 @@
21482149
isa = XCBuildConfiguration;
21492150
baseConfigurationReference = 3F0992A4B83C60841C52E960 /* Pods-Firestore_Example_iOS.release.xcconfig */;
21502151
buildSettings = {
2152+
ARCHS = "$(ARCHS_STANDARD)";
21512153
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
21522154
GCC_PRECOMPILE_PREFIX_HEADER = YES;
21532155
GCC_PREFIX_HEADER = "";

Firestore/Example/Tests/Integration/API/FIRWriteBatchTests.mm

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#import <XCTest/XCTest.h>
2020
#include <mach/mach.h>
2121

22+
#include <cstdint>
23+
2224
#import "Firestore/Example/Tests/Util/FSTEventAccumulator.h"
2325
#import "Firestore/Example/Tests/Util/FSTIntegrationTestCase.h"
2426

@@ -328,7 +330,7 @@ - (void)testUpdateNestedFields {
328330
// truncated), or -1 if the OS call fails.
329331
// TODO(varconst): move the helper function and the test into a new test target for performance
330332
// testing.
331-
long long getCurrentMemoryUsedInMb() {
333+
std::int64_t GetCurrentMemoryUsedInMb() {
332334
mach_task_basic_info taskInfo;
333335
mach_msg_type_number_t taskInfoSize = MACH_TASK_BASIC_INFO_COUNT;
334336
const auto errorCode =
@@ -358,14 +360,15 @@ - (void)testReasonableMemoryUsageForLotsOfMutations {
358360
forDocument:nestedDoc];
359361
}
360362

361-
const long long memoryUsedBeforeCommitMb = getCurrentMemoryUsedInMb();
363+
const std::int64_t memoryUsedBeforeCommitMb = GetCurrentMemoryUsedInMb();
362364
XCTAssertNotEqual(memoryUsedBeforeCommitMb, -1);
363365
[batch commitWithCompletion:^(NSError *_Nullable error) {
364366
XCTAssertNil(error);
365-
const long long memoryUsedAfterCommitMb = getCurrentMemoryUsedInMb();
367+
const std::int64_t memoryUsedAfterCommitMb = GetCurrentMemoryUsedInMb();
366368
XCTAssertNotEqual(memoryUsedAfterCommitMb, -1);
367-
const long long memoryDeltaMb = memoryUsedAfterCommitMb - memoryUsedBeforeCommitMb;
368-
// This by its nature cannot be a precise value. A regression would be on the scale of 500Mb.
369+
const std::int64_t memoryDeltaMb = memoryUsedAfterCommitMb - memoryUsedBeforeCommitMb;
370+
// This by its nature cannot be a precise value. In debug mode, the increase on simulator
371+
// seems to be around 90 MB. A regression would be on the scale of 500Mb.
369372
XCTAssertLessThan(memoryDeltaMb, 150);
370373

371374
[expectation fulfill];

Firestore/Source/Local/FSTLocalDocumentsView.mm

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,25 +62,25 @@ - (instancetype)initWithRemoteDocumentCache:(id<FSTRemoteDocumentCache>)remoteDo
6262
}
6363

6464
- (nullable FSTMaybeDocument *)documentForKey:(const DocumentKey &)key {
65-
NSArray<FSTMutationBatch *> *affectingBatches =
65+
NSArray<FSTMutationBatch *> *batches =
6666
[self.mutationQueue allMutationBatchesAffectingDocumentKey:key];
67-
return [self documentForKey:key withAffectingBatches:affectingBatches];
67+
return [self documentForKey:key inBatches:batches];
6868
}
6969

70-
// Internal version of documentForKey: which allows reusing `affectingBatches`.
70+
// Internal version of documentForKey: which allows reusing `batches`.
7171
- (nullable FSTMaybeDocument *)documentForKey:(const DocumentKey &)key
72-
withAffectingBatches:(NSArray<FSTMutationBatch *> *)affectingBatches {
72+
inBatches:(NSArray<FSTMutationBatch *> *)batches {
7373
FSTMaybeDocument *_Nullable remoteDoc = [self.remoteDocumentCache entryForKey:key];
74-
return [self localDocument:remoteDoc key:key affectingBatches:affectingBatches];
74+
return [self localDocument:remoteDoc key:key inBatches:batches];
7575
}
7676

7777
- (FSTMaybeDocumentDictionary *)documentsForKeys:(const DocumentKeySet &)keys {
7878
FSTMaybeDocumentDictionary *results = [FSTMaybeDocumentDictionary maybeDocumentDictionary];
79-
NSArray<FSTMutationBatch *> *affectingBatches =
79+
NSArray<FSTMutationBatch *> *batches =
8080
[self.mutationQueue allMutationBatchesAffectingDocumentKeys:keys];
8181
for (const DocumentKey &key : keys) {
8282
// TODO(mikelehen): PERF: Consider fetching all remote documents at once rather than one-by-one.
83-
FSTMaybeDocument *maybeDoc = [self documentForKey:key withAffectingBatches:affectingBatches];
83+
FSTMaybeDocument *maybeDoc = [self documentForKey:key inBatches:batches];
8484
// TODO(http://b/32275378): Don't conflate missing / deleted.
8585
if (!maybeDoc) {
8686
maybeDoc = [FSTDeletedDocument documentWithKey:key version:SnapshotVersion::None()];
@@ -164,8 +164,8 @@ - (FSTDocumentDictionary *)documentsMatchingCollectionQuery:(FSTQuery *)query {
164164
*/
165165
- (nullable FSTMaybeDocument *)localDocument:(nullable FSTMaybeDocument *)document
166166
key:(const DocumentKey &)documentKey
167-
affectingBatches:(NSArray<FSTMutationBatch *> *)affectingBatches {
168-
for (FSTMutationBatch *batch in affectingBatches) {
167+
inBatches:(NSArray<FSTMutationBatch *> *)batches {
168+
for (FSTMutationBatch *batch in batches) {
169169
document = [batch applyTo:document documentKey:documentKey];
170170
}
171171

@@ -185,14 +185,14 @@ - (FSTDocumentDictionary *)localDocuments:(FSTDocumentDictionary *)documents {
185185
enumerateKeysAndObjectsUsingBlock:^(FSTDocumentKey *key, FSTDocument *doc, BOOL *stop) {
186186
keySet = keySet.insert(doc.key);
187187
}];
188-
NSArray<FSTMutationBatch *> *affectingBatches =
188+
NSArray<FSTMutationBatch *> *batches =
189189
[self.mutationQueue allMutationBatchesAffectingDocumentKeys:keySet];
190190

191191
__block FSTDocumentDictionary *result = documents;
192192
[documents enumerateKeysAndObjectsUsingBlock:^(FSTDocumentKey *key, FSTDocument *remoteDocument,
193193
BOOL *stop) {
194194
FSTMaybeDocument *mutatedDoc =
195-
[self localDocument:remoteDocument key:key affectingBatches:affectingBatches];
195+
[self localDocument:remoteDocument key:key inBatches:batches];
196196
if ([mutatedDoc isKindOfClass:[FSTDeletedDocument class]]) {
197197
result = [result dictionaryByRemovingObjectForKey:key];
198198
} else if ([mutatedDoc isKindOfClass:[FSTDocument class]]) {

0 commit comments

Comments
 (0)