Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[iOS] suuport instance use backup js thread run
Browse files Browse the repository at this point in the history
  • Loading branch information
jianhan-he committed Jun 10, 2019
1 parent 0baa6a7 commit ee34a46
Show file tree
Hide file tree
Showing 12 changed files with 207 additions and 60 deletions.
4 changes: 2 additions & 2 deletions ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -754,9 +754,9 @@ - (void)destroyInstance:(NSString *)instance
if (_dataRenderHandler) {
WXPerformBlockOnComponentThread(^{
[_dataRenderHandler destroyDataRenderInstance:instance];
WXPerformBlockOnBridgeThread(^{
WXPerformBlockOnBridgeThreadForInstance(^{
[self callJSMethod:@"destroyInstance" args:@[instance]];
});
}, instance);
});
}
else {
Expand Down
6 changes: 3 additions & 3 deletions ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ - (void)dealloc
{
_jsContext.instanceId = nil;
__block JSContext* theContext = _jsContext;
WXPerformBlockOnBridgeThread(^{
theContext = nil; // release the context in js thread to avoid main-thread deadlock
});
WXPerformBlockOnBridgeThreadForInstance(^{
theContext = nil; // release the context in js thread to avoid main-thread deadlock
}, _weexInstanceId);
}

- (void)setJSContext:(JSContext *)context
Expand Down
4 changes: 4 additions & 0 deletions ios/sdk/WeexSDK/Sources/Manager/WXBridgeManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ extern "C" {
#endif
void WXPerformBlockOnBridgeThread(void (^block)(void));
void WXPerformBlockSyncOnBridgeThread(void (^block) (void));
void WXPerformBlockOnBackupBridgeThread(void (^block)(void));

void WXPerformBlockOnBridgeThreadForInstance(void (^block)(void), NSString* instance);
void WXPerformBlockSyncOnBridgeThreadForInstance(void (^block) (void), NSString* instance);
#ifdef __cplusplus
}
#endif
Expand Down
Loading

0 comments on commit ee34a46

Please sign in to comment.