mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
delete RCTBlockGuard (#41599)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/41599 Changelog: [iOS][Breaking] this is not used in our framework, delete. feel free to fork this implementation if you are using it or interested in using it Reviewed By: cipolleschi Differential Revision: D51516680 fbshipit-source-id: 4ca23a5b78bf18a84ea0ab4fe16419db7aea03d9
This commit is contained in:
committed by
Facebook GitHub Bot
parent
0f239d3301
commit
072a2006e0
-24
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* RCTBlockGuard is designed to be used with obj-c blocks to assist with manual deallocation of C++ resources
|
||||
* tied to lifetime of a block. If C++ resources needs to be manually released at the end of block or when the block
|
||||
* is deallocated, place the clean up code inside constructor and make sure the instance of the class is references in
|
||||
* the block.
|
||||
*/
|
||||
@interface RCTBlockGuard : NSObject
|
||||
|
||||
- (instancetype)initWithCleanup:(void (^)(void))cleanup;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#import "RCTBlockGuard.h"
|
||||
|
||||
@implementation RCTBlockGuard {
|
||||
void (^_cleanup)(void);
|
||||
}
|
||||
|
||||
- (instancetype)initWithCleanup:(void (^)(void))cleanup
|
||||
{
|
||||
if (self = [super init]) {
|
||||
_cleanup = cleanup;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
_cleanup();
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user