Remove more weakSelf/strongSelf errors

Reviewed By: mmmulani

Differential Revision: D3555000

fbshipit-source-id: 13b75571a0d09374ee82977cb2acbf1f894479ca
This commit is contained in:
Pieter De Baets 2016-07-13 08:01:44 -07:00 committed by Facebook Github Bot 2
parent 8baaad9b0f
commit ceffb085d0
2 changed files with 25 additions and 27 deletions

View File

@ -476,19 +476,28 @@ RCT_EXPORT_MODULE()
if (_liveReloadURL) {
NSString *liveReloadTitle = _liveReloadEnabled ? @"Disable Live Reload" : @"Enable Live Reload";
[items addObject:[RCTDevMenuItem buttonItemWithTitle:liveReloadTitle handler:^{
weakSelf.liveReloadEnabled = !self->_liveReloadEnabled;
__typeof(self) strongSelf = weakSelf;
if (strongSelf) {
strongSelf.liveReloadEnabled = !strongSelf->_liveReloadEnabled;
}
}]];
NSString *profilingTitle = RCTProfileIsProfiling() ? @"Stop Systrace" : @"Start Systrace";
[items addObject:[RCTDevMenuItem buttonItemWithTitle:profilingTitle handler:^{
weakSelf.profilingEnabled = !self->_profilingEnabled;
__typeof(self) strongSelf = weakSelf;
if (strongSelf) {
strongSelf.profilingEnabled = !strongSelf->_profilingEnabled;
}
}]];
}
if ([self hotLoadingAvailable]) {
NSString *hotLoadingTitle = _hotLoadingEnabled ? @"Disable Hot Reloading" : @"Enable Hot Reloading";
[items addObject:[RCTDevMenuItem buttonItemWithTitle:hotLoadingTitle handler:^{
weakSelf.hotLoadingEnabled = !self->_hotLoadingEnabled;
__typeof(self) strongSelf = weakSelf;
if (strongSelf) {
strongSelf.hotLoadingEnabled = !strongSelf->_hotLoadingEnabled;
}
}]];
}

View File

@ -229,14 +229,10 @@ RCT_EXPORT_MODULE()
- (void)didReceiveNewContentSizeMultiplier
{
__weak RCTUIManager *weakSelf = self;
dispatch_async(RCTGetUIManagerQueue(), ^{
RCTUIManager *strongSelf = weakSelf;
if (strongSelf) {
[[NSNotificationCenter defaultCenter] postNotificationName:RCTUIManagerWillUpdateViewsDueToContentSizeMultiplierChangeNotification
object:strongSelf];
[strongSelf batchDidComplete];
}
[[NSNotificationCenter defaultCenter] postNotificationName:RCTUIManagerWillUpdateViewsDueToContentSizeMultiplierChangeNotification
object:self];
[self batchDidComplete];
});
}
@ -383,20 +379,19 @@ dispatch_queue_t RCTGetUIManagerQueue(void)
CGRect frame = rootView.frame;
// Register shadow view
__weak RCTUIManager *weakSelf = self;
dispatch_async(RCTGetUIManagerQueue(), ^{
RCTUIManager *strongSelf = weakSelf;
if (!self->_viewRegistry) {
return;
}
RCTRootShadowView *shadowView = [RCTRootShadowView new];
shadowView.reactTag = reactTag;
shadowView.frame = frame;
shadowView.backgroundColor = rootView.backgroundColor;
shadowView.viewName = NSStringFromClass([rootView class]);
shadowView.sizeFlexibility = sizeFlexibility;
strongSelf->_shadowViewRegistry[shadowView.reactTag] = shadowView;
[strongSelf->_rootViewTags addObject:reactTag];
self->_shadowViewRegistry[shadowView.reactTag] = shadowView;
[self->_rootViewTags addObject:reactTag];
});
[[NSNotificationCenter defaultCenter] postNotificationName:RCTUIManagerDidRegisterRootViewNotification
@ -473,14 +468,12 @@ dispatch_queue_t RCTGetUIManagerQueue(void)
RCTAssertMainQueue();
NSNumber *reactTag = view.reactTag;
__weak RCTUIManager *weakSelf = self;
dispatch_async(RCTGetUIManagerQueue(), ^{
RCTUIManager *strongSelf = weakSelf;
if (!self->_viewRegistry) {
return;
}
RCTShadowView *shadowView = strongSelf->_shadowViewRegistry[reactTag];
RCTShadowView *shadowView = self->_shadowViewRegistry[reactTag];
RCTAssert(shadowView != nil, @"Could not locate root view with tag #%@", reactTag);
shadowView.backgroundColor = color;
[self _amendPendingUIBlocksWithStylePropagationUpdateForShadowView:shadowView];
@ -515,19 +508,15 @@ dispatch_queue_t RCTGetUIManagerQueue(void)
@"-[RCTUIManager addUIBlock:] should only be called from the "
"UIManager's queue (get this using `RCTGetUIManagerQueue()`)");
if (!block) {
if (!block || !_viewRegistry) {
return;
}
if (!_viewRegistry) {
return;
}
__weak RCTUIManager *weakViewManager = self;
__weak RCTUIManager *weakSelf = self;
dispatch_block_t outerBlock = ^{
RCTUIManager *strongViewManager = weakViewManager;
if (strongViewManager && strongViewManager->_viewRegistry) {
block(strongViewManager, strongViewManager->_viewRegistry);
RCTUIManager *strongSelf = weakSelf;
if (strongSelf && strongSelf->_viewRegistry) {
block(strongSelf, strongSelf->_viewRegistry);
}
};