Skip to content

Commit

Permalink
Unreviewed, fix build after 262846@main
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=255309
rdar://107909116

* Source/WebKit/Platform/IPC/StreamServerConnection.h:
(IPC::StreamServerConnection::send):

Canonical link: https://commits.webkit.org/262850@main
  • Loading branch information
cdumez committed Apr 12, 2023
1 parent 25d6b13 commit bce2395
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 36 deletions.
1 change: 1 addition & 0 deletions Source/WTF/wtf/ObjectIdentifier.h
Expand Up @@ -205,5 +205,6 @@ bool operator<=(const ObjectIdentifierGeneric<T, ThreadSafety>& a, const ObjectI
} // namespace WTF

using WTF::AtomicObjectIdentifier;
using WTF::ObjectIdentifierGenericBase;
using WTF::ObjectIdentifierGeneric;
using WTF::ObjectIdentifier;
16 changes: 8 additions & 8 deletions Source/WebKit/Platform/IPC/Connection.h
Expand Up @@ -304,29 +304,29 @@ class Connection : public ThreadSafeRefCountedAndCanMakeThreadSafeWeakPtr<Connec
template<typename> bool waitForAsyncReplyAndDispatchImmediately(AsyncReplyID, Timeout); // Main thread only.

// Thread-safe.
template<typename T, typename C, typename U, typename V>
AsyncReplyID sendWithAsyncReply(T&& message, C&& completionHandler, ObjectIdentifierGeneric<U, V> destinationID = { }, OptionSet<SendOption> sendOptions = { })
template<typename T, typename C>
AsyncReplyID sendWithAsyncReply(T&& message, C&& completionHandler, const ObjectIdentifierGenericBase& destinationID, OptionSet<SendOption> sendOptions = { })
{
return sendWithAsyncReply<T, C>(WTFMove(message), WTFMove(completionHandler), destinationID.toUInt64(), sendOptions);
}

// Thread-safe.
template<typename T, typename U, typename V>
bool send(T&& message, ObjectIdentifierGeneric<U, V> destinationID, OptionSet<SendOption> sendOptions = { }, std::optional<Thread::QOS> qos = std::nullopt)
template<typename T>
bool send(T&& message, const ObjectIdentifierGenericBase& destinationID, OptionSet<SendOption> sendOptions = { }, std::optional<Thread::QOS> qos = std::nullopt)
{
return send<T>(WTFMove(message), destinationID.toUInt64(), sendOptions, qos);
}

// Main thread only.
template<typename T, typename U, typename V>
SendSyncResult<T> sendSync(T&& message, ObjectIdentifierGeneric<U, V> destinationID, Timeout timeout = Timeout::infinity(), OptionSet<SendSyncOption> sendSyncOptions = { })
template<typename T>
SendSyncResult<T> sendSync(T&& message, const ObjectIdentifierGenericBase& destinationID, Timeout timeout = Timeout::infinity(), OptionSet<SendSyncOption> sendSyncOptions = { })
{
return sendSync<T>(WTFMove(message), destinationID.toUInt64(), timeout, sendSyncOptions);
}

// Main thread only.
template<typename T, typename U, typename V>
bool waitForAndDispatchImmediately(ObjectIdentifierGeneric<U, V> destinationID, Timeout timeout, OptionSet<WaitForOption> waitForOptions = { })
template<typename T>
bool waitForAndDispatchImmediately(const ObjectIdentifierGenericBase& destinationID, Timeout timeout, OptionSet<WaitForOption> waitForOptions = { })
{
return waitForAndDispatchImmediately<T>(destinationID.toUInt64(), timeout, waitForOptions);
}
Expand Down
3 changes: 1 addition & 2 deletions Source/WebKit/Platform/IPC/JSIPCBinding.h
Expand Up @@ -95,8 +95,7 @@ template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, uin
template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, uint64_t);
template<> JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject*, size_t);

template<typename U>
JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject* globalObject, ObjectIdentifier<U>&& value)
inline JSC::JSValue jsValueForDecodedArgumentValue(JSC::JSGlobalObject* globalObject, const ObjectIdentifierGenericBase& value)
{
return jsValueForDecodedArgumentValue(globalObject, value.toUInt64());
}
Expand Down
6 changes: 3 additions & 3 deletions Source/WebKit/Platform/IPC/StreamServerConnection.h
Expand Up @@ -76,7 +76,7 @@ class StreamServerConnection final : public ThreadSafeRefCounted<StreamServerCon

void open();
void invalidate();
template<typename T, typename U> bool send(T&& message, ObjectIdentifier<U> destinationID);
template<typename T> bool send(T&& message, const ObjectIdentifierGenericBase& destinationID);

template<typename T, typename... Arguments>
void sendSyncReply(Connection::SyncRequestID, Arguments&&...);
Expand Down Expand Up @@ -114,8 +114,8 @@ class StreamServerConnection final : public ThreadSafeRefCounted<StreamServerCon
friend class StreamConnectionWorkQueue;
};

template<typename T, typename U>
bool StreamServerConnection::send(T&& message, ObjectIdentifier<U> destinationID)
template<typename T>
bool StreamServerConnection::send(T&& message, const ObjectIdentifierGenericBase& destinationID)
{
return m_connection->send(WTFMove(message), destinationID);
}
Expand Down
6 changes: 2 additions & 4 deletions Source/WebKit/Shared/AuxiliaryProcess.h
Expand Up @@ -71,14 +71,12 @@ class AuxiliaryProcess : public IPC::Connection::Client, public IPC::MessageSend
void removeMessageReceiver(IPC::ReceiverName);
void removeMessageReceiver(IPC::MessageReceiver&);

template <typename T>
void addMessageReceiver(IPC::ReceiverName messageReceiverName, ObjectIdentifier<T> destinationID, IPC::MessageReceiver& receiver)
void addMessageReceiver(IPC::ReceiverName messageReceiverName, const ObjectIdentifierGenericBase& destinationID, IPC::MessageReceiver& receiver)
{
addMessageReceiver(messageReceiverName, destinationID.toUInt64(), receiver);
}

template <typename T>
void removeMessageReceiver(IPC::ReceiverName messageReceiverName, ObjectIdentifier<T> destinationID)
void removeMessageReceiver(IPC::ReceiverName messageReceiverName, const ObjectIdentifierGenericBase& destinationID)
{
removeMessageReceiver(messageReceiverName, destinationID.toUInt64());
}
Expand Down
18 changes: 8 additions & 10 deletions Source/WebKit/UIProcess/AuxiliaryProcessProxy.h
Expand Up @@ -69,20 +69,20 @@ class AuxiliaryProcessProxy : public ThreadSafeRefCounted<AuxiliaryProcessProxy,
using AsyncReplyID = IPC::Connection::AsyncReplyID;
template<typename T, typename C> AsyncReplyID sendWithAsyncReply(T&&, C&&, uint64_t destinationID = 0, OptionSet<IPC::SendOption> = { }, ShouldStartProcessThrottlerActivity = ShouldStartProcessThrottlerActivity::Yes);

template<typename T, typename C, typename U>
AsyncReplyID sendWithAsyncReply(T&& message, C&& completionHandler, ObjectIdentifier<U> destinationID, OptionSet<IPC::SendOption> sendOptions = { }, ShouldStartProcessThrottlerActivity shouldStartProcessThrottlerActivity = ShouldStartProcessThrottlerActivity::Yes)
template<typename T, typename C>
AsyncReplyID sendWithAsyncReply(T&& message, C&& completionHandler, const ObjectIdentifierGenericBase& destinationID, OptionSet<IPC::SendOption> sendOptions = { }, ShouldStartProcessThrottlerActivity shouldStartProcessThrottlerActivity = ShouldStartProcessThrottlerActivity::Yes)
{
return sendWithAsyncReply(std::forward<T>(message), std::forward<C>(completionHandler), destinationID.toUInt64(), sendOptions, shouldStartProcessThrottlerActivity);
}

template<typename T, typename U>
bool send(T&& message, ObjectIdentifier<U> destinationID, OptionSet<IPC::SendOption> sendOptions = { })
template<typename T>
bool send(T&& message, const ObjectIdentifierGenericBase& destinationID, OptionSet<IPC::SendOption> sendOptions = { })
{
return send<T>(WTFMove(message), destinationID.toUInt64(), sendOptions);
}

template<typename T, typename U>
SendSyncResult<T> sendSync(T&& message, ObjectIdentifier<U> destinationID, IPC::Timeout timeout = 1_s, OptionSet<IPC::SendSyncOption> sendSyncOptions = { })
template<typename T>
SendSyncResult<T> sendSync(T&& message, const ObjectIdentifierGenericBase& destinationID, IPC::Timeout timeout = 1_s, OptionSet<IPC::SendSyncOption> sendSyncOptions = { })
{
return sendSync<T>(WTFMove(message), destinationID.toUInt64(), timeout, sendSyncOptions);
}
Expand All @@ -108,14 +108,12 @@ class AuxiliaryProcessProxy : public ThreadSafeRefCounted<AuxiliaryProcessProxy,
void removeMessageReceiver(IPC::ReceiverName, uint64_t destinationID);
void removeMessageReceiver(IPC::ReceiverName);

template <typename T>
void addMessageReceiver(IPC::ReceiverName messageReceiverName, ObjectIdentifier<T> destinationID, IPC::MessageReceiver& receiver)
void addMessageReceiver(IPC::ReceiverName messageReceiverName, const ObjectIdentifierGenericBase& destinationID, IPC::MessageReceiver& receiver)
{
addMessageReceiver(messageReceiverName, destinationID.toUInt64(), receiver);
}

template <typename T>
void removeMessageReceiver(IPC::ReceiverName messageReceiverName, ObjectIdentifier<T> destinationID)
void removeMessageReceiver(IPC::ReceiverName messageReceiverName, const ObjectIdentifierGenericBase& destinationID)
{
removeMessageReceiver(messageReceiverName, destinationID.toUInt64());
}
Expand Down
10 changes: 5 additions & 5 deletions Source/WebKit/UIProcess/Extensions/WebExtensionController.h
Expand Up @@ -103,8 +103,8 @@ class WebExtensionController : public API::ObjectImpl<API::Object::Type::WebExte
const WebExtensionContextSet& extensionContexts() const { return m_extensionContexts; }
WebExtensionSet extensions() const;

template<typename T, typename U>
void sendToAllProcesses(const T& message, ObjectIdentifier<U> destinationID);
template<typename T>
void sendToAllProcesses(const T& message, const ObjectIdentifierGenericBase& destinationID);

#ifdef __OBJC__
_WKWebExtensionController *wrapper() const { return (_WKWebExtensionController *)API::ObjectImpl<API::Object::Type::WebExtensionController>::wrapper(); }
Expand Down Expand Up @@ -137,12 +137,12 @@ class WebExtensionController : public API::ObjectImpl<API::Object::Type::WebExte
WebExtensionURLSchemeHandlerMap m_registeredSchemeHandlers;
};

template<typename T, typename U>
void WebExtensionController::sendToAllProcesses(const T& message, ObjectIdentifier<U> destinationID)
template<typename T>
void WebExtensionController::sendToAllProcesses(const T& message, const ObjectIdentifierGenericBase& destinationID)
{
for (auto& process : allProcesses()) {
if (process.canSendMessage())
process.send(T(message), destinationID);
process.send(T(message), destinationID.toUInt64());
}
}

Expand Down
6 changes: 2 additions & 4 deletions Source/WebKit/UIProcess/WebProcessPool.h
Expand Up @@ -170,14 +170,12 @@ class WebProcessPool final

WebBackForwardCache& backForwardCache() { return m_backForwardCache.get(); }

template <typename T>
void addMessageReceiver(IPC::ReceiverName messageReceiverName, ObjectIdentifier<T> destinationID, IPC::MessageReceiver& receiver)
void addMessageReceiver(IPC::ReceiverName messageReceiverName, const ObjectIdentifierGenericBase& destinationID, IPC::MessageReceiver& receiver)
{
addMessageReceiver(messageReceiverName, destinationID.toUInt64(), receiver);
}

template <typename T>
void removeMessageReceiver(IPC::ReceiverName messageReceiverName, ObjectIdentifier<T> destinationID)
void removeMessageReceiver(IPC::ReceiverName messageReceiverName, const ObjectIdentifierGenericBase& destinationID)
{
removeMessageReceiver(messageReceiverName, destinationID.toUInt64());
}
Expand Down

0 comments on commit bce2395

Please sign in to comment.