Bug 137035

Summary: Have DOMImplementation::document() and Element::attributes() return references
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: DOMAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, kling, rniwa
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Chris Dumez
Reported 2014-09-23 11:46:10 PDT
Have DOMImplementation::document() and Element::attributes() return references instead of pointers as they can never return null.
Attachments
Patch (5.78 KB, patch)
2014-09-23 12:00 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2014-09-23 12:00:32 PDT
Andreas Kling
Comment 2 2014-09-23 12:16:19 PDT
Comment on attachment 238556 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=238556&action=review Sweet! r=me > Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:2993 > - $rootString = " Frame* root = js${interfaceName}->impl().frame();\n"; > + $rootString = " Frame* root = WTF::getPtr(js${interfaceName}->impl().frame());\n"; > $rootString .= " if (!root)\n"; > $rootString .= " return false;\n"; It would be cool if we could avoid the null check if the root is a reference. Although maybe the compiler takes care of that anyway. > Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:2997 > - $rootString = " Document* root = js${interfaceName}->impl().document();\n"; > + $rootString = " Document* root = WTF::getPtr(js${interfaceName}->impl().document());\n"; > $rootString .= " if (!root)\n"; > $rootString .= " return false;\n"; Same comment. > Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:3003 > - $rootString = " Element* element = js${interfaceName}->impl().element();\n"; > + $rootString = " Element* element = WTF::getPtr(js${interfaceName}->impl().element());\n"; > $rootString .= " if (!element)\n"; > $rootString .= " return false;\n"; Same comment.
Chris Dumez
Comment 3 2014-09-23 12:19:12 PDT
Comment on attachment 238556 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=238556&action=review >> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:2993 >> $rootString .= " return false;\n"; > > It would be cool if we could avoid the null check if the root is a reference. > Although maybe the compiler takes care of that anyway. Yes, I thought about this as well. I am hoping the compiler is being smart here but I'll try and take a look soon.
WebKit Commit Bot
Comment 4 2014-09-23 12:53:16 PDT
Comment on attachment 238556 [details] Patch Clearing flags on attachment: 238556 Committed r173885: <http://trac.webkit.org/changeset/173885>
WebKit Commit Bot
Comment 5 2014-09-23 12:53:20 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.