Permalink
Browse files

rename subscriptionCallstackHandler to customCaptureSubscriptionCalls…

…tack
  • Loading branch information...
benhjerrild authored and kzaher committed Jul 20, 2018
1 parent 257108e commit d99a9841a0ccaf88aab0447c928da4ffce12cf91
View
@@ -7,7 +7,7 @@ All notable changes to this project will be documented in this file.
* Adds `scan(into:accumulator:)`.
* Adds `queuePriority` parameter (defaults to `.normal`) to `OperationQueueScheduler`.
* Performance enhancement reduces Bag dispatch inline code size by 12%.
* Adds `subscriptionCallstackHandler` hook to allow custom subscription callstacks to be generated.
* Adds `customCaptureSubscriptionCallstack` hook to allow custom subscription callstacks to be generated.
#### Anomalies
@@ -51,7 +51,7 @@ extension ObservableType {
let synchronizationTracker = SynchronizationTracker()
#endif
let callStack = Hooks.recordCallStackOnError ? Hooks.subscriptionCallstackHandler() : []
let callStack = Hooks.recordCallStackOnError ? Hooks.customCaptureSubscriptionCallstack() : []
let observer = AnonymousObserver<E> { event in
@@ -87,7 +87,7 @@ import class Foundation.NSRecursiveLock
extension Hooks {
public typealias DefaultErrorHandler = (_ subscriptionCallStack: [String], _ error: Error) -> ()
public typealias SubscriptionCallstackHandler = () -> [String]
public typealias CustomCaptureSubscriptionCallstack = () -> [String]
fileprivate static let _lock = RecursiveLock()
fileprivate static var _defaultErrorHandler: DefaultErrorHandler = { subscriptionCallStack, error in
@@ -96,7 +96,7 @@ extension Hooks {
print("Unhandled error happened: \(error)\n subscription called from:\n\(serializedCallStack)")
#endif
}
fileprivate static var _subscriptionCallstackHandler: SubscriptionCallstackHandler = {
fileprivate static var _customCaptureSubscriptionCallstack: CustomCaptureSubscriptionCallstack = {
#if DEBUG
return Thread.callStackSymbols
#else
@@ -116,15 +116,15 @@ extension Hooks {
}
}
/// Subscription callstack handler to fetch custom callstack information.
public static var subscriptionCallstackHandler: SubscriptionCallstackHandler {
/// Subscription callstack block to fetch custom callstack information.
public static var customCaptureSubscriptionCallstack: CustomCaptureSubscriptionCallstack {
get {
_lock.lock(); defer { _lock.unlock() }
return _subscriptionCallstackHandler
return _customCaptureSubscriptionCallstack
}
set {
_lock.lock(); defer { _lock.unlock() }
_subscriptionCallstackHandler = newValue
_customCaptureSubscriptionCallstack = newValue
}
}
}
@@ -1326,7 +1326,7 @@ final class ObservableSubscriptionTest_ : ObservableSubscriptionTest, RxTestCase
static var allTests: [(String, (ObservableSubscriptionTest_) -> () -> ())] { return [
("testDefaultErrorHandler", ObservableSubscriptionTest.testDefaultErrorHandler),
("testSubscriptionCallstackHandler", ObservableSubscriptionTest.testSubscriptionCallstackHandler),
("testCustomCaptureSubscriptionCallstack", ObservableSubscriptionTest.testCustomCaptureSubscriptionCallstack),
] }
}
@@ -36,7 +36,7 @@ extension ObservableSubscriptionTest {
XCTAssertEqual(loggedErrors, [testError])
}
func testSubscriptionCallstackHandler() {
func testCustomCaptureSubscriptionCallstack() {
var resultCallstack = [String]()
Hooks.defaultErrorHandler = { callstack, _ in
@@ -45,7 +45,7 @@ extension ObservableSubscriptionTest {
_ = Observable<Int>.error(testError).subscribe()
XCTAssertEqual(resultCallstack, [])
Hooks.subscriptionCallstackHandler = {
Hooks.customCaptureSubscriptionCallstack = {
return ["frame1"]
}
_ = Observable<Int>.error(testError).subscribe()
@@ -55,7 +55,7 @@ extension ObservableSubscriptionTest {
_ = Observable<Int>.error(testError).subscribe()
XCTAssertEqual(resultCallstack, ["frame1"])
Hooks.subscriptionCallstackHandler = {
Hooks.customCaptureSubscriptionCallstack = {
return ["frame1", "frame2"]
}
_ = Observable<Int>.error(testError).subscribe()
View
@@ -88,7 +88,7 @@ extension RxTest {
func setUpActions(){
_ = Hooks.defaultErrorHandler // lazy load resource so resource count matches
_ = Hooks.subscriptionCallstackHandler // lazy load resource so resource count matches
_ = Hooks.customCaptureSubscriptionCallstack // lazy load resource so resource count matches
#if TRACE_RESOURCES
self.startResourceCount = Resources.total
//registerMallocHooks()

0 comments on commit d99a984

Please sign in to comment.