[webkit-dev] Encoding and decoding ProcessID

Sam Weinig weinig at apple.com
Sun Feb 24 14:04:55 PST 2019



> On Feb 24, 2019, at 11:55 AM, Adrien Destugues <pulkomandy at pulkomandy.tk> wrote:
> 
> On Sun, Feb 24, 2019 at 10:52:53AM -0800, Sam Weinig wrote:
>> Hi Adrien,
>> 
>> Would you mind adding the compiler output when this happens? I’d like to see exactly what the error you are seeing is.
> 
> Sorry, here is the compiler output:
> http://paste.debian.net/1069971
> 
> In file included from DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-2.cpp:5:0:
> ../../Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp: In static member function 'static bool WebKit::NetworkResourceLoadParameters::decode(IPC::Decoder&, WebKit::NetworkResourceLoadParameters&)':
> ../../Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp:117:41: error: no matching function for call to 'IPC::Decoder::decode(WTF::ProcessID&)'
>     if (!decoder.decode(result.parentPID))
>                                         ^
> In file included from ../../Source/WebKit/NetworkProcess/Downloads/DownloadID.h:30:0,
>                 from ../../Source/WebKit/NetworkProcess/Downloads/Download.h:28,
>                 from ../../Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp:29,
>                 from DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-2.cpp:1:
> ../../Source/WebKit/Platform/IPC/Decoder.h:80:10: note: candidate: bool IPC::Decoder::decode(bool&) <near match>
>     bool decode(bool&);
>          ^~~~~~
> ../../Source/WebKit/Platform/IPC/Decoder.h:80:10: note:   conversion of argument 1 would be ill-formed:
> In file included from DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-2.cpp:5:0:
> ../../Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp:117:32: error: cannot bind non-const lvalue reference of type 'bool&' to an rvalue of type 'bool'
>     if (!decoder.decode(result.parentPID))
>                         ~~~~~~~^~~~~~~~~
> In file included from ../../Source/WebKit/NetworkProcess/Downloads/DownloadID.h:30:0,
>                 from ../../Source/WebKit/NetworkProcess/Downloads/Download.h:28,
>                 from ../../Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp:29,
>                 from DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-2.cpp:1:
> ../../Source/WebKit/Platform/IPC/Decoder.h:82:10: note: candidate: bool IPC::Decoder::decode(uint8_t&) <near match>
>     bool decode(uint8_t&);
>          ^~~~~~
> ../../Source/WebKit/Platform/IPC/Decoder.h:82:10: note:   conversion of argument 1 would be ill-formed:
> In file included from DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-2.cpp:5:0:
> ../../Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp:117:32: error: cannot bind non-const lvalue reference of type 'uint8_t& {aka unsigned char&}' to an rvalue of type 'uint8_t {aka unsigned char}'
>     if (!decoder.decode(result.parentPID))
>                         ~~~~~~~^~~~~~~~~
> In file included from ../../Source/WebKit/NetworkProcess/Downloads/DownloadID.h:30:0,
>                 from ../../Source/WebKit/NetworkProcess/Downloads/Download.h:28,
>                 from ../../Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp:29,
>                 from DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-2.cpp:1:
> ../../Source/WebKit/Platform/IPC/Decoder.h:84:10: note: candidate: bool IPC::Decoder::decode(uint16_t&) <near match>
>     bool decode(uint16_t&);
>          ^~~~~~
> ../../Source/WebKit/Platform/IPC/Decoder.h:84:10: note:   conversion of argument 1 would be ill-formed:
> In file included from DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-2.cpp:5:0:
> ../../Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp:117:32: error: cannot bind non-const lvalue reference of type 'uint16_t& {aka short unsigned int&}' to an rvalue of type 'uint16_t {aka short unsigned int}'
>     if (!decoder.decode(result.parentPID))
>                         ~~~~~~~^~~~~~~~~
> In file included from ../../Source/WebKit/NetworkProcess/Downloads/DownloadID.h:30:0,
>                 from ../../Source/WebKit/NetworkProcess/Downloads/Download.h:28,
>                 from ../../Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp:29,
>                 from DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-2.cpp:1:
> ../../Source/WebKit/Platform/IPC/Decoder.h:86:10: note: candidate: bool IPC::Decoder::decode(uint32_t&) <near match>
>     bool decode(uint32_t&);
>          ^~~~~~
> ../../Source/WebKit/Platform/IPC/Decoder.h:86:10: note:   conversion of argument 1 would be ill-formed:
> In file included from DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-2.cpp:5:0:
> ../../Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp:117:32: error: cannot bind non-const lvalue reference of type 'uint32_t& {aka unsigned int&}' to an rvalue of type 'uint32_t {aka unsigned int}'
>     if (!decoder.decode(result.parentPID))
>                         ~~~~~~~^~~~~~~~~
> In file included from ../../Source/WebKit/NetworkProcess/Downloads/DownloadID.h:30:0,
>                 from ../../Source/WebKit/NetworkProcess/Downloads/Download.h:28,
>                 from ../../Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp:29,
>                 from DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-2.cpp:1:
> ../../Source/WebKit/Platform/IPC/Decoder.h:88:10: note: candidate: bool IPC::Decoder::decode(uint64_t&) <near match>
>     bool decode(uint64_t&);
>          ^~~~~~
> ../../Source/WebKit/Platform/IPC/Decoder.h:88:10: note:   conversion of argument 1 would be ill-formed:
> In file included from DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-2.cpp:5:0:
> ../../Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp:117:32: error: cannot bind non-const lvalue reference of type 'uint64_t& {aka long long unsigned int&}' to an rvalue of type 'uint64_t {aka long long unsigned int}'
>     if (!decoder.decode(result.parentPID))
>                         ~~~~~~~^~~~~~~~~
> In file included from ../../Source/WebKit/NetworkProcess/Downloads/DownloadID.h:30:0,
>                 from ../../Source/WebKit/NetworkProcess/Downloads/Download.h:28,
>                 from ../../Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp:29,
>                 from DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-2.cpp:1:
> ../../Source/WebKit/Platform/IPC/Decoder.h:90:10: note: candidate: bool IPC::Decoder::decode(int16_t&) <near match>
>     bool decode(int16_t&);
>          ^~~~~~
> ../../Source/WebKit/Platform/IPC/Decoder.h:90:10: note:   conversion of argument 1 would be ill-formed:
> In file included from DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-2.cpp:5:0:
> ../../Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp:117:32: error: cannot bind non-const lvalue reference of type 'int16_t& {aka short int&}' to an rvalue of type 'int16_t {aka short int}'
>     if (!decoder.decode(result.parentPID))
>                         ~~~~~~~^~~~~~~~~
> In file included from ../../Source/WebKit/NetworkProcess/Downloads/DownloadID.h:30:0,
>                 from ../../Source/WebKit/NetworkProcess/Downloads/Download.h:28,
>                 from ../../Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp:29,
>                 from DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-2.cpp:1:
> ../../Source/WebKit/Platform/IPC/Decoder.h:92:10: note: candidate: bool IPC::Decoder::decode(int32_t&) <near match>
>     bool decode(int32_t&);
>          ^~~~~~
> ../../Source/WebKit/Platform/IPC/Decoder.h:92:10: note:   conversion of argument 1 would be ill-formed:
> In file included from DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-2.cpp:5:0:
> ../../Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp:117:32: error: cannot bind non-const lvalue reference of type 'int32_t& {aka int&}' to an rvalue of type 'int32_t {aka int}'
>     if (!decoder.decode(result.parentPID))
>                         ~~~~~~~^~~~~~~~~
> In file included from ../../Source/WebKit/NetworkProcess/Downloads/DownloadID.h:30:0,
>                 from ../../Source/WebKit/NetworkProcess/Downloads/Download.h:28,
>                 from ../../Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp:29,
>                 from DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-2.cpp:1:
> ../../Source/WebKit/Platform/IPC/Decoder.h:94:10: note: candidate: bool IPC::Decoder::decode(int64_t&) <near match>
>     bool decode(int64_t&);
>          ^~~~~~
> ../../Source/WebKit/Platform/IPC/Decoder.h:94:10: note:   conversion of argument 1 would be ill-formed:
> In file included from DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-2.cpp:5:0:
> ../../Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp:117:32: error: cannot bind non-const lvalue reference of type 'int64_t& {aka long long int&}' to an rvalue of type 'int64_t {aka long long int}'
>     if (!decoder.decode(result.parentPID))
>                         ~~~~~~~^~~~~~~~~
> In file included from ../../Source/WebKit/NetworkProcess/Downloads/DownloadID.h:30:0,
>                 from ../../Source/WebKit/NetworkProcess/Downloads/Download.h:28,
>                 from ../../Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp:29,
>                 from DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-2.cpp:1:
> ../../Source/WebKit/Platform/IPC/Decoder.h:96:10: note: candidate: bool IPC::Decoder::decode(float&) <near match>
>     bool decode(float&);
>          ^~~~~~
> ../../Source/WebKit/Platform/IPC/Decoder.h:96:10: note:   conversion of argument 1 would be ill-formed:
> In file included from DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-2.cpp:5:0:
> ../../Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp:117:32: error: cannot bind non-const lvalue reference of type 'float&' to an rvalue of type 'float'
>     if (!decoder.decode(result.parentPID))
>                         ~~~~~~~^~~~~~~~~
> In file included from ../../Source/WebKit/NetworkProcess/Downloads/DownloadID.h:30:0,
>                 from ../../Source/WebKit/NetworkProcess/Downloads/Download.h:28,
>                 from ../../Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp:29,
>                 from DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-2.cpp:1:
> ../../Source/WebKit/Platform/IPC/Decoder.h:98:10: note: candidate: bool IPC::Decoder::decode(double&) <near match>
>     bool decode(double&);
>          ^~~~~~
> ../../Source/WebKit/Platform/IPC/Decoder.h:98:10: note:   conversion of argument 1 would be ill-formed:
> In file included from DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-2.cpp:5:0:
> ../../Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp:117:32: error: cannot bind non-const lvalue reference of type 'double&' to an rvalue of type 'double'
>     if (!decoder.decode(result.parentPID))
>                         ~~~~~~~^~~~~~~~~
> In file included from ../../Source/WebKit/NetworkProcess/Downloads/DownloadID.h:30:0,
>                 from ../../Source/WebKit/NetworkProcess/Downloads/Download.h:28,
>                 from ../../Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp:29,
>                 from DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-2.cpp:1:
> ../../Source/WebKit/Platform/IPC/Decoder.h:102:10: note: candidate: template<class E> std::enable_if_t<std::is_enum<_Tp>::value, bool> IPC::Decoder::decode(E&)
>     auto decode(E& e) -> std::enable_if_t<std::is_enum<E>::value, bool>
>          ^~~~~~
> ../../Source/WebKit/Platform/IPC/Decoder.h:102:10: note:   template argument deduction/substitution failed:
> ../../Source/WebKit/Platform/IPC/Decoder.h:148:10: note: candidate: template<class T, std::enable_if_t<((! std::is_enum<_Tp>::value) && IPC::UsesLegacyDecoder<U>::value)>* <anonymous> > bool IPC::Decoder::decode(T&)
>     bool decode(T& t)
>          ^~~~~~
> ../../Source/WebKit/Platform/IPC/Decoder.h:148:10: note:   template argument deduction/substitution failed:
> ../../Source/WebKit/Platform/IPC/Decoder.h:147:102: note: invalid template non-type parameter
>     template<typename T, std::enable_if_t<!std::is_enum<T>::value && UsesLegacyDecoder<T>::value>* = nullptr>
>                                                                                                      ^~~~~~~
> In file included from DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-2.cpp:7:0:
> ../../Source/WebKit/NetworkProcess/NetworkSession.cpp: In static member function 'static WTF::Ref<WebKit::NetworkSession> WebKit::NetworkSession::create(WebKit::NetworkProcess&, WebKit::NetworkSessionCreationParameters&&)':
> ../../Source/WebKit/NetworkProcess/NetworkSession.cpp:59:1: warning: no return statement in function returning non-void [-Wreturn-type]
> }
> ^
> In file included from ../../Source/WebKit/NetworkProcess/Downloads/DownloadID.h:29:0,
>                 from ../../Source/WebKit/NetworkProcess/Downloads/Download.h:28,
>                 from ../../Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp:29,
>                 from DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-2.cpp:1:
> ../../Source/WebKit/Platform/IPC/ArgumentCoder.h: In instantiation of 'static void IPC::ArgumentCoder< <template-parameter-1-1> >::encode(IPC::Encoder&, const T&) [with T = long int]':
> ../../Source/WebKit/Platform/IPC/Encoder.h:71:105:   required from 'void IPC::Encoder::encode(T&&) [with T = const long int&; std::enable_if_t<(! std::is_enum<typename std::remove_const<typename std::remove_reference<_From>::type>::type>::value)>* <anonymous> = 0]'
> ../../Source/WebKit/Platform/IPC/Encoder.h:84:9:   required from 'IPC::Encoder& IPC::Encoder::operator<<(T&&) [with T = const long int&; std::enable_if_t<(! std::is_enum<_Tp>::value)>* <anonymous> = 0]'
> ../../Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp:39:16:   required from here
> ../../Source/WebKit/Platform/IPC/ArgumentCoder.h:90:11: error: request for member 'encode' in 't', which is of non-class type 'const long int'
>         t.encode(encoder);
>         ~~^~~~~~
> [1034/1174] Building CXX object Source/WebKit/CMakeFiles/WebKit.dir/__/__/DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-1.cpp.o
> In file included from DerivedSources/WebKit/unified-sources/UnifiedSource-72468c22-1.cpp:5:0:
> ../../Source/WebKit/NetworkProcess/NetworkDataTask.cpp: In static member function 'static WTF::Ref<WebKit::NetworkDataTask> WebKit::NetworkDataTask::create(WebKit::NetworkSession&, WebKit::NetworkDataTaskClient&, const WebKit::NetworkLoadParameters&)':
> ../../Source/WebKit/NetworkProcess/NetworkDataTask.cpp:62:1: warning: control reaches end of non-void function [-Wreturn-type]
> }
> ^
> _


Thanks,

I think a nice solution that fits with the general WebKit model might be for you define a WTF::ProcessID specifically for Haiku that is precisely size integer type and add toProcessID() and toPid() helper functions to perform the casts to/from platform types (these casting functions would be used by all platforms. If possible, the helper functions should assert (statically when appropriate) that the conversion is lossless. 

- Sam

> ______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev



More information about the webkit-dev mailing list