Skip to content
Permalink
Browse files

Make ProcessID on Haiku an int32_t

Add a static_assert to make sure pid_t fits there.
Add conversion functions but I think they will not be needed (C integer
promotion will do the magic)
  • Loading branch information...
pulkomandy committed Feb 24, 2019
1 parent ec3b3a1 commit e506367bfa01bd99842b00ecd141ddf9955a847d
@@ -35,10 +35,35 @@

namespace WTF {

#if OS(WINDOWS)
using ProcessID = int;
#if OS(HAIKU)
using ProcessID = int32_t;
static_assert(sizeof(ProcessID) >= sizeof(pid_t), "pid_t must fit in ProcessID");

inline pid_t toPid(ProcessID pid)
{
return pid;
}

inline ProcessID toProcessID(pid_t pid)
{
return pid;
}
#else
using ProcessID = pid_t;
#if OS(WINDOWS)
using ProcessID = int;
#else
using ProcessID = pid_t;
#endif

inline pid_t toPid(ProcessID pid)
{
return pid;
}

inline ProcessID toProcessID(pid_t pid)
{
return pid;
}
#endif

inline ProcessID getCurrentProcessID()
@@ -34,6 +34,10 @@ class ResourceResponse;
struct ViewportArguments;
}

namespace WebKit {
struct PidWrapper;
};

namespace IPC {

class Decoder;
@@ -84,6 +88,7 @@ class DefaultDecoderValues {
};

// ResourceResponseBase has the legacy decode template, not ResourceResponse.
template<> class UsesModernDecoder<WebKit::PidWrapper> : public DefaultDecoderValues<std::false_type> { };
template<> class UsesModernDecoder<WebCore::ResourceResponse> : public DefaultDecoderValues<std::false_type> { };
template<> class UsesLegacyDecoder<WebCore::ResourceResponse> : public DefaultDecoderValues<std::true_type> { };

@@ -35,7 +35,7 @@ ProcessAssertion::ProcessAssertion(ProcessID, const String&, AssertionState asse
{
}

ProcessAssertion::ProcessAssertion(pid_t pid, const String& name, AssertionState assertionState, AssertionReason)
ProcessAssertion::ProcessAssertion(WTF::ProcessID pid, const String& name, AssertionState assertionState, AssertionReason)
: m_assertionState(assertionState)
{
}

0 comments on commit e506367

Please sign in to comment.
You can’t perform that action at this time.