mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-12 23:28:25 +00:00
- The struct is mapped to ID of the current thread and used by subnodes to decide whether they should proceed measurement.
41 lines
1.0 KiB
Plaintext
41 lines
1.0 KiB
Plaintext
//
|
|
// ASLayoutablePrivate.mm
|
|
// AsyncDisplayKit
|
|
//
|
|
// Created by Huy Nguyen on 3/27/16.
|
|
// Copyright © 2016 Facebook. All rights reserved.
|
|
//
|
|
|
|
#import "ASLayoutablePrivate.h"
|
|
#import "pthread.h"
|
|
#import <map>
|
|
|
|
ASLayoutableContext ASLayoutableContextMake(int32_t transitionID, BOOL needsVisualizeNode)
|
|
{
|
|
struct ASLayoutableContext context;
|
|
context.transitionID = transitionID;
|
|
context.needsVisualizeNode = needsVisualizeNode;
|
|
return context;
|
|
}
|
|
|
|
static std::map<mach_port_t, ASLayoutableContext> layoutableContextMap;
|
|
|
|
static inline mach_port_t ASLayoutableGetLayoutableContextKey()
|
|
{
|
|
return pthread_mach_thread_np(pthread_self());
|
|
}
|
|
|
|
void ASLayoutableSetLayoutableContext(struct ASLayoutableContext context)
|
|
{
|
|
layoutableContextMap[ASLayoutableGetLayoutableContextKey()] = context;
|
|
}
|
|
|
|
struct ASLayoutableContext ASLayoutableGetLayoutableContext()
|
|
{
|
|
return layoutableContextMap[ASLayoutableGetLayoutableContextKey()];
|
|
}
|
|
|
|
void ASLayoutableResetLayoutableContext() {
|
|
layoutableContextMap.erase(ASLayoutableGetLayoutableContextKey());
|
|
}
|