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

Unified Diff: ui/views/widget/native_widget_mac.mm

Issue 2115453002: Use PostTask, not performSelector in NativeWidgetMac::Close() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no parens Created 4 years, 6 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: ui/views/widget/native_widget_mac.mm
diff --git a/ui/views/widget/native_widget_mac.mm b/ui/views/widget/native_widget_mac.mm
index eca39288062e0879223f1fe06ce9f511a40c14f2..c6425cd244d3cc4473700c1be9164c86b56e1319 100644
--- a/ui/views/widget/native_widget_mac.mm
+++ b/ui/views/widget/native_widget_mac.mm
@@ -8,9 +8,11 @@
#include <utility>
+#import "base/mac/bind_objc_block.h"
#include "base/mac/foundation_util.h"
#include "base/mac/scoped_nsobject.h"
#include "base/strings/sys_string_conversions.h"
+#include "base/threading/thread_task_runner_handle.h"
#import "ui/base/cocoa/constrained_window/constrained_window_animation.h"
#import "ui/base/cocoa/window_size_constants.h"
#include "ui/gfx/font_list.h"
@@ -367,7 +369,13 @@ void NativeWidgetMac::Close() {
// like -performClose:, first remove the window from AppKit's display
// list to avoid crashes like http://crbug.com/156101.
[window orderOut:nil];
- [window performSelector:@selector(close) withObject:nil afterDelay:0];
+
+ // Many tests assume that base::RunLoop().RunUntilIdle() is always sufficient
+ // to execute a close. However, in rare cases, -performSelector:..afterDelay:0
+ // does not do this. So post a regular task.
+ base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, base::BindBlock(^{
+ [window close];
+ }));
}
void NativeWidgetMac::CloseNow() {
« 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