Changeset 154023 in webkit
- Timestamp:
- Aug 13, 2013 2:42:16 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r154021 r154023 1 2013-08-13 Anders Carlsson <andersca@apple.com> 2 3 Stop using DEFINE_STATIC_LOCAL with RefPtr 4 https://bugs.webkit.org/show_bug.cgi?id=119769 5 6 Reviewed by Andreas Kling. 7 8 No need to waste heap memory allocating RefPtr, just store the raw pointers directly. 9 10 * dom/ContextFeatures.cpp: 11 (WebCore::ContextFeatures::defaultSwitch): 12 * dom/DocumentMarker.cpp: 13 (WebCore::DocumentMarkerTextMatch::instanceFor): 14 * editing/EditingStyle.cpp: 15 (WebCore::StyleChange::extractTextStyles): 16 * html/FTPDirectoryDocument.cpp: 17 (WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate): 18 * html/HTMLPlugInImageElement.cpp: 19 (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot): 20 * html/track/TextTrack.cpp: 21 (WebCore::TextTrack::captionMenuOffItem): 22 (WebCore::TextTrack::captionMenuAutomaticItem): 23 * loader/icon/IconDatabase.cpp: 24 (WebCore::loadDefaultIconRecord): 25 * platform/graphics/Image.cpp: 26 (WebCore::Image::nullImage): 27 * platform/graphics/PlatformTextTrack.h: 28 (WebCore::PlatformTextTrack::captionMenuOffItem): 29 (WebCore::PlatformTextTrack::captionMenuAutomaticItem): 30 * rendering/style/RenderStyle.cpp: 31 (WebCore::RenderStyle::initialShapeInside): 32 * testing/MockCDM.cpp: 33 (WebCore::initDataPrefix): 34 (WebCore::keyPrefix): 35 (WebCore::keyRequest): 36 1 37 2013-08-13 Anders Carlsson <andersca@apple.com> 2 38 -
trunk/Source/WebCore/dom/ContextFeatures.cpp
r150652 r154023 47 47 ContextFeatures* ContextFeatures::defaultSwitch() 48 48 { 49 DEFINE_STATIC_LOCAL(RefPtr<ContextFeatures>, instance, (ContextFeatures::create(ContextFeaturesClient::empty())));50 return instance .get();49 static ContextFeatures* instance = ContextFeatures::create(ContextFeaturesClient::empty()).leakRef(); 50 return instance; 51 51 } 52 52 -
trunk/Source/WebCore/dom/DocumentMarker.cpp
r114220 r154023 85 85 PassRefPtr<DocumentMarkerTextMatch> DocumentMarkerTextMatch::instanceFor(bool match) 86 86 { 87 DEFINE_STATIC_LOCAL(RefPtr<DocumentMarkerTextMatch>, trueInstance, (adoptRef(new DocumentMarkerTextMatch(true))));88 DEFINE_STATIC_LOCAL(RefPtr<DocumentMarkerTextMatch>, falseInstance, (adoptRef(new DocumentMarkerTextMatch(false))));87 static DocumentMarkerTextMatch* trueInstance = adoptRef(new DocumentMarkerTextMatch(true)).leakRef(); 88 static DocumentMarkerTextMatch* falseInstance = adoptRef(new DocumentMarkerTextMatch(false)).leakRef(); 89 89 return match ? trueInstance : falseInstance; 90 90 } -
trunk/Source/WebCore/editing/EditingStyle.cpp
r153926 r154023 35 35 #include "CSSValueKeywords.h" 36 36 #include "CSSValueList.h" 37 #include "CSSValuePool.h" 37 38 #include "Editor.h" 38 39 #include "Frame.h" … … 1063 1064 static void mergeTextDecorationValues(CSSValueList* mergedValue, const CSSValueList* valueToMerge) 1064 1065 { 1065 DEFINE_STATIC_LOCAL(const RefPtr<CSSPrimitiveValue>, underline, (CSSPrimitiveValue::createIdentifier(CSSValueUnderline)));1066 DEFINE_STATIC_LOCAL(const RefPtr<CSSPrimitiveValue>, lineThrough, (CSSPrimitiveValue::createIdentifier(CSSValueLineThrough)));1066 RefPtr<CSSPrimitiveValue> underline = cssValuePool().createIdentifierValue(CSSValueUnderline); 1067 RefPtr<CSSPrimitiveValue> lineThrough = cssValuePool().createIdentifierValue(CSSValueLineThrough); 1067 1068 1068 1069 if (valueToMerge->hasValue(underline.get()) && !mergedValue->hasValue(underline.get())) … … 1428 1429 RefPtr<CSSValue> textDecoration = style->getPropertyCSSValue(CSSPropertyTextDecoration); 1429 1430 if (textDecoration && textDecoration->isValueList()) { 1430 DEFINE_STATIC_LOCAL(RefPtr<CSSPrimitiveValue>, underline, (CSSPrimitiveValue::createIdentifier(CSSValueUnderline)));1431 DEFINE_STATIC_LOCAL(RefPtr<CSSPrimitiveValue>, lineThrough, (CSSPrimitiveValue::createIdentifier(CSSValueLineThrough)));1431 RefPtr<CSSPrimitiveValue> underline = cssValuePool().createIdentifierValue(CSSValueUnderline); 1432 RefPtr<CSSPrimitiveValue> lineThrough = cssValuePool().createIdentifierValue(CSSValueLineThrough); 1432 1433 1433 1434 RefPtr<CSSValueList> newTextDecoration = static_cast<CSSValueList*>(textDecoration.get())->copy(); -
trunk/Source/WebCore/html/FTPDirectoryDocument.cpp
r152440 r154023 290 290 bool FTPDirectoryDocumentParser::loadDocumentTemplate() 291 291 { 292 DEFINE_STATIC_LOCAL(RefPtr<SharedBuffer>, templateDocumentData, (createTemplateDocumentData(document()->settings())));292 static SharedBuffer* templateDocumentData = createTemplateDocumentData(document()->settings()).leakRef(); 293 293 // FIXME: Instead of storing the data, we'd rather actually parse the template data into the template Document once, 294 294 // store that document, then "copy" it whenever we get an FTP directory listing. There are complexities with this -
trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp
r153927 r154023 373 373 String mimeType = loadedMimeType(); 374 374 375 DEFINE_STATIC_LOCAL(RefPtr<DOMWrapperWorld>, isolatedWorld, (DOMWrapperWorld::create(JSDOMWindow::commonVM())));376 document()->ensurePlugInsInjectedScript(isolatedWorld .get());375 static DOMWrapperWorld* isolatedWorld = DOMWrapperWorld::create(JSDOMWindow::commonVM()).leakRef(); 376 document()->ensurePlugInsInjectedScript(isolatedWorld); 377 377 378 378 ScriptController* scriptController = page->mainFrame()->script(); 379 JSDOMGlobalObject* globalObject = JSC::jsCast<JSDOMGlobalObject*>(scriptController->globalObject(isolatedWorld .get()));379 JSDOMGlobalObject* globalObject = JSC::jsCast<JSDOMGlobalObject*>(scriptController->globalObject(isolatedWorld)); 380 380 JSC::ExecState* exec = globalObject->globalExec(); 381 381 -
trunk/Source/WebCore/html/track/TextTrack.cpp
r153926 r154023 104 104 TextTrack* TextTrack::captionMenuOffItem() 105 105 { 106 DEFINE_STATIC_LOCAL(RefPtr<TextTrack>, off, (TextTrack::create(0, 0, "off menu item", "", "")));107 return off .get();106 static TextTrack* off = TextTrack::create(0, 0, "off menu item", "", "").leakRef(); 107 return off; 108 108 } 109 109 110 110 TextTrack* TextTrack::captionMenuAutomaticItem() 111 111 { 112 DEFINE_STATIC_LOCAL(RefPtr<TextTrack>, automatic, (TextTrack::create(0, 0, "automatic menu item", "", "")));113 return automatic .get();112 static TextTrack* automatic = TextTrack::create(0, 0, "automatic menu item", "", "").leakRef(); 113 return automatic; 114 114 } 115 115 -
trunk/Source/WebCore/loader/icon/IconDatabase.cpp
r149965 r154023 390 390 0xFC, 0x80, 0x00, 0x00, 0x27, 0x10, 0x00, 0x0A, 0xFC, 0x80, 0x00, 0x00, 0x27, 0x10 }; 391 391 392 DEFINE_STATIC_LOCAL(RefPtr<SharedBuffer>, defaultIconBuffer, (SharedBuffer::create(defaultIconData, sizeof(defaultIconData))));392 static SharedBuffer* defaultIconBuffer = SharedBuffer::create(defaultIconData, sizeof(defaultIconData)).leakRef(); 393 393 defaultIconRecord->setImageData(defaultIconBuffer); 394 394 } -
trunk/Source/WebCore/platform/graphics/Image.cpp
r149056 r154023 58 58 { 59 59 ASSERT(isMainThread()); 60 DEFINE_STATIC_LOCAL(RefPtr<Image>, nullImage, (BitmapImage::create()));;61 return nullImage .get();60 static Image* nullImage = BitmapImage::create().leakRef(); 61 return nullImage; 62 62 } 63 63 -
trunk/Source/WebCore/platform/graphics/PlatformTextTrack.h
r151853 r154023 77 77 static PlatformTextTrack* captionMenuOffItem() 78 78 { 79 DEFINE_STATIC_LOCAL(RefPtr<PlatformTextTrack>, off, (PlatformTextTrack::create(0, "off menu item", "", Subtitle, InBand, 0)));80 return off .get();79 static PlatformTextTrack* off = PlatformTextTrack::create(0, "off menu item", "", Subtitle, InBand, 0).leakRef(); 80 return off; 81 81 } 82 82 83 83 static PlatformTextTrack* captionMenuAutomaticItem() 84 84 { 85 DEFINE_STATIC_LOCAL(RefPtr<PlatformTextTrack>, automatic, (PlatformTextTrack::create(0, "automatic menu item", "", Subtitle, InBand, 0)));86 return automatic .get();85 static PlatformTextTrack *automatic = PlatformTextTrack::create(0, "automatic menu item", "", Subtitle, InBand, 0).leakRef(); 86 return automatic; 87 87 } 88 88 -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r153906 r154023 1787 1787 ShapeValue* RenderStyle::initialShapeInside() 1788 1788 { 1789 DEFINE_STATIC_LOCAL(RefPtr<ShapeValue>, sOutsideValue, (ShapeValue::createOutsideValue()));1790 return sOutsideValue.get();1789 static ShapeValue* outsideValue = ShapeValue::createOutsideValue().leakRef(); 1790 return outsideValue; 1791 1791 } 1792 1792 #endif -
trunk/Source/WebCore/testing/MockCDM.cpp
r153838 r154023 76 76 static Uint8Array* initDataPrefix() 77 77 { 78 static const unsigned char prefixData[] = {'m', 'o', 'c', 'k'}; 79 DEFINE_STATIC_LOCAL(RefPtr<Uint8Array>, prefix, ()); 80 static bool initialized = false; 81 if (!initialized) { 82 initialized = true; 83 prefix = Uint8Array::create(prefixData, sizeof(prefixData) / sizeof(prefixData[0])); 84 } 85 return prefix.get(); 78 const unsigned char prefixData[] = { 'm', 'o', 'c', 'k' }; 79 static Uint8Array* prefix = Uint8Array::create(prefixData, WTF_ARRAY_LENGTH(prefixData)).leakRef(); 80 81 return prefix; 86 82 } 87 83 … … 89 85 { 90 86 static const unsigned char prefixData[] = {'k', 'e', 'y'}; 91 DEFINE_STATIC_LOCAL(RefPtr<JSC::Uint8Array>, prefix, ()); 92 static bool initialized = false; 93 if (!initialized) { 94 initialized = true; 95 prefix = Uint8Array::create(prefixData, sizeof(prefixData) / sizeof(prefixData[0])); 96 } 97 return prefix.get(); 87 static Uint8Array* prefix = Uint8Array::create(prefixData, WTF_ARRAY_LENGTH(prefixData)).leakRef(); 88 89 return prefix; 98 90 } 99 91 … … 101 93 { 102 94 static const unsigned char requestData[] = {'r', 'e', 'q', 'u', 'e', 's', 't'}; 103 DEFINE_STATIC_LOCAL(RefPtr<JSC::Uint8Array>, request, ()); 104 static bool initialized = false; 105 if (!initialized) { 106 initialized = true; 107 request = Uint8Array::create(requestData, sizeof(requestData) / sizeof(requestData[0])); 108 } 109 return request.get(); 95 static Uint8Array* request = Uint8Array::create(requestData, WTF_ARRAY_LENGTH(requestData)).leakRef(); 96 97 return request; 110 98 } 111 99
Note: See TracChangeset
for help on using the changeset viewer.