-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[camera]remove QueueHelper class #4983
[camera]remove QueueHelper class #4983
Conversation
af203f4 to
20d5fa6
Compare
| - (void)setStreamHandler:(NSObject<FlutterStreamHandler> *)handler | ||
| completion:(void (^)(void))completion { | ||
| FLTEnsureToRunOnMainQueue(^{ | ||
| dispatch_block_t block = ^{ |
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 can see why you found this pattern tedious, Objective-C needs so much boilerplate to do something trivial:
if (!NSThread.isMainThread) {
[NSOperationQueue.mainQueue addOperationWithBlock:^{
[self setStreamHandler:handler completion:completion];
}];
return;
}
[self.channel setStreamHandler:handler];
completion();or
void (^block)(void) = ^{ // or typedef
[self.channel setStreamHandler:handler];
completion();
};
if (NSThread.isMainThread) {
block();
} else {
[NSOperationQueue.mainQueue addOperationWithBlock:block];
}I guess the utility function was better... 😞
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.
reverted to the original commit
cyanglaz
left a comment
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.
What was the motivation to do this? I thought the existing code was cleaner?
e2b4157 to
20d5fa6
Compare
cyanglaz
left a comment
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.
LGTM
|
|
||
| /// A class that contains dispatch queue related helper functions. | ||
| @interface QueueHelper : NSObject | ||
| extern const char* FLTCaptureSessionQueueSpecific; |
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.
nits: Is this used?
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.
Yep. This is used to verify if an operation is on capture session queue.
Removes QueueHelper class and use function instead.
Also renamed file to
QueueUtilsto be consistent withCameraTestUtilsList which issues are fixed by this PR. You must list at least one issue.
NA
If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.
No version change: just minor code cleanup.
Pre-launch Checklist
dart format.)[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.