Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: webrtc/examples/objc/AppRTCMobile/mac/APPRTCViewController.m

Issue 2920933002: Make sure UI methods get called on the main thread (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/examples/objc/AppRTCMobile/mac/APPRTCViewController.m
diff --git a/webrtc/examples/objc/AppRTCMobile/mac/APPRTCViewController.m b/webrtc/examples/objc/AppRTCMobile/mac/APPRTCViewController.m
index c23e0d59cd234e962fe00c1fa6dfc86789f6fd9b..d6aa71038ac146e354b76ceb5c24460d96fa098a 100644
--- a/webrtc/examples/objc/AppRTCMobile/mac/APPRTCViewController.m
+++ b/webrtc/examples/objc/AppRTCMobile/mac/APPRTCViewController.m
@@ -63,10 +63,12 @@ @implementation APPRTCMainView {
- (void)displayLogMessage:(NSString *)message {
- _logView.string =
- [NSString stringWithFormat:@"%@%@\n", _logView.string, message];
- NSRange range = NSMakeRange(_logView.string.length, 0);
- [_logView scrollRangeToVisible:range];
+ dispatch_async(dispatch_get_main_queue(), ^{
+ _logView.string =
+ [NSString stringWithFormat:@"%@%@\n", _logView.string, message];
+ NSRange range = NSMakeRange(_logView.string.length, 0);
+ [_logView scrollRangeToVisible:range];
+ });
}
#pragma mark - Private
@@ -413,9 +415,11 @@ - (APPRTCMainView*)mainView {
}
- (void)showAlertWithMessage:(NSString*)message {
- NSAlert* alert = [[NSAlert alloc] init];
- [alert setMessageText:message];
- [alert runModal];
+ dispatch_async(dispatch_get_main_queue(), ^{
+ NSAlert* alert = [[NSAlert alloc] init];
+ [alert setMessageText:message];
+ [alert runModal];
+ });
}
- (void)resetUI {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698