Permalink
Browse files

Merge pull request #167 from tonycn/master

Add cache for defaultStyleSheet
  • Loading branch information...
2 parents 0c38cf0 + 281f436 commit b0631246791667daf4324f0ce6824772936585d3 @odrobnik odrobnik committed Apr 11, 2012
Showing with 22 additions and 6 deletions.
  1. +14 −4 Core/Source/DTCSSStylesheet.m
  2. +8 −2 DTCoreText.xcodeproj/project.pbxproj
View
18 Core/Source/DTCSSStylesheet.m
@@ -28,11 +28,21 @@ @implementation DTCSSStylesheet
+ (DTCSSStylesheet *)defaultStyleSheet
{
- // get the data from the external symbol
- NSData *data = [NSData dataWithBytes:default_css length:default_css_len];
- NSString *cssString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
+ static DTCSSStylesheet *defaultDTCSSStylesheet = nil;
+ if (defaultDTCSSStylesheet != nil) {
+ return defaultDTCSSStylesheet;
+ }
- return [[DTCSSStylesheet alloc] initWithStyleBlock:cssString];
+ @synchronized(self) {
+ if (defaultDTCSSStylesheet == nil) {
+ // get the data from the external symbol
+ NSData *data = [NSData dataWithBytes:default_css length:default_css_len];
+ NSString *cssString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
+
+ defaultDTCSSStylesheet = [[DTCSSStylesheet alloc] initWithStyleBlock:cssString];
+ }
+ }
+ return defaultDTCSSStylesheet;
}
- (id)initWithStyleBlock:(NSString *)css
View
10 DTCoreText.xcodeproj/project.pbxproj
@@ -1603,7 +1603,10 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ ARCHS = (
+ "$(ARCHS_STANDARD_32_BIT)",
+ armv6,
+ );
COPY_PHASE_STRIP = NO;
DSTROOT = /tmp/DTCoreText.dst;
GCC_C_LANGUAGE_STANDARD = gnu99;
@@ -1628,7 +1631,10 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ ARCHS = (
+ "$(ARCHS_STANDARD_32_BIT)",
+ armv6,
+ );
COPY_PHASE_STRIP = YES;
DSTROOT = /tmp/DTCoreText.dst;
GCC_C_LANGUAGE_STANDARD = gnu99;

0 comments on commit b063124

Please sign in to comment.