From 83b9d5c682b21d88133f24da0f94dd56bd79e687 Mon Sep 17 00:00:00 2001
From: 单军华
Date: Thu, 19 Jul 2018 13:38:55 +0800
Subject: [PATCH] change
---
screendisplay/Pods/YYText/YYText/Utility/YYTextTransaction.m | 81 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 81 insertions(+), 0 deletions(-)
diff --git a/screendisplay/Pods/YYText/YYText/Utility/YYTextTransaction.m b/screendisplay/Pods/YYText/YYText/Utility/YYTextTransaction.m
new file mode 100755
index 0000000..3ced249
--- /dev/null
+++ b/screendisplay/Pods/YYText/YYText/Utility/YYTextTransaction.m
@@ -0,0 +1,81 @@
+//
+// YYTextTransaction.m
+// YYText <https://github.com/ibireme/YYText>
+//
+// Created by ibireme on 15/4/18.
+// Copyright (c) 2015 ibireme.
+//
+// This source code is licensed under the MIT-style license found in the
+// LICENSE file in the root directory of this source tree.
+//
+
+#import "YYTextTransaction.h"
+
+
+@interface YYTextTransaction()
+@property (nonatomic, strong) id target;
+@property (nonatomic, assign) SEL selector;
+@end
+
+static NSMutableSet *transactionSet = nil;
+
+static void YYRunLoopObserverCallBack(CFRunLoopObserverRef observer, CFRunLoopActivity activity, void *info) {
+ if (transactionSet.count == 0) return;
+ NSSet *currentSet = transactionSet;
+ transactionSet = [NSMutableSet new];
+ [currentSet enumerateObjectsUsingBlock:^(YYTextTransaction *transaction, BOOL *stop) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
+ [transaction.target performSelector:transaction.selector];
+#pragma clang diagnostic pop
+ }];
+}
+
+static void YYTextTransactionSetup() {
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ transactionSet = [NSMutableSet new];
+ CFRunLoopRef runloop = CFRunLoopGetMain();
+ CFRunLoopObserverRef observer;
+
+ observer = CFRunLoopObserverCreate(CFAllocatorGetDefault(),
+ kCFRunLoopBeforeWaiting | kCFRunLoopExit,
+ true, // repeat
+ 0xFFFFFF, // after CATransaction(2000000)
+ YYRunLoopObserverCallBack, NULL);
+ CFRunLoopAddObserver(runloop, observer, kCFRunLoopCommonModes);
+ CFRelease(observer);
+ });
+}
+
+
+@implementation YYTextTransaction
+
++ (YYTextTransaction *)transactionWithTarget:(id)target selector:(SEL)selector{
+ if (!target || !selector) return nil;
+ YYTextTransaction *t = [YYTextTransaction new];
+ t.target = target;
+ t.selector = selector;
+ return t;
+}
+
+- (void)commit {
+ if (!_target || !_selector) return;
+ YYTextTransactionSetup();
+ [transactionSet addObject:self];
+}
+
+- (NSUInteger)hash {
+ long v1 = (long)((void *)_selector);
+ long v2 = (long)_target;
+ return v1 ^ v2;
+}
+
+- (BOOL)isEqual:(id)object {
+ if (self == object) return YES;
+ if (![object isMemberOfClass:self.class]) return NO;
+ YYTextTransaction *other = object;
+ return other.selector == _selector && other.target == _target;
+}
+
+@end
--
Gitblit v1.8.0