Move lock from ASDN::Mutex to std::mutex in ASTextKitContext

This commit is contained in:
Michael Schneider
2016-06-15 16:51:58 -07:00
parent b4f25f3d63
commit 22fa715682

View File

@@ -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);
}