This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Since MGLMapboxEvents is only accessed via the main thread the complexity to ensure thread safety is not required. This removes that extra code so that future work can benefit from being based on a simpler foundation. The main changes in this commit are: - Untangle nested calls to GCD dispatch_async (i.e. `pushEvents` used to dispatch onto a global (concurrent) background queue from a public class method and then those blocks would be dispatched onto a custom serial queue). Now, the only calls to dispatch_async that are left are in `- postEvents:` and `- writeEventToLocalDebugLog:` and the performance requirement to have even that dispatching done is still unclear. I'm keeping it for now only because it allows for non-blocking JSON serialization and pre-validation (network requests are already non-blocking anyway) - Since the async dispatches are pushed down to just wrap around the JSON serialization / networking, this commit also removes the main thread marshaling that was done in many places (i.e. guarding access to UIKit methods that provide data for events that used to be (synchronously) gathered via the main thread) - Remove assertions that we are running on the main thread. - Pushed some bools used for guards (i.e. `debugLoggingEnabled`) down into the methods that really need to know about the bool value to eliminate some repetitive boilerplate guarding all over the place - Make progress towards a consistent code style
- Loading branch information