RESOLVED FIXED 64467
[V8] Avoid memory leaks with hidden references.
https://bugs.webkit.org/show_bug.cgi?id=64467
Summary [V8] Avoid memory leaks with hidden references.
Vitaly Repeshko
Reported 2011-07-13 11:08:18 PDT
[V8] Avoid memory leaks with hidden references.
Attachments
Patch (14.84 KB, patch)
2011-07-13 11:13 PDT, Vitaly Repeshko
no flags
Patch (17.77 KB, patch)
2011-07-13 11:47 PDT, Vitaly Repeshko
no flags
Patch (18.63 KB, patch)
2011-07-13 11:52 PDT, Vitaly Repeshko
abarth: review+
webkit.review.bot: commit-queue-
Vitaly Repeshko
Comment 1 2011-07-13 11:13:57 PDT
Vitaly Repeshko
Comment 2 2011-07-13 11:20:15 PDT
Adam Barth
Comment 3 2011-07-13 11:23:34 PDT
Comment on attachment 100689 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=100689&action=review Looks reasonable, but I'd like to see one more iteration with Vector and the namespace question questions addressed. > Source/WebCore/bindings/scripts/CodeGeneratorV8.pm:861 > - push(@implContentDecls, " V8DOMWrapper::setHiddenReference(info.Holder(), wrapper);\n"); > + push(@implContentDecls, " V8DOMWrapper::setNamedHiddenReference(info.Holder(), \"${attrName}\", wrapper);\n"); Do we want to put attribute names into their own namespace? > Source/WebCore/bindings/v8/V8DOMWrapper.cpp:193 > +static const char hiddenPrefix[] = "WebCore::"; Don't we have this constant already in V8HiddenPropertyNames somewhere? > Source/WebCore/bindings/v8/V8DOMWrapper.cpp:199 > + char* prefixedName = new char[prefixLength + nameLength + 1]; Can we use Vector<char> instead? All this bare-handed lifting looks wrong. Vector<char> also can have an inline capacity, which means we can avoid the malloc in the common case of a short name. > Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp:164 > + const char* referenceName; I'd initialize this to zero.
Vitaly Repeshko
Comment 4 2011-07-13 11:47:12 PDT
Vitaly Repeshko
Comment 5 2011-07-13 11:52:28 PDT
Adam Barth
Comment 6 2011-07-13 13:12:32 PDT
Comment on attachment 100700 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=100700&action=review Thanks. Very nice. > Source/WebCore/bindings/v8/V8HiddenPropertyName.cpp:58 > + return v8::String::NewSymbol(prefixedName.data(), static_cast<int>(prefixedName.size())); Beautiful, except for the int cast! (but I presume that's a problem with the V8 API).
WebKit Review Bot
Comment 7 2011-07-13 13:14:46 PDT
Comment on attachment 100700 [details] Patch Attachment 100700 [details] did not pass cr-mac-ews (chromium): Output: http://queues.webkit.org/results/9016662
Vitaly Repeshko
Comment 8 2011-07-13 14:45:25 PDT
M Source/WebCore/ChangeLog M Source/WebCore/bindings/scripts/CodeGeneratorV8.pm M Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp M Source/WebCore/bindings/v8/V8DOMWrapper.cpp M Source/WebCore/bindings/v8/V8DOMWrapper.h M Source/WebCore/bindings/v8/V8HiddenPropertyName.cpp M Source/WebCore/bindings/v8/V8HiddenPropertyName.h M Source/WebCore/bindings/v8/WrapperTypeInfo.h M Source/WebCore/bindings/v8/custom/V8CSSStyleSheetCustom.cpp M Source/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp M Source/WebCore/bindings/v8/custom/V8DOMTokenListCustom.cpp M Source/WebCore/bindings/v8/custom/V8LocationCustom.cpp M Source/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp M Source/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp M Source/WebCore/bindings/v8/custom/V8StyleSheetCustom.cpp M Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp Committed r90949
Note You need to log in before you can comment on or make changes to this bug.