Changeset 181643 in webkit
- Timestamp:
- Mar 17, 2015, 5:22:06 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
bindings/gobject/WebKitDOMCustomUnstable.h (modified) (2 diffs)
-
bindings/scripts/CodeGeneratorGObject.pm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r181631 r181643 1 2015-03-17 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Wrong transfer annotations used in GObject DOM bindings 4 https://bugs.webkit.org/show_bug.cgi?id=142780 5 6 Reviewed by Gustavo Noronha Silva. 7 8 We are using transfer none for all methods returning a GObject DOM 9 Object. That's not true. Only objects derived from Node are 10 automatically released by the DOM object cache and can be transfer 11 none. All other objects are added to the cache only to avoid 12 creating the same wrapper twice for the same core object, but 13 caller should release the returned reference. 14 15 * bindings/gobject/WebKitDOMCustomUnstable.h: 16 * bindings/scripts/CodeGeneratorGObject.pm: 17 (GetTransferTypeForReturnType): 18 (GenerateFunction): 19 1 20 2015-03-17 Carlos Garcia Campos <cgarcia@igalia.com> 2 21 -
trunk/Source/WebCore/bindings/gobject/WebKitDOMCustomUnstable.h
r177143 r181643 30 30 * @self: A #WebKitDOMDOMWindow 31 31 * 32 * Returns: (transfer none): A #WebKitDOMWebKitNamespace32 * Returns: (transfer full): A #WebKitDOMWebKitNamespace 33 33 * 34 34 * Stability: Unstable … … 43 43 * @name: a #gchar 44 44 * 45 * Returns: (transfer none): A #WebKitDOMUserMessageHandler45 * Returns: (transfer full): A #WebKitDOMUserMessageHandler 46 46 * 47 47 * Stability: Unstable -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm
r181507 r181643 49 49 "NodeIterator" => 1, "TreeWalker" => 1, "AbstractView" => 1, "Blob" => 1, "DOMTokenList" => 1, 50 50 "HTMLCollection" => 1, "TextTrackCue" => 1); 51 52 # Only objects derived from Node are released by the DOM object cache and can be 53 # transfer none. Ideally we could use GetBaseClass with the parent type to check 54 # whether it's Node, but unfortunately we only have the name of the return type, 55 # and we can't know its parent base class. Since there are fewer classes in the 56 # API that are not derived from Node, we will list them here to decide the 57 # transfer type. 58 my %transferFullTypeHash = ("AudioTrack" => 1, "AudioTrackList" => 1, "BarProp" => 1, "BatteryManager" => 1, 59 "CSSRuleList" => 1, "CSSStyleDeclaration" => 1, "CSSStyleSheet" => 1, 60 "DOMApplicationCache" => 1, "DOMMimeType" => 1, "DOMMimeTypeArray" => 1, "DOMNamedFlowCollection" => 1, 61 "DOMPlugin" => 1, "DOMPluginArray" => 1, "DOMSecurityPolicy" => 1, 62 "DOMSelection" => 1, "DOMSettableTokenList" => 1, "DOMStringList" => 1, 63 "DOMWindow" => 1, "DOMWindowCSS" => 1, "EventTarget" => 1, 64 "File" => 1, "FileList" => 1, "Gamepad" => 1, "GamepadList" => 1, 65 "Geolocation" => 1, "HTMLOptionsCollection" => 1, "History" => 1, 66 "KeyboardEvent" => 1, "MediaError" => 1, "MediaController" => 1, 67 "MouseEvent" => 1, "MediaQueryList" => 1, "Navigator" => 1, "NodeFilter" => 1, 68 "Performance" => 1, "PerformanceEntry" => 1, "PerformanceEntryList" => 1, "PerformanceNavigation" => 1, "PerformanceTiming" => 1, 69 "Range" => 1, "Screen" => 1, "SpeechSynthesis" => 1, "SpeechSynthesisVoice" => 1, 70 "Storage" => 1, "StyleMedia" => 1, "TextTrack" => 1, "TextTrackCueList" => 1, 71 "TimeRanges" => 1, "Touch" => 1, "UIEvent" => 1, "UserMessageHandler" => 1, "UserMessageHandlersNamespace" => 1, 72 "ValidityState" => 1, "VideoTrack" => 1, "WebKitNamedFlow" => 1, 73 "WebKitNamespace" => 1, "WebKitPoint" => 1, "WheelEvent" => 1, "XPathNSResolver" => 1); 51 74 52 75 # List of function parameters that are allowed to be NULL … … 946 969 } 947 970 971 sub GetTransferTypeForReturnType { 972 my $returnType = shift; 973 974 # Node is always transfer none. 975 return "none" if $returnType eq "Node"; 976 977 # Any base class but Node is transfer full. 978 return "full" if IsBaseType($returnType); 979 980 # Any other class not derived from Node is transfer full. 981 return "full" if $transferFullTypeHash{$returnType}; 982 return "none"; 983 } 984 948 985 sub GenerateFunction { 949 986 my ($object, $interfaceName, $function, $prefix, $parentNode) = @_; … … 1043 1080 $returnTypeName =~ s/\*$//; 1044 1081 if ($returnValueIsGDOMType) { 1045 push(@functionHeader, " * Returns: (transfer none): A #${returnTypeName}"); 1082 my $transferType = GetTransferTypeForReturnType($functionSigType); 1083 push(@functionHeader, " * Returns: (transfer $transferType): A #${returnTypeName}"); 1046 1084 $hasReturnTag = 1; 1047 1085 } elsif ($returnType ne "void") {
Note:
See TracChangeset
for help on using the changeset viewer.