[Webkit-unassigned] [Bug 91222] Make Functional bind PassOwnPtr.
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Aug 13 05:17:47 PDT 2012
https://bugs.webkit.org/show_bug.cgi?id=91222
--- Comment #10 from Huang Dongsung <luxtella at company100.net> 2012-08-13 05:18:16 PST ---
(From update of attachment 152374)
View in context: https://bugs.webkit.org/attachment.cgi?id=152374&action=review
>> Source/WTF/wtf/Functional.h:322
>> +};
>
> Is this really needed?
Yes, it is needed because the StorageType of PassOwnPtr is OwnPtr. In "RefAndDeref<P1, FunctionWrapper::shouldRefFirstParameter>::ref(m_p1)", P1 is PassOwnPtr but m_p1 is OwnPtr, which is the StorageType of PassOwnPtr.
So if this code stub is removed, we will encounter a compile error like the following in gcc.
"
../../../Source/WTF/wtf/Functional.h: In constructor ‘WTF::BoundFunctionImpl<FunctionWrapper, R(P1)>::BoundFunctionImpl(FunctionWrapper, const P1&) [with FunctionWrapper = WTF::FunctionWrapper<int (*)(WTF::PassOwnPtr<TestWebKitAPI::OwnedNumber>)>, R = int, P1 = WTF::PassOwnPtr<TestWebKitAPI::OwnedNumber>]’:
../../../Source/WTF/wtf/Functional.h:662:240: instantiated from ‘WTF::Function<typename WTF::FunctionWrapper<FunctionType>::ResultType()> WTF::bind(FunctionType, const A1&) [with FunctionType = int (*)(WTF::PassOwnPtr<TestWebKitAPI::OwnedNumber>), A1 = WTF::PassOwnPtr<TestWebKitAPI::OwnedNumber>, typename WTF::FunctionWrapper<FunctionType>::ResultType = int]’
../../../Tools/TestWebKitAPI/Tests/WTF/Functional.cpp:263:72: instantiated from here
../../../Source/WTF/wtf/Functional.h:404:9: error: no matching function for call to ‘WTF::RefAndDeref<WTF::PassOwnPtr<TestWebKitAPI::OwnedNumber>, false>::ref(WTF::ParamStorageTraits<WTF::PassOwnPtr<TestWebKitAPI::OwnedNumber> >::StorageType&)’
../../../Source/WTF/wtf/Functional.h:404:9: note: candidate is:
../../../Source/WTF/wtf/Functional.h:315:17: note: static void WTF::RefAndDeref<T, shouldRefAndDeref>::ref(T) [with T = WTF::PassOwnPtr<TestWebKitAPI::OwnedNumber>, bool shouldRefAndDeref = false]
../../../Source/WTF/wtf/Functional.h:315:17: note: no known conversion for argument 1 from ‘WTF::ParamStorageTraits<WTF::PassOwnPtr<TestWebKitAPI::OwnedNumber> >::StorageType {aka WTF::OwnPtr<TestWebKitAPI::OwnedNumber>}’ to ‘WTF::PassOwnPtr<TestWebKitAPI::OwnedNumber>’
"
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list