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

Unified Diff: ios/web/public/test/web_test.h

Issue 2916473002: [ObjC ARC] Converts ios/web:web to ARC. (Closed)
Patch Set: Tweaks to autorelease pool Created 3 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
Index: ios/web/public/test/web_test.h
diff --git a/ios/web/public/test/web_test.h b/ios/web/public/test/web_test.h
index 27002abd4f36efc9ef409a3fcb913d44c22ed53c..c6993c33e13546d8d536634bd48c990c6c358753 100644
--- a/ios/web/public/test/web_test.h
+++ b/ios/web/public/test/web_test.h
@@ -49,6 +49,16 @@ class WebTest : public PlatformTest {
// Triggers test failures if a render process dies during the test.
std::unique_ptr<WebTestRenderProcessCrashObserver> crash_observer_;
+
+ // The system autorelease pool is deallocated after some of the C++ objects
+ // have been destroyed in the test (e.g. WebThreadImpl). Therefore any
+ // autoreleased object will be deallocated after a lot of the expected
+ // application context is gone, causing DCHECKs on deallocation. Creating our
+ // own root pool wrapping the test ensures that autoreleased objects are
+ // released at the end of the test, not later after the C++ test objects are
+ // destroyed.
+ // Of type ID to prevent ARC imports from complaining about NSAutoreleasePool.
+ id root_pool_;
Eugene But (OOO till 7-30) 2017/06/12 06:12:51 Using |id| makes this header an Objective-C header
stkhapugin 2017/06/12 12:36:23 Please don't create a bare objc pointer in a heade
PL 2017/06/14 00:31:10 Thanks both, this is great guidance. In the next
};
} // namespace web

Powered by Google App Engine
This is Rietveld 408576698