Skip to content

Commit

Permalink
Merge pull request #1171 from bugsnag/nickdowell/thermal-state
Browse files Browse the repository at this point in the history
  • Loading branch information
nickdowell committed Aug 25, 2021
2 parents 52c7c86 + 24af47f commit c8da174
Show file tree
Hide file tree
Showing 40 changed files with 627 additions and 426 deletions.
4 changes: 0 additions & 4 deletions .buildkite/pipeline.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ steps:
--os=macos
--os-version=11.0
--app=macOSTestApp
--tags='not @skip_macos'
--fail-fast
--order=random

Expand All @@ -212,7 +211,6 @@ steps:
--os=macos
--os-version=11
--app=macOSTestApp
--tags='not @skip_macos'
--fail-fast
--order=random

Expand All @@ -233,7 +231,6 @@ steps:
--os=macos
--os-version=10.13
--app=macOSTestApp
--tags='not @skip_macos'
--fail-fast
--order=random

Expand All @@ -254,7 +251,6 @@ steps:
--os=macos
--os-version=10.14
--app=macOSTestApp
--tags='not @skip_macos'
--fail-fast
--order=random

Expand Down
1 change: 0 additions & 1 deletion .buildkite/pipeline.quick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ steps:
--os=macos
--os-version=10.15
--app=macOSTestApp
--tags='not @skip_macos'
--fail-fast
--order=random

Expand Down
2 changes: 0 additions & 2 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ steps:
--os=macos
--os-version=10.15
--app=macOSTestApp
--tags='not @skip_macos'
--fail-fast
--order=random

Expand All @@ -221,7 +220,6 @@ steps:
--os=macos
--os-version=11
--app=macOSTestApp
--tags='not @skip_macos'
--fail-fast
--order=random

Expand Down
44 changes: 26 additions & 18 deletions Bugsnag.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -680,13 +680,13 @@
01B14C57251CE55F00118748 /* report-react-native-promise-rejection.json in Resources */ = {isa = PBXBuildFile; fileRef = 01B14C55251CE55F00118748 /* report-react-native-promise-rejection.json */; };
01B14C58251CE55F00118748 /* report-react-native-promise-rejection.json in Resources */ = {isa = PBXBuildFile; fileRef = 01B14C55251CE55F00118748 /* report-react-native-promise-rejection.json */; };
01B6BB7E25D5777F00FC4DE6 /* BugsnagSwiftPublicAPITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 008966B02486D43500DC48C2 /* BugsnagSwiftPublicAPITests.swift */; };
01B79DA9267CC4A000C8CC5E /* BSGGlobals.h in Headers */ = {isa = PBXBuildFile; fileRef = 01B79DA7267CC4A000C8CC5E /* BSGGlobals.h */; };
01B79DAA267CC4A000C8CC5E /* BSGGlobals.h in Headers */ = {isa = PBXBuildFile; fileRef = 01B79DA7267CC4A000C8CC5E /* BSGGlobals.h */; };
01B79DAB267CC4A000C8CC5E /* BSGGlobals.h in Headers */ = {isa = PBXBuildFile; fileRef = 01B79DA7267CC4A000C8CC5E /* BSGGlobals.h */; };
01B79DAC267CC4A000C8CC5E /* BSGGlobals.m in Sources */ = {isa = PBXBuildFile; fileRef = 01B79DA8267CC4A000C8CC5E /* BSGGlobals.m */; };
01B79DAD267CC4A000C8CC5E /* BSGGlobals.m in Sources */ = {isa = PBXBuildFile; fileRef = 01B79DA8267CC4A000C8CC5E /* BSGGlobals.m */; };
01B79DAE267CC4A000C8CC5E /* BSGGlobals.m in Sources */ = {isa = PBXBuildFile; fileRef = 01B79DA8267CC4A000C8CC5E /* BSGGlobals.m */; };
01B79DAF267CC4A000C8CC5E /* BSGGlobals.m in Sources */ = {isa = PBXBuildFile; fileRef = 01B79DA8267CC4A000C8CC5E /* BSGGlobals.m */; };
01B79DA9267CC4A000C8CC5E /* BSGUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 01B79DA7267CC4A000C8CC5E /* BSGUtils.h */; };
01B79DAA267CC4A000C8CC5E /* BSGUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 01B79DA7267CC4A000C8CC5E /* BSGUtils.h */; };
01B79DAB267CC4A000C8CC5E /* BSGUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 01B79DA7267CC4A000C8CC5E /* BSGUtils.h */; };
01B79DAC267CC4A000C8CC5E /* BSGUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 01B79DA8267CC4A000C8CC5E /* BSGUtils.m */; };
01B79DAD267CC4A000C8CC5E /* BSGUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 01B79DA8267CC4A000C8CC5E /* BSGUtils.m */; };
01B79DAE267CC4A000C8CC5E /* BSGUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 01B79DA8267CC4A000C8CC5E /* BSGUtils.m */; };
01B79DAF267CC4A000C8CC5E /* BSGUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 01B79DA8267CC4A000C8CC5E /* BSGUtils.m */; };
01BDB1F525DEBFB200A91FAF /* BSGEventUploadKSCrashReportOperationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 01BDB1CE25DEBF4600A91FAF /* BSGEventUploadKSCrashReportOperationTests.m */; };
01BDB1FD25DEBFB300A91FAF /* BSGEventUploadKSCrashReportOperationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 01BDB1CE25DEBF4600A91FAF /* BSGEventUploadKSCrashReportOperationTests.m */; };
01BDB20525DEBFB300A91FAF /* BSGEventUploadKSCrashReportOperationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 01BDB1CE25DEBF4600A91FAF /* BSGEventUploadKSCrashReportOperationTests.m */; };
Expand All @@ -703,6 +703,9 @@
01CCAEEE25D414D60057268D /* BugsnagLastRunInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 01CCAEE925D414D60057268D /* BugsnagLastRunInfo.m */; };
01CCAEEF25D414D60057268D /* BugsnagLastRunInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 01CCAEE925D414D60057268D /* BugsnagLastRunInfo.m */; };
01CCAEF025D414D60057268D /* BugsnagLastRunInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 01CCAEE925D414D60057268D /* BugsnagLastRunInfo.m */; };
01DE903C26CEAF9E00455213 /* BSGUtilsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 01DE903B26CEAF9E00455213 /* BSGUtilsTests.m */; };
01DE903D26CEAF9E00455213 /* BSGUtilsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 01DE903B26CEAF9E00455213 /* BSGUtilsTests.m */; };
01DE903E26CEAF9E00455213 /* BSGUtilsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 01DE903B26CEAF9E00455213 /* BSGUtilsTests.m */; };
01E8765E256684E700F4B70A /* URLSessionMock.m in Sources */ = {isa = PBXBuildFile; fileRef = 01E8765D256684E700F4B70A /* URLSessionMock.m */; };
01E8765F256684E700F4B70A /* URLSessionMock.m in Sources */ = {isa = PBXBuildFile; fileRef = 01E8765D256684E700F4B70A /* URLSessionMock.m */; };
01E87660256684E700F4B70A /* URLSessionMock.m in Sources */ = {isa = PBXBuildFile; fileRef = 01E8765D256684E700F4B70A /* URLSessionMock.m */; };
Expand Down Expand Up @@ -1330,8 +1333,8 @@
0195FC3B256BC81400DE6646 /* BugsnagEvent+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "BugsnagEvent+Private.h"; sourceTree = "<group>"; };
0198762E2567D5AB000A7AF3 /* BugsnagStackframe+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "BugsnagStackframe+Private.h"; sourceTree = "<group>"; };
01B14C55251CE55F00118748 /* report-react-native-promise-rejection.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "report-react-native-promise-rejection.json"; sourceTree = "<group>"; };
01B79DA7267CC4A000C8CC5E /* BSGGlobals.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BSGGlobals.h; sourceTree = "<group>"; };
01B79DA8267CC4A000C8CC5E /* BSGGlobals.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BSGGlobals.m; sourceTree = "<group>"; };
01B79DA7267CC4A000C8CC5E /* BSGUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BSGUtils.h; sourceTree = "<group>"; };
01B79DA8267CC4A000C8CC5E /* BSGUtils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BSGUtils.m; sourceTree = "<group>"; };
01BDB1CE25DEBF4600A91FAF /* BSGEventUploadKSCrashReportOperationTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BSGEventUploadKSCrashReportOperationTests.m; sourceTree = "<group>"; };
01BDB21425DEC02900A91FAF /* Data */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Data; sourceTree = "<group>"; };
01C17AE62542ED7F00C102C9 /* KSCrashReportWriterTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KSCrashReportWriterTests.m; sourceTree = "<group>"; };
Expand All @@ -1341,6 +1344,7 @@
01CCAEE925D414D60057268D /* BugsnagLastRunInfo.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BugsnagLastRunInfo.m; sourceTree = "<group>"; };
01CCAEFF25D4151C0057268D /* BugsnagLastRunInfo+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "BugsnagLastRunInfo+Private.h"; sourceTree = "<group>"; };
01D8EC3C256FC6C3006F2A2D /* BugsnagConfiguration+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "BugsnagConfiguration+Private.h"; sourceTree = "<group>"; };
01DE903B26CEAF9E00455213 /* BSGUtilsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BSGUtilsTests.m; sourceTree = "<group>"; };
01E8765C256684E700F4B70A /* URLSessionMock.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = URLSessionMock.h; sourceTree = "<group>"; };
01E8765D256684E700F4B70A /* URLSessionMock.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = URLSessionMock.m; sourceTree = "<group>"; };
3A700A8024A63A8E0068CD1B /* BugsnagThread.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BugsnagThread.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1714,6 +1718,7 @@
0163BF5825823D8D008DC28B /* BSGNotificationBreadcrumbsTests.m */,
008966C82486D43600DC48C2 /* BSGOutOfMemoryTests.m */,
CB6419AA25A73E8C00613D25 /* BSGStorageMigratorTests.m */,
01DE903B26CEAF9E00455213 /* BSGUtilsTests.m */,
CB9103632502320A00E9D1E2 /* BugsnagApiClientTest.m */,
E701FA9E2490EF4A008D842F /* BugsnagApiValidationTest.m */,
008966C22486D43600DC48C2 /* BugsnagAppTest.m */,
Expand Down Expand Up @@ -1838,15 +1843,15 @@
010FF28225ED2A8D00E4F2B0 /* BSGAppHangDetector.h */,
010FF28325ED2A8D00E4F2B0 /* BSGAppHangDetector.m */,
019480C42625EE9800E833ED /* BSGAppKit.h */,
01B79DA7267CC4A000C8CC5E /* BSGGlobals.h */,
01B79DA8267CC4A000C8CC5E /* BSGGlobals.m */,
01847D942644140F00ADA4C7 /* BSGInternalErrorReporter.h */,
01847D952644140F00ADA4C7 /* BSGInternalErrorReporter.m */,
CBCF77A125010648004AF22A /* BSGJSONSerialization.h */,
CBCF77A225010648004AF22A /* BSGJSONSerialization.m */,
008968112486DA5600DC48C2 /* BSGSerialization.h */,
008968162486DA5600DC48C2 /* BSGSerialization.m */,
0140D24725765F8F00FD0306 /* BSGUIKit.h */,
01B79DA7267CC4A000C8CC5E /* BSGUtils.h */,
01B79DA8267CC4A000C8CC5E /* BSGUtils.m */,
008968102486DA5600DC48C2 /* BugsnagCollections.h */,
008968172486DA5600DC48C2 /* BugsnagCollections.m */,
008968152486DA5600DC48C2 /* BugsnagKeys.h */,
Expand Down Expand Up @@ -2051,7 +2056,7 @@
008969F02486DAD100DC48C2 /* BSG_KSCrashReportFields.h in Headers */,
00896A2F2486DAD100DC48C2 /* BSG_KSCrashIdentifier.h in Headers */,
008969FC2486DAD100DC48C2 /* BSG_KSCrashAdvanced.h in Headers */,
01B79DA9267CC4A000C8CC5E /* BSGGlobals.h in Headers */,
01B79DA9267CC4A000C8CC5E /* BSGUtils.h in Headers */,
008967B82486D9D800DC48C2 /* BugsnagBreadcrumbs.h in Headers */,
008969DE2486DAD100DC48C2 /* BSG_KSCrashC.h in Headers */,
0089699F2486DAD100DC48C2 /* BSG_KSJSONCodecObjC.h in Headers */,
Expand Down Expand Up @@ -2155,7 +2160,7 @@
008969F12486DAD100DC48C2 /* BSG_KSCrashReportFields.h in Headers */,
00896A302486DAD100DC48C2 /* BSG_KSCrashIdentifier.h in Headers */,
008969FD2486DAD100DC48C2 /* BSG_KSCrashAdvanced.h in Headers */,
01B79DAA267CC4A000C8CC5E /* BSGGlobals.h in Headers */,
01B79DAA267CC4A000C8CC5E /* BSGUtils.h in Headers */,
008967B92486D9D800DC48C2 /* BugsnagBreadcrumbs.h in Headers */,
008969DF2486DAD100DC48C2 /* BSG_KSCrashC.h in Headers */,
008969A02486DAD100DC48C2 /* BSG_KSJSONCodecObjC.h in Headers */,
Expand Down Expand Up @@ -2259,7 +2264,7 @@
008969F22486DAD100DC48C2 /* BSG_KSCrashReportFields.h in Headers */,
00896A312486DAD100DC48C2 /* BSG_KSCrashIdentifier.h in Headers */,
008969FE2486DAD100DC48C2 /* BSG_KSCrashAdvanced.h in Headers */,
01B79DAB267CC4A000C8CC5E /* BSGGlobals.h in Headers */,
01B79DAB267CC4A000C8CC5E /* BSGUtils.h in Headers */,
008967BA2486D9D800DC48C2 /* BugsnagBreadcrumbs.h in Headers */,
008969E02486DAD100DC48C2 /* BSG_KSCrashC.h in Headers */,
008969A12486DAD100DC48C2 /* BSG_KSJSONCodecObjC.h in Headers */,
Expand Down Expand Up @@ -2649,7 +2654,7 @@
CBE9062D25A34DAB0045B965 /* BSGStorageMigratorV0V1.m in Sources */,
010FF28725ED2A8D00E4F2B0 /* BSGAppHangDetector.m in Sources */,
00896A352486DAD100DC48C2 /* BSG_KSSystemInfo.m in Sources */,
01B79DAC267CC4A000C8CC5E /* BSGGlobals.m in Sources */,
01B79DAC267CC4A000C8CC5E /* BSGUtils.m in Sources */,
008969E42486DAD100DC48C2 /* BSG_KSCrashIdentifier.m in Sources */,
008967DA2486DA2D00DC48C2 /* BugsnagConfiguration.m in Sources */,
008969A52486DAD100DC48C2 /* BSG_KSBacktrace.c in Sources */,
Expand Down Expand Up @@ -2691,6 +2696,7 @@
008967572486D43700DC48C2 /* BugsnagClientMirrorTest.m in Sources */,
0089677B2486D43700DC48C2 /* RFC3339DateTool_Tests.m in Sources */,
0089676F2486D43700DC48C2 /* NSError+SimpleConstructor_Tests.m in Sources */,
01DE903C26CEAF9E00455213 /* BSGUtilsTests.m in Sources */,
008966F42486D43700DC48C2 /* BugsnagThreadTests.m in Sources */,
008967692486D43700DC48C2 /* BugsnagSessionTrackerTest.m in Sources */,
016875C6258D003200DFFF69 /* NSUserDefaultsStub.m in Sources */,
Expand Down Expand Up @@ -2818,7 +2824,7 @@
CBE9062E25A34DAB0045B965 /* BSGStorageMigratorV0V1.m in Sources */,
010FF28825ED2A8D00E4F2B0 /* BSGAppHangDetector.m in Sources */,
00896A362486DAD100DC48C2 /* BSG_KSSystemInfo.m in Sources */,
01B79DAD267CC4A000C8CC5E /* BSGGlobals.m in Sources */,
01B79DAD267CC4A000C8CC5E /* BSGUtils.m in Sources */,
008969E52486DAD100DC48C2 /* BSG_KSCrashIdentifier.m in Sources */,
008967DB2486DA2D00DC48C2 /* BugsnagConfiguration.m in Sources */,
008969A62486DAD100DC48C2 /* BSG_KSBacktrace.c in Sources */,
Expand Down Expand Up @@ -2868,6 +2874,7 @@
008967372486D43700DC48C2 /* BugsnagMetadataTests.m in Sources */,
008967822486D43700DC48C2 /* KSSystemInfo_Tests.m in Sources */,
008967612486D43700DC48C2 /* BugsnagBreadcrumbsTest.m in Sources */,
01DE903D26CEAF9E00455213 /* BSGUtilsTests.m in Sources */,
008967012486D43700DC48C2 /* BugsnagEventPersistLoadTest.m in Sources */,
008967702486D43700DC48C2 /* NSError+SimpleConstructor_Tests.m in Sources */,
0089671C2486D43700DC48C2 /* BugsnagSessionTest.m in Sources */,
Expand Down Expand Up @@ -2987,7 +2994,7 @@
CBE9062F25A34DAB0045B965 /* BSGStorageMigratorV0V1.m in Sources */,
010FF28925ED2A8D00E4F2B0 /* BSGAppHangDetector.m in Sources */,
00896A372486DAD100DC48C2 /* BSG_KSSystemInfo.m in Sources */,
01B79DAE267CC4A000C8CC5E /* BSGGlobals.m in Sources */,
01B79DAE267CC4A000C8CC5E /* BSGUtils.m in Sources */,
008969E62486DAD100DC48C2 /* BSG_KSCrashIdentifier.m in Sources */,
008967DC2486DA2D00DC48C2 /* BugsnagConfiguration.m in Sources */,
008969A72486DAD100DC48C2 /* BSG_KSBacktrace.c in Sources */,
Expand Down Expand Up @@ -3048,6 +3055,7 @@
008967292486D43700DC48C2 /* BugsnagStackframeTest.m in Sources */,
008967952486D43700DC48C2 /* KSSignalInfo_Tests.m in Sources */,
008966F62486D43700DC48C2 /* BugsnagThreadTests.m in Sources */,
01DE903E26CEAF9E00455213 /* BSGUtilsTests.m in Sources */,
0089679E2486D43700DC48C2 /* KSFileUtils_Tests.m in Sources */,
008967A42486D43700DC48C2 /* KSCrashSentry_Signal_Tests.m in Sources */,
E701FAB12490EFE8008D842F /* ConfigurationApiValidationTest.m in Sources */,
Expand Down Expand Up @@ -3154,7 +3162,7 @@
00AD1F262486A17900A27979 /* Bugsnag.m in Sources */,
008968CE2486DA9600DC48C2 /* BugsnagThread.m in Sources */,
00AD1F312486A17900A27979 /* BugsnagSessionTracker.m in Sources */,
01B79DAF267CC4A000C8CC5E /* BSGGlobals.m in Sources */,
01B79DAF267CC4A000C8CC5E /* BSGUtils.m in Sources */,
008968C62486DA9600DC48C2 /* BugsnagUser.m in Sources */,
CBB0928F2519F891007698BC /* BugsnagSystemState.m in Sources */,
008968AE2486DA9600DC48C2 /* BugsnagStateEvent.m in Sources */,
Expand Down
4 changes: 2 additions & 2 deletions Bugsnag/Breadcrumbs/BugsnagBreadcrumbs.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

#import "BugsnagBreadcrumbs.h"

#import "BSGGlobals.h"
#import "BSGFileLocations.h"
#import "BSGJSONSerialization.h"
#import "BSGUtils.h"
#import "BSG_KSCrashReportWriter.h"
#import "BSG_RFC3339DateTool.h"
#import "BugsnagBreadcrumb+Private.h"
Expand Down Expand Up @@ -154,7 +154,7 @@ - (void)addBreadcrumbWithData:(NSData *)data writeToDisk:(BOOL)writeToDisk {
// Breadcrumbs are also stored on disk so that they are accessible at next
// launch if an OOM is detected.
//
dispatch_async(BSGGlobalsFileSystemQueue(), ^{
dispatch_async(BSGGetFileSystemQueue(), ^{
// Avoid writing breadcrumbs that have already been deleted from the in-memory store.
// This can occur when breadcrumbs are being added faster than they can be written.
BOOL isStale;
Expand Down
7 changes: 7 additions & 0 deletions Bugsnag/BugsnagSystemState.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#define SYSTEMSTATE_APP_DEBUGGER_IS_ACTIVE @"debuggerIsActive"

#define SYSTEMSTATE_DEVICE_BOOT_TIME @"bootTime"
#define SYSTEMSTATE_DEVICE_CRITICAL_THERMAL_STATE @"criticalThermalState"

#define PLATFORM_WORD_SIZE sizeof(void*)*8

Expand All @@ -40,13 +41,19 @@ NS_ASSUME_NONNULL_BEGIN

@property (nonatomic) NSUInteger consecutiveLaunchCrashes;

@property (readonly, nonatomic) BOOL lastLaunchCriticalThermalState;

@property (readonly, nonatomic) BOOL lastLaunchTerminatedUnexpectedly;

- (void)markLaunchCompleted;

/**
* Purge all stored system state.
*/
- (void)purge;

- (void)setThermalState:(NSProcessInfoThermalState)thermalState API_AVAILABLE(ios(11.0), tvos(11.0));

@end

NS_ASSUME_NONNULL_END
Loading

0 comments on commit c8da174

Please sign in to comment.