Re: [webkit-dev] Encoding and decoding ProcessID

2019-02-27 Thread Alex Christensen
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.

> On Feb 26, 2019, at 11:47 PM, Rajagopalan Gangadharan  
> wrote:
> 
> 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 )
>  
> Regards,
> G.Rajagopalan
>  
> ___
> webkit-dev mailing list
> webkit-dev@lists.webkit.org 
> https://lists.webkit.org/mailman/listinfo/webkit-dev 
> 
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Encoding and decoding ProcessID

2019-02-26 Thread Rajagopalan Gangadharan
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 )

Regards,
G.Rajagopalan

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Encoding and decoding ProcessID

2019-02-24 Thread Sam Weinig


> On Feb 24, 2019, at 11:55 AM, Adrien Destugues  
> 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&) 
> 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&) 
> 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&) 
> 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&) 
> 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))
> 

Re: [webkit-dev] Encoding and decoding ProcessID

2019-02-24 Thread Adrien Destugues
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&) 
 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&) 
 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&) 
 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&) 
 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 

Re: [webkit-dev] Encoding and decoding ProcessID

2019-02-24 Thread Sam Weinig
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.

- Sam  

> On Feb 24, 2019, at 9:54 AM, Adrien Destugues  
> wrote:
> 
> Hi there,
> 
> 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
> 
> -- 
> Adrien.
> ___
> webkit-dev mailing list
> webkit-dev@lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Encoding and decoding ProcessID

2019-02-24 Thread Ryosuke Niwa
On Sun, Feb 24, 2019 at 9:55 AM Adrien Destugues 
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
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev