Changeset 154021 in webkit
- Timestamp:
- Aug 13, 2013 1:58:49 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r154020 r154021 1 2013-08-13 Anders Carlsson <andersca@apple.com> 2 3 Stop using DEFINE_STATIC_LOCAL with RetainPtr 4 https://bugs.webkit.org/show_bug.cgi?id=119765 5 6 Reviewed by Jessie Berlin. 7 8 No need to waste heap memory allocating RetainPtrs, just store the raw pointers directly. 9 10 * platform/graphics/mac/ColorMac.mm: 11 (WebCore::nsColor): 12 * platform/graphics/mac/GraphicsContextMac.mm: 13 (WebCore::makePatternColor): 14 (WebCore::GraphicsContext::drawLineForDocumentMarker): 15 * platform/graphics/mac/SimpleFontDataMac.mm: 16 (WebCore::webFallbackFontFamily): 17 1 18 2013-08-13 Commit Queue <commit-queue@webkit.org> 2 19 -
trunk/Source/WebCore/platform/graphics/mac/ColorMac.mm
r150167 r154021 79 79 case 0: { 80 80 // Need this to avoid returning nil because cachedRGBAValues will default to 0. 81 DEFINE_STATIC_LOCAL(RetainPtr<NSColor>, clearColor, ([NSColor colorWithDeviceRed:0 green:0 blue:0 alpha:0]));82 return clearColor .get();81 static NSColor *clearColor = [[NSColor colorWithDeviceRed:0 green:0 blue:0 alpha:0] retain]; 82 return clearColor; 83 83 } 84 84 case Color::black: { 85 DEFINE_STATIC_LOCAL(RetainPtr<NSColor>, blackColor, ([NSColor colorWithDeviceRed:0 green:0 blue:0 alpha:1]));86 return blackColor .get();85 static NSColor *blackColor = [[NSColor colorWithDeviceRed:0 green:0 blue:0 alpha:1] retain]; 86 return blackColor; 87 87 } 88 88 case Color::white: { 89 DEFINE_STATIC_LOCAL(RetainPtr<NSColor>, whiteColor, ([NSColor colorWithDeviceRed:1 green:1 blue:1 alpha:1]));90 return whiteColor .get();89 static NSColor *whiteColor = [[NSColor colorWithDeviceRed:1 green:1 blue:1 alpha:1] retain]; 90 return whiteColor; 91 91 } 92 92 default: { -
trunk/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm
r149255 r154021 84 84 85 85 86 static NSColor* createPatternColor(NSString* firstChoiceName, NSString* secondChoiceName, NSColor* defaultColor, bool& usingDot)86 static NSColor* makePatternColor(NSString* firstChoiceName, NSString* secondChoiceName, NSColor* defaultColor, bool& usingDot) 87 87 { 88 88 // Eventually we should be able to get rid of the secondChoiceName. For the time being we need both to keep … … 117 117 // Constants for spelling pattern color. 118 118 static bool usingDotForSpelling = false; 119 DEFINE_STATIC_LOCAL(RetainPtr<NSColor>, spellingPatternColor, (createPatternColor(@"NSSpellingDot", @"SpellingDot", [NSColor redColor], usingDotForSpelling)));119 static NSColor *spellingPatternColor = [makePatternColor(@"NSSpellingDot", @"SpellingDot", [NSColor redColor], usingDotForSpelling) retain]; 120 120 usingDot = usingDotForSpelling; 121 patternColor = spellingPatternColor .get();121 patternColor = spellingPatternColor; 122 122 break; 123 123 } … … 126 126 // Constants for grammar pattern color. 127 127 static bool usingDotForGrammar = false; 128 DEFINE_STATIC_LOCAL(RetainPtr<NSColor>, grammarPatternColor, (createPatternColor(@"NSGrammarDot", @"GrammarDot", [NSColor greenColor], usingDotForGrammar)));128 static NSColor *grammarPatternColor = [makePatternColor(@"NSGrammarDot", @"GrammarDot", [NSColor greenColor], usingDotForGrammar) retain]; 129 129 usingDot = usingDotForGrammar; 130 patternColor = grammarPatternColor .get();130 patternColor = grammarPatternColor; 131 131 break; 132 132 } … … 138 138 // Constants for spelling pattern color. 139 139 static bool usingDotForSpelling = false; 140 DEFINE_STATIC_LOCAL(RetainPtr<NSColor>, spellingPatternColor, (createPatternColor(@"NSCorrectionDot", @"CorrectionDot", [NSColor blueColor], usingDotForSpelling)));140 static NSColor *spellingPatternColor = [makePatternColor(@"NSCorrectionDot", @"CorrectionDot", [NSColor blueColor], usingDotForSpelling) retain]; 141 141 usingDot = usingDotForSpelling; 142 patternColor = spellingPatternColor .get();142 patternColor = spellingPatternColor; 143 143 break; 144 144 } -
trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
r149980 r154021 75 75 static NSString *webFallbackFontFamily(void) 76 76 { 77 DEFINE_STATIC_LOCAL(RetainPtr<NSString>, webFallbackFontFamily, ([[NSFont systemFontOfSize:16.0f] familyName]));78 return webFallbackFontFamily .get();77 static NSString *webFallbackFontFamily = [[[NSFont systemFontOfSize:16.0f] familyName] retain]; 78 return webFallbackFontFamily; 79 79 } 80 80
Note: See TracChangeset
for help on using the changeset viewer.