Use NSProxy as base class for FBApplicationProcessProxy #979
Conversation
@@ -122,7 +122,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N | |||
return; | |||
} | |||
XCUIApplicationProcess *applicationProcess = change[NSKeyValueChangeNewKey]; | |||
if (!applicationProcess || ![applicationProcess isMemberOfClass:XCUIApplicationProcess.class]) { | |||
if (!applicationProcess || [applicationProcess isProxy] || ![applicationProcess isMemberOfClass:XCUIApplicationProcess.class]) { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
proxy.applicationProcess = applicationProcess; | ||
return proxy; | ||
} | ||
|
||
- (instancetype)init { | ||
return self; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
@@ -45,9 +52,16 @@ - (void)waitForQuiescenceIncludingAnimationsIdle:(BOOL)includeAnimations | |||
[self.applicationProcess waitForQuiescenceIncludingAnimationsIdle:includeAnimations]; | |||
} | |||
|
|||
- (id)forwardingTargetForSelector:(SEL)aSelector |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why kill forwardingTargetForSelector
? it is faster then invocation right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't done any benchmarking, and implemented the only two required methods. if this is faster, then let's use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From https://developer.apple.com/documentation/objectivec/nsobject/1418855-forwardingtargetforselector
This method gives an object a chance to redirect an unknown message sent to it before the much more expensive forwardInvocation: machinery takes over.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Simple benchmark with 10 million invocations answers the question "How much more expensive
?" :-) 0.3 seconds vs 26 seconds
|
||
@end | ||
|
||
@implementation FBApplicationProcessProxyTest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
…ormance optimization
@marekcirkos Thanks for the hint on the I did benchmarking — basically a test which was calling And received surprising and impressive results.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
marekcirkos is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Nice work! Thanks for contributing! |
Thanks for quick fix |
Allows to forward NSKeyValueObserverRegistration methods.
Fixes issue #975 — Allows to work with Xcode 10 beta 5 and beta 6.
Tested for Xcode 9.4.1 as well