-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generalize the main thread ivar dealloc stuff (#959)
- Loading branch information
1 parent
35d59ac
commit f6c5dc3
Showing
10 changed files
with
269 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// ASMainThreadDeallocation.h | ||
// Texture | ||
// | ||
// Copyright (c) 2018-present, Pinterest, Inc. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface NSObject (ASMainThreadIvarTeardown) | ||
|
||
/** | ||
* Call this from -dealloc to schedule this instance's | ||
* ivars for main thread deallocation as needed. | ||
* | ||
* This method includes a check for whether it's on the main thread, | ||
* and it will do nothing in that case. | ||
*/ | ||
- (void)scheduleIvarsForMainThreadDeallocation; | ||
|
||
@end | ||
|
||
@interface NSObject (ASNeedsMainThreadDeallocation) | ||
|
||
/** | ||
* Override this property to indicate that instances of this | ||
* class need to be deallocated on the main thread. | ||
* You do not access this property yourself. | ||
* | ||
* The NSObject implementation returns NO if the class name has | ||
* a prefix UI, AV, or CA. This property is also overridden to | ||
* return fixed values for other common classes, such as UIImage, | ||
* UIGestureRecognizer, and UIResponder. | ||
*/ | ||
@property (class, readonly) BOOL needsMainThreadDeallocation; | ||
|
||
@end | ||
|
||
|
||
NS_ASSUME_NONNULL_END |
Oops, something went wrong.