Repository: incubator-weex
Updated Branches:
refs/heads/master c9a182f38 -> 4e7f0d55f
[WEEX-189][iOS] optimize threadSafe dictionary
Bug:189
[WEEX-189][iOS] remove useless line
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/4e7f0d55
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/4e7f0d55
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/4e7f0d55
Branch: refs/heads/master
Commit: 4e7f0d55f01d4336d46e87f9a795e504e833edc1
Parents: c9a182f
Author: acton393
Authored: Fri Jan 26 15:27:06 2018 +0800
Committer: acton393
Committed: Fri Jan 26 15:36:06 2018 +0800
--
ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m | 2 +-
ios/sdk/WeexSDK/Sources/Utility/WXThreadSafeMutableDictionary.m | 5 -
ios/sdk/WeexSDK/Sources/Utility/WXUtility.m | 2 +-
3 files changed, 6 insertions(+), 3 deletions(-)
--
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/4e7f0d55/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
--
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
index da9275d..45fde5f 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
+++ b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
@@ -228,7 +228,7 @@ typedef enum : NSUInteger {
if ([configCenter
respondsToSelector:@selector(configForKey:defaultValue:isDefault:)]) {
BOOL useCoreText = [[configCenter
configForKey:@"iOS_weex_ext_config.text_render_useCoreText" defaultValue:@YES
isDefault:NULL] boolValue];
[WXTextComponent setRenderUsingCoreText:useCoreText];
-BOOL useThreadSafeLock = [[configCenter
configForKey:@"iOS_weex_ext_config.useThreadSafeLock" defaultValue:@NO
isDefault:NULL] boolValue];
+BOOL useThreadSafeLock = [[configCenter
configForKey:@"iOS_weex_ext_config.useThreadSafeLock" defaultValue:@YES
isDefault:NULL] boolValue];
[WXUtility setThreadSafeCollectionUsingLock:useThreadSafeLock];
}
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/4e7f0d55/ios/sdk/WeexSDK/Sources/Utility/WXThreadSafeMutableDictionary.m
--
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXThreadSafeMutableDictionary.m
b/ios/sdk/WeexSDK/Sources/Utility/WXThreadSafeMutableDictionary.m
index fb4185e..21da6a0 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXThreadSafeMutableDictionary.m
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXThreadSafeMutableDictionary.m
@@ -26,7 +26,7 @@
{
pthread_mutex_t _safeThreadDictionaryMutex;
pthread_mutexattr_t _safeThreadDictionaryMutexAttr;
-os_unfair_lock _unfairLock;
+os_unfair_lock _unfairLock;// this type of lock is not recurisive
}
@property (nonatomic, strong) dispatch_queue_t queue;
@@ -124,6 +124,9 @@
- (id)objectForKey:(id)aKey
{
+if (nil == aKey){
+return nil;
+}
__block id obj;
if (![WXUtility threadSafeCollectionUsingLock]) {
dispatch_sync(_queue, ^{
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/4e7f0d55/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
--
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
b/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
index 64c6862..dd3a35d 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
@@ -41,7 +41,7 @@
#define KEY_PASSWORD @"com.taobao.Weex.123456"
#define KEY_USERNAME_PASSWORD @"com.taobao.Weex.weex123456"
-static BOOL threadSafeCollectionUsingLock = NO;
+static BOOL threadSafeCollectionUsingLock = YES;
void WXPerformBlockOnMainThread(void (^ _Nonnull block)(void))
{