mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Move lock from ASDN::Mutex to std::mutex in ASTextKitContext
This commit is contained in:
@@ -9,14 +9,14 @@
|
||||
//
|
||||
|
||||
#import "ASTextKitContext.h"
|
||||
#import "ASThread.h"
|
||||
|
||||
#import "ASLayoutManager.h"
|
||||
|
||||
#import <mutex>
|
||||
|
||||
@implementation ASTextKitContext
|
||||
{
|
||||
// All TextKit operations (even non-mutative ones) must be executed serially.
|
||||
ASDN::Mutex _textKitMutex;
|
||||
std::mutex _textKitMutex;
|
||||
|
||||
NSLayoutManager *_layoutManager;
|
||||
NSTextStorage *_textStorage;
|
||||
@@ -35,8 +35,8 @@
|
||||
{
|
||||
if (self = [super init]) {
|
||||
// Concurrently initialising TextKit components crashes (rdar://18448377) so we use a global lock.
|
||||
static ASDN::Mutex __staticMutex;
|
||||
ASDN::MutexLocker l(__staticMutex);
|
||||
static std::mutex __static_mutex;
|
||||
std::lock_guard<std::mutex> l(__static_mutex);
|
||||
// Create the TextKit component stack with our default configuration.
|
||||
if (textStorageCreationBlock) {
|
||||
_textStorage = textStorageCreationBlock(attributedString);
|
||||
@@ -60,13 +60,13 @@
|
||||
|
||||
- (CGSize)constrainedSize
|
||||
{
|
||||
ASDN::MutexLocker l(_textKitMutex);
|
||||
std::lock_guard<std::mutex> l(_textKitMutex);
|
||||
return _textContainer.size;
|
||||
}
|
||||
|
||||
- (void)setConstrainedSize:(CGSize)constrainedSize
|
||||
{
|
||||
ASDN::MutexLocker l(_textKitMutex);
|
||||
std::lock_guard<std::mutex> l(_textKitMutex);
|
||||
_textContainer.size = constrainedSize;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
NSTextStorage *,
|
||||
NSTextContainer *))block
|
||||
{
|
||||
ASDN::MutexLocker l(_textKitMutex);
|
||||
std::lock_guard<std::mutex> l(_textKitMutex);
|
||||
block(_layoutManager, _textStorage, _textContainer);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user