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

Unified Diff: ui/gfx/test/ui_cocoa_test_helper.mm

Issue 308713007: [Memory Sheriff] Force a well-defined path for system leak. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mem_257276
Patch Set: Created 6 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: ui/gfx/test/ui_cocoa_test_helper.mm
diff --git a/ui/gfx/test/ui_cocoa_test_helper.mm b/ui/gfx/test/ui_cocoa_test_helper.mm
index bae4af88820488838acc93defecff49d2fe8255d..38a2b935bed48b34749bd6fccd4040eb3be7e6e7 100644
--- a/ui/gfx/test/ui_cocoa_test_helper.mm
+++ b/ui/gfx/test/ui_cocoa_test_helper.mm
@@ -9,6 +9,20 @@
#include "base/stl_util.h"
#include "base/test/test_timeouts.h"
+namespace {
+
+// Some AppKit function leak intentionally, e.g. for caching purposes.
+// Force those leaks here, so there can be a unique calling path, allowing
+// to flag intentional leaks without having to suppress all calls to
+// potentially leaky functions.
+void NOINLINE ForceSystemLeaks() {
+ // First NSCursor push always leaks.
+ [[NSCursor openHandCursor] push];
+ [NSCursor pop];
+}
+
+} // namespace.
+
@implementation CocoaTestHelperWindow
- (id)initWithContentRect:(NSRect)contentRect {
@@ -76,6 +90,8 @@ void CocoaTest::Init() {
// that we don't wait for them to close in TearDown. Has to be done
// after BootstrapCocoa is called.
initial_windows_ = ApplicationWindows();
+
+ ForceSystemLeaks();
Scott Hess - ex-Googler 2014/05/30 23:58:06 Stepping back and putting on my "What would anothe
groby-ooo-7-16 2014/05/31 00:37:04 Moved to top of ctor.
}
void CocoaTest::TearDown() {
« 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