Convert some JSC code over to std::mutex
[WebKit.git] / Source / JavaScriptCore / inspector / remote / RemoteInspector.h
index 77464cf..95d9b64 100644 (file)
@@ -31,8 +31,7 @@
 #import "RemoteInspectorXPCConnection.h"
 #import <wtf/Forward.h>
 #import <wtf/HashMap.h>
-#import <wtf/NeverDestroyed.h>
-#import <wtf/Threading.h>
+#import <wtf/Forward.h>
 
 OBJC_CLASS NSDictionary;
 OBJC_CLASS NSString;
@@ -43,7 +42,7 @@ class RemoteInspectorDebuggable;
 class RemoteInspectorDebuggableConnection;
 struct RemoteInspectorDebuggableInfo;
 
-class JS_EXPORT_PRIVATE RemoteInspector FINAL : public RemoteInspectorXPCConnection::Client {
+class JS_EXPORT_PRIVATE RemoteInspector final : public RemoteInspectorXPCConnection::Client {
 public:
     static void startDisabled();
     static RemoteInspector& shared();
@@ -73,9 +72,9 @@ private:
 
     void updateHasActiveDebugSession();
 
-    virtual void xpcConnectionReceivedMessage(RemoteInspectorXPCConnection*, NSString *messageName, NSDictionary *userInfo) OVERRIDE;
-    virtual void xpcConnectionFailed(RemoteInspectorXPCConnection*) OVERRIDE;
-    virtual void xpcConnectionUnhandledMessage(RemoteInspectorXPCConnection*, xpc_object_t) OVERRIDE;
+    virtual void xpcConnectionReceivedMessage(RemoteInspectorXPCConnection*, NSString *messageName, NSDictionary *userInfo) override;
+    virtual void xpcConnectionFailed(RemoteInspectorXPCConnection*) override;
+    virtual void xpcConnectionUnhandledMessage(RemoteInspectorXPCConnection*, xpc_object_t) override;
 
     void receivedSetupMessage(NSDictionary *userInfo);
     void receivedDataMessage(NSDictionary *userInfo);
@@ -90,11 +89,12 @@ private:
     // Any debuggable can send messages over the XPC connection.
     // So lock access to all maps and state as they can change
     // from any thread.
-    Mutex m_lock;
+    std::mutex m_mutex;
 
     HashMap<unsigned, std::pair<RemoteInspectorDebuggable*, RemoteInspectorDebuggableInfo>> m_debuggableMap;
     HashMap<unsigned, RefPtr<RemoteInspectorDebuggableConnection>> m_connectionMap;
-    std::unique_ptr<RemoteInspectorXPCConnection> m_xpcConnection;
+    RefPtr<RemoteInspectorXPCConnection> m_xpcConnection;
+    dispatch_queue_t m_xpcQueue;
     unsigned m_nextAvailableIdentifier;
     int m_notifyToken;
     bool m_enabled;