Encoding and decoding ProcessID

# Adrien Destugues (3 days ago)

We are finally starting to look into moving the Haiku port to WebKit2.

We have hit one little problem I'm not sure how to solve. Our pid_t on 32bit Haiku is declared as a signed long integer (this is for legacy reasons and not something we can fix easily). Our uint32_t is a signed integer (not long). This creates a compilation error when using pid_t with IPC::Encoder, because none of the encode() functions match when trying to pass a pid_t in our case.

Our options seems to be:

  • Cast pid_t to int32_t when encoding it. I fear this would break other platforms if they decide to use a 64bit pid_t, for example
  • Add an encode(pid_t) to the IPC::Encoder. I fear on other platforms it would complain that this is the same as encode(int32_t) and break the build
  • Define WTF::ProcessID as int32_t instead of pid_t, which I think could work, afte rfixing some compiler warnings (we will need to cast back to pid_t when passing it to OS functions, I think)

What do you think about it?

one example where encoding a pid is Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp

Contact us to advertise here
# Ryosuke Niwa (3 days ago)

On Sun, Feb 24, 2019 at 9:55 AM Adrien Destugues <pulkomandy at pulkomandy.tk>

wrote:

We are finally starting to look into moving the Haiku port to WebKit2.

We have hit one little problem I'm not sure how to solve. Our pid_t on 32bit Haiku is declared as a signed long integer (this is for legacy reasons and not something we can fix easily). Our uint32_t is a signed integer (not long). This creates a compilation error when using pid_t with IPC::Encoder, because none of the encode() functions match when trying to pass a pid_t in our case.

Our options seems to be:

  • Cast pid_t to int32_t when encoding it. I fear this would break other platforms if they decide to use a 64bit pid_t, for example

We definitely don't want to do this for the reason you stated.

  • Add an encode(pid_t) to the IPC::Encoder. I fear on other platforms it

    would complain that this is the same as encode(int32_t) and break the build

We may want to wrap pid_t in a struct when passing around IPC. That would work around this problem.

  • Define WTF::ProcessID as int32_t instead of pid_t, which I think could

    work, afte rfixing some compiler warnings (we will need to cast back to pid_t when passing it to OS functions, I think)

We definitely don't want to do this for the same reason as the first.

Note that because 32-bit UI process on macOS would start 64-bit WebContent process, it's very important that every IPC message explicitly specifies the size of POD types. We can't, for example, use uintptr_t whose size varies between 32-bit and 64-bit builds on macOS in our IPC code.

  • R. Niwa
# Sam Weinig (3 days ago)

Would you mind adding the compiler output when this happens? I’d like to see exactly what the error you are seeing is.

# Adrien Destugues (3 days ago)

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: 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] } ^

# Sam Weinig (3 days ago)

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: 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.

# Rajagopalan Gangadharan (16 hours ago)

WTF::ProcessID and WKProcessID are supposed to be of same type right? As different types create ambiguity . As sam Weining suggested we made WTF::ProcessID to be int32_t but WKProcessID is pid_t so can we also explicitly make WKProcessID to be int32_t (will it conform to the current webkit model? )or is there any way I could fix this( any implicit casting )

# Alex Christensen (6 hours ago)

WKProcessID is only used in 2 functions that are only used for testing, so it’s probably not too important as long as your tests work.

Also, earlier you said "Our uint32_t is a signed integer.” If that’s true, you’re going to have some bigger problems.

Want more features?

Request early access to our private beta of readable email premium.