Followups to (r242306): Use LockHolder instead of std::lock_guard on Remote Inspector...
authorchris.reid@sony.com <chris.reid@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Mar 2019 00:06:47 +0000 (00:06 +0000)
committerchris.reid@sony.com <chris.reid@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Mar 2019 00:06:47 +0000 (00:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=195381

Reviewed by Mark Lam.

Replacing std::lock_guard uses in Remote Inspector with WTF::LockHolder.
Also using `= { }` for struct initialization instead of memeset.

* inspector/remote/RemoteConnectionToTarget.cpp:
* inspector/remote/RemoteInspector.cpp:
* inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm:
* inspector/remote/cocoa/RemoteInspectorCocoa.mm:
* inspector/remote/cocoa/RemoteInspectorXPCConnection.mm:
* inspector/remote/glib/RemoteInspectorGlib.cpp:
* inspector/remote/playstation/RemoteInspectorPlayStation.cpp:
* inspector/remote/playstation/RemoteInspectorSocketClientPlayStation.cpp:
* inspector/remote/playstation/RemoteInspectorSocketPlayStation.cpp:
* inspector/remote/playstation/RemoteInspectorSocketServerPlayStation.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242576 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.cpp
Source/JavaScriptCore/inspector/remote/RemoteInspector.cpp
Source/JavaScriptCore/inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm
Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorCocoa.mm
Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorXPCConnection.mm
Source/JavaScriptCore/inspector/remote/glib/RemoteInspectorGlib.cpp
Source/JavaScriptCore/inspector/remote/playstation/RemoteInspectorPlayStation.cpp
Source/JavaScriptCore/inspector/remote/playstation/RemoteInspectorSocketClientPlayStation.cpp
Source/JavaScriptCore/inspector/remote/playstation/RemoteInspectorSocketPlayStation.cpp
Source/JavaScriptCore/inspector/remote/playstation/RemoteInspectorSocketServerPlayStation.cpp

index 8e94272..8b416c8 100644 (file)
@@ -1,3 +1,24 @@
+2019-03-06  Christopher Reid  <chris.reid@sony.com>
+
+        Followups to (r242306): Use LockHolder instead of std::lock_guard on Remote Inspector Locks
+        https://bugs.webkit.org/show_bug.cgi?id=195381
+
+        Reviewed by Mark Lam.
+
+        Replacing std::lock_guard uses in Remote Inspector with WTF::LockHolder.
+        Also using `= { }` for struct initialization instead of memeset.
+
+        * inspector/remote/RemoteConnectionToTarget.cpp:
+        * inspector/remote/RemoteInspector.cpp:
+        * inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm:
+        * inspector/remote/cocoa/RemoteInspectorCocoa.mm:
+        * inspector/remote/cocoa/RemoteInspectorXPCConnection.mm:
+        * inspector/remote/glib/RemoteInspectorGlib.cpp:
+        * inspector/remote/playstation/RemoteInspectorPlayStation.cpp:
+        * inspector/remote/playstation/RemoteInspectorSocketClientPlayStation.cpp:
+        * inspector/remote/playstation/RemoteInspectorSocketPlayStation.cpp:
+        * inspector/remote/playstation/RemoteInspectorSocketServerPlayStation.cpp:
+
 2019-03-06  Saam Barati  <sbarati@apple.com>
 
         Air::reportUsedRegisters must padInterference
index 5dde888..dd1e703 100644 (file)
@@ -45,7 +45,7 @@ RemoteConnectionToTarget::~RemoteConnectionToTarget()
 
 bool RemoteConnectionToTarget::setup(bool isAutomaticInspection, bool automaticallyPause)
 {
-    std::lock_guard<Lock> lock(m_targetMutex);
+    LockHolder lock(m_targetMutex);
     if (!m_target)
         return false;
 
@@ -75,7 +75,7 @@ void RemoteConnectionToTarget::sendMessageToTarget(const String& message)
 {
     RemoteControllableTarget* target = nullptr;
     {
-        std::lock_guard<Lock> lock(m_targetMutex);
+        LockHolder lock(m_targetMutex);
         if (!m_target)
             return;
         target = m_target;
@@ -86,7 +86,7 @@ void RemoteConnectionToTarget::sendMessageToTarget(const String& message)
 
 void RemoteConnectionToTarget::close()
 {
-    std::lock_guard<Lock> lock(m_targetMutex);
+    LockHolder lock(m_targetMutex);
     if (!m_target)
         return;
 
@@ -102,7 +102,7 @@ void RemoteConnectionToTarget::close()
 
 void RemoteConnectionToTarget::targetClosed()
 {
-    std::lock_guard<Lock> lock(m_targetMutex);
+    LockHolder lock(m_targetMutex);
     m_target = nullptr;
 }
 
index 3b10f29..c7dabf6 100644 (file)
@@ -57,7 +57,7 @@ void RemoteInspector::registerTarget(RemoteControllableTarget* target)
 {
     ASSERT_ARG(target, target);
 
-    std::lock_guard<Lock> lock(m_mutex);
+    LockHolder lock(m_mutex);
 
     unsigned targetIdentifier = nextAvailableTargetIdentifier();
     target->setTargetIdentifier(targetIdentifier);
@@ -80,7 +80,7 @@ void RemoteInspector::unregisterTarget(RemoteControllableTarget* target)
 {
     ASSERT_ARG(target, target);
 
-    std::lock_guard<Lock> lock(m_mutex);
+    LockHolder lock(m_mutex);
 
     unsigned targetIdentifier = target->targetIdentifier();
     if (!targetIdentifier)
@@ -102,7 +102,7 @@ void RemoteInspector::updateTarget(RemoteControllableTarget* target)
 {
     ASSERT_ARG(target, target);
 
-    std::lock_guard<Lock> lock(m_mutex);
+    LockHolder lock(m_mutex);
 
     unsigned targetIdentifier = target->targetIdentifier();
     if (!targetIdentifier)
@@ -127,7 +127,7 @@ void RemoteInspector::updateClientCapabilities()
 {
     ASSERT(isMainThread());
 
-    std::lock_guard<Lock> lock(m_mutex);
+    LockHolder lock(m_mutex);
 
     if (!m_client)
         m_clientCapabilities = WTF::nullopt;
@@ -147,7 +147,7 @@ void RemoteInspector::setClient(RemoteInspector::Client* client)
     ASSERT((m_client && !client) || (!m_client && client));
 
     {
-        std::lock_guard<Lock> lock(m_mutex);
+        LockHolder lock(m_mutex);
         m_client = client;
     }
 
@@ -158,7 +158,7 @@ void RemoteInspector::setClient(RemoteInspector::Client* client)
 
 void RemoteInspector::setupFailed(unsigned targetIdentifier)
 {
-    std::lock_guard<Lock> lock(m_mutex);
+    LockHolder lock(m_mutex);
 
     m_targetConnectionMap.remove(targetIdentifier);
 
@@ -172,7 +172,7 @@ void RemoteInspector::setupFailed(unsigned targetIdentifier)
 
 void RemoteInspector::setupCompleted(unsigned targetIdentifier)
 {
-    std::lock_guard<Lock> lock(m_mutex);
+    LockHolder lock(m_mutex);
 
     if (targetIdentifier == m_automaticInspectionCandidateTargetIdentifier)
         m_automaticInspectionPaused = false;
@@ -192,7 +192,7 @@ void RemoteInspector::clientCapabilitiesDidChange()
 
 void RemoteInspector::stop()
 {
-    std::lock_guard<Lock> lock(m_mutex);
+    LockHolder lock(m_mutex);
 
     stopInternal(StopSource::API);
 }
index 2fafa12..b4740c6 100644 (file)
@@ -53,7 +53,7 @@ static void RemoteTargetHandleRunSourceGlobal(void*)
 
     RemoteTargetQueue queueCopy;
     {
-        std::lock_guard<Lock> lock(rwiQueueMutex);
+        LockHolder lock(rwiQueueMutex);
         queueCopy = *rwiQueue;
         rwiQueue->clear();
     }
@@ -68,7 +68,7 @@ static void RemoteTargetQueueTaskOnGlobalQueue(void (^task)())
     ASSERT(rwiQueue);
 
     {
-        std::lock_guard<Lock> lock(rwiQueueMutex);
+        LockHolder lock(rwiQueueMutex);
         rwiQueue->append(task);
     }
 
@@ -97,7 +97,7 @@ static void RemoteTargetHandleRunSourceWithInfo(void* info)
 
     RemoteTargetQueue queueCopy;
     {
-        std::lock_guard<Lock> lock(connectionToTarget->queueMutex());
+        LockHolder lock(connectionToTarget->queueMutex());
         queueCopy = connectionToTarget->queue();
         connectionToTarget->clearQueue();
     }
@@ -154,7 +154,7 @@ void RemoteConnectionToTarget::dispatchAsyncOnTarget(void (^block)())
 
 bool RemoteConnectionToTarget::setup(bool isAutomaticInspection, bool automaticallyPause)
 {
-    std::lock_guard<Lock> lock(m_targetMutex);
+    LockHolder lock(m_targetMutex);
 
     if (!m_target)
         return false;
@@ -164,7 +164,7 @@ bool RemoteConnectionToTarget::setup(bool isAutomaticInspection, bool automatica
     ref();
     dispatchAsyncOnTarget(^{
         {
-            std::lock_guard<Lock> lock(m_targetMutex);
+            LockHolder lock(m_targetMutex);
 
             if (!m_target || !m_target->remoteControlAllowed()) {
                 RemoteInspector::singleton().setupFailed(targetIdentifier);
@@ -191,7 +191,7 @@ bool RemoteConnectionToTarget::setup(bool isAutomaticInspection, bool automatica
 
 void RemoteConnectionToTarget::targetClosed()
 {
-    std::lock_guard<Lock> lock(m_targetMutex);
+    LockHolder lock(m_targetMutex);
 
     m_target = nullptr;
 }
@@ -203,7 +203,7 @@ void RemoteConnectionToTarget::close()
     ref();
     dispatchAsyncOnTarget(^{
         {
-            std::lock_guard<Lock> lock(m_targetMutex);
+            LockHolder lock(m_targetMutex);
             if (m_target) {
                 if (m_connected)
                     m_target->disconnect(*this);
@@ -224,7 +224,7 @@ void RemoteConnectionToTarget::sendMessageToTarget(NSString *message)
         {
             RemoteControllableTarget* target = nullptr;
             {
-                std::lock_guard<Lock> lock(m_targetMutex);
+                LockHolder lock(m_targetMutex);
                 if (!m_target)
                     return;
                 target = m_target;
@@ -278,7 +278,7 @@ void RemoteConnectionToTarget::queueTaskOnPrivateRunLoop(void (^block)())
     ASSERT(m_runLoop);
 
     {
-        std::lock_guard<Lock> lock(m_queueMutex);
+        LockHolder lock(m_queueMutex);
         m_queue.append(block);
     }
 
index 6188069..60567bf 100644 (file)
@@ -120,7 +120,7 @@ void RemoteInspector::updateAutomaticInspectionCandidate(RemoteInspectionTarget*
 {
     ASSERT_ARG(target, target);
     {
-        std::lock_guard<Lock> lock(m_mutex);
+        LockHolder lock(m_mutex);
 
         unsigned targetIdentifier = target->targetIdentifier();
         if (!targetIdentifier)
@@ -167,7 +167,7 @@ void RemoteInspector::updateAutomaticInspectionCandidate(RemoteInspectionTarget*
         int64_t debuggerTimeoutDelay = 1;
 #endif
         dispatch_after(dispatch_time(DISPATCH_TIME_NOW, debuggerTimeoutDelay * NSEC_PER_SEC), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-            std::lock_guard<Lock> lock(m_mutex);
+            LockHolder lock(m_mutex);
             if (m_automaticInspectionCandidateTargetIdentifier == targetIdentifier) {
                 LOG_ERROR("Skipping Automatic Inspection Candidate with pageId(%u) because we failed to receive a response in time.", m_automaticInspectionCandidateTargetIdentifier);
                 m_automaticInspectionPaused = false;
@@ -178,7 +178,7 @@ void RemoteInspector::updateAutomaticInspectionCandidate(RemoteInspectionTarget*
     target->pauseWaitingForAutomaticInspection();
 
     {
-        std::lock_guard<Lock> lock(m_mutex);
+        LockHolder lock(m_mutex);
 
         ASSERT(m_automaticInspectionCandidateTargetIdentifier);
         m_automaticInspectionCandidateTargetIdentifier = 0;
@@ -199,7 +199,7 @@ void RemoteInspector::sendAutomaticInspectionCandidateMessage()
 
 void RemoteInspector::sendMessageToRemote(unsigned targetIdentifier, const String& message)
 {
-    std::lock_guard<Lock> lock(m_mutex);
+    LockHolder lock(m_mutex);
 
     if (!m_relayConnection)
         return;
@@ -219,7 +219,7 @@ void RemoteInspector::sendMessageToRemote(unsigned targetIdentifier, const Strin
 
 void RemoteInspector::start()
 {
-    std::lock_guard<Lock> lock(m_mutex);
+    LockHolder lock(m_mutex);
 
     if (m_enabled)
         return;
@@ -274,7 +274,7 @@ void RemoteInspector::stopInternal(StopSource source)
 
 void RemoteInspector::setupXPCConnectionIfNeeded()
 {
-    std::lock_guard<Lock> lock(m_mutex);
+    LockHolder lock(m_mutex);
 
     if (m_relayConnection)
         return;
@@ -299,7 +299,7 @@ void RemoteInspector::setupXPCConnectionIfNeeded()
 
 void RemoteInspector::setParentProcessInformation(pid_t pid, RetainPtr<CFDataRef> auditData)
 {
-    std::lock_guard<Lock> lock(m_mutex);
+    LockHolder lock(m_mutex);
 
     if (m_parentProcessIdentifier || m_parentProcessAuditData)
         return;
@@ -315,7 +315,7 @@ void RemoteInspector::setParentProcessInformation(pid_t pid, RetainPtr<CFDataRef
 
 void RemoteInspector::xpcConnectionReceivedMessage(RemoteInspectorXPCConnection*, NSString *messageName, NSDictionary *userInfo)
 {
-    std::lock_guard<Lock> lock(m_mutex);
+    LockHolder lock(m_mutex);
 
     if ([messageName isEqualToString:WIRPermissionDenied]) {
         stopInternal(StopSource::XPCMessage);
@@ -348,7 +348,7 @@ void RemoteInspector::xpcConnectionReceivedMessage(RemoteInspectorXPCConnection*
 
 void RemoteInspector::xpcConnectionFailed(RemoteInspectorXPCConnection* relayConnection)
 {
-    std::lock_guard<Lock> lock(m_mutex);
+    LockHolder lock(m_mutex);
 
     ASSERT(relayConnection == m_relayConnection);
     if (relayConnection != m_relayConnection)
@@ -470,7 +470,7 @@ void RemoteInspector::pushListingsSoon()
 
     m_pushScheduled = true;
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.2 * NSEC_PER_SEC), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        std::lock_guard<Lock> lock(m_mutex);
+        LockHolder lock(m_mutex);
         if (m_pushScheduled)
             pushListingsNow();
     });
@@ -595,7 +595,7 @@ void RemoteInspector::receivedIndicateMessage(NSDictionary *userInfo)
     callOnWebThreadOrDispatchAsyncOnMainThread(^{
         RemoteControllableTarget* target = nullptr;
         {
-            std::lock_guard<Lock> lock(m_mutex);
+            LockHolder lock(m_mutex);
 
             auto findResult = m_targetMap.find(targetIdentifier);
             if (findResult == m_targetMap.end())
@@ -619,7 +619,7 @@ void RemoteInspector::receivedProxyApplicationSetupMessage(NSDictionary *)
         // Wait a bit for the information, but give up after a second.
         m_shouldSendParentProcessInformation = true;
         dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-            std::lock_guard<Lock> lock(m_mutex);
+            LockHolder lock(m_mutex);
             if (m_shouldSendParentProcessInformation)
                 stopInternal(StopSource::XPCMessage);
         });
index 753ac4a..723103a 100644 (file)
@@ -74,7 +74,7 @@ RemoteInspectorXPCConnection::~RemoteInspectorXPCConnection()
 
 void RemoteInspectorXPCConnection::close()
 {
-    std::lock_guard<Lock> lock(m_mutex);
+    LockHolder lock(m_mutex);
     closeFromMessage();
 }
 
@@ -84,7 +84,7 @@ void RemoteInspectorXPCConnection::closeFromMessage()
     m_client = nullptr;
 
     dispatch_async(m_queue, ^{
-        std::lock_guard<Lock> lock(m_mutex);
+        LockHolder lock(m_mutex);
         // This will trigger one last XPC_ERROR_CONNECTION_INVALID event on the queue and deref us.
         closeOnQueue();
     });
@@ -111,7 +111,7 @@ NSDictionary *RemoteInspectorXPCConnection::deserializeMessage(xpc_object_t obje
 
     xpc_object_t xpcDictionary = xpc_dictionary_get_value(object, RemoteInspectorXPCConnectionSerializedMessageKey);
     if (!xpcDictionary || xpc_get_type(xpcDictionary) != XPC_TYPE_DICTIONARY) {
-        std::lock_guard<Lock> lock(m_mutex);
+        LockHolder lock(m_mutex);
         if (m_client)
             m_client->xpcConnectionUnhandledMessage(this, object);
         return nil;
@@ -127,7 +127,7 @@ void RemoteInspectorXPCConnection::handleEvent(xpc_object_t object)
 {
     if (xpc_get_type(object) == XPC_TYPE_ERROR) {
         {
-            std::lock_guard<Lock> lock(m_mutex);
+            LockHolder lock(m_mutex);
             if (m_client)
                 m_client->xpcConnectionFailed(this);
 
@@ -149,7 +149,7 @@ void RemoteInspectorXPCConnection::handleEvent(xpc_object_t object)
         audit_token_t token;
         xpc_connection_get_audit_token(m_connection, &token);
         if (!WTF::hasEntitlement(token, "com.apple.private.webinspector.webinspectord")) {
-            std::lock_guard<Lock> lock(m_mutex);
+            LockHolder lock(m_mutex);
             // This will trigger one last XPC_ERROR_CONNECTION_INVALID event on the queue and deref us.
             closeOnQueue();
             return;
@@ -170,7 +170,7 @@ void RemoteInspectorXPCConnection::handleEvent(xpc_object_t object)
     if (userInfo && ![userInfo isKindOfClass:[NSDictionary class]])
         return;
 
-    std::lock_guard<Lock> lock(m_mutex);
+    LockHolder lock(m_mutex);
     if (m_client)
         m_client->xpcConnectionReceivedMessage(this, message, userInfo);
 }
index c075698..9924a7a 100644 (file)
@@ -57,7 +57,7 @@ RemoteInspector::RemoteInspector()
 
 void RemoteInspector::start()
 {
-    std::lock_guard<Lock> lock(m_mutex);
+    LockHolder lock(m_mutex);
 
     if (m_enabled)
         return;
@@ -156,7 +156,7 @@ const GDBusInterfaceVTable RemoteInspector::s_interfaceVTable = {
 
 void RemoteInspector::setupConnection(GRefPtr<GDBusConnection>&& connection)
 {
-    std::lock_guard<Lock> lock(m_mutex);
+    LockHolder lock(m_mutex);
 
     ASSERT(connection);
     ASSERT(!m_dbusConnection);
@@ -234,7 +234,7 @@ void RemoteInspector::pushListingsSoon()
     m_pushScheduled = true;
 
     RunLoop::current().dispatch([this] {
-        std::lock_guard<Lock> lock(m_mutex);
+        LockHolder lock(m_mutex);
         if (m_pushScheduled)
             pushListingsNow();
     });
@@ -242,7 +242,7 @@ void RemoteInspector::pushListingsSoon()
 
 void RemoteInspector::updateAutomaticInspectionCandidate(RemoteInspectionTarget* target)
 {
-    std::lock_guard<Lock> lock(m_mutex);
+    LockHolder lock(m_mutex);
 
     ASSERT(target);
     unsigned targetIdentifier = target->targetIdentifier();
@@ -274,7 +274,7 @@ void RemoteInspector::sendAutomaticInspectionCandidateMessage()
 
 void RemoteInspector::sendMessageToRemote(unsigned targetIdentifier, const String& message)
 {
-    std::lock_guard<Lock> lock(m_mutex);
+    LockHolder lock(m_mutex);
     if (!m_dbusConnection)
         return;
 
@@ -287,7 +287,7 @@ void RemoteInspector::sendMessageToRemote(unsigned targetIdentifier, const Strin
 
 void RemoteInspector::receivedGetTargetListMessage()
 {
-    std::lock_guard<Lock> lock(m_mutex);
+    LockHolder lock(m_mutex);
     pushListingsNow();
 }
 
@@ -300,7 +300,7 @@ void RemoteInspector::receivedDataMessage(unsigned targetIdentifier, const char*
 {
     RefPtr<RemoteConnectionToTarget> connectionToTarget;
     {
-        std::lock_guard<Lock> lock(m_mutex);
+        LockHolder lock(m_mutex);
         connectionToTarget = m_targetConnectionMap.get(targetIdentifier);
         if (!connectionToTarget)
             return;
@@ -312,7 +312,7 @@ void RemoteInspector::receivedCloseMessage(unsigned targetIdentifier)
 {
     RefPtr<RemoteConnectionToTarget> connectionToTarget;
     {
-        std::lock_guard<Lock> lock(m_mutex);
+        LockHolder lock(m_mutex);
         RemoteControllableTarget* target = m_targetMap.get(targetIdentifier);
         if (!target)
             return;
@@ -329,7 +329,7 @@ void RemoteInspector::setup(unsigned targetIdentifier)
 {
     RemoteControllableTarget* target;
     {
-        std::lock_guard<Lock> lock(m_mutex);
+        LockHolder lock(m_mutex);
         target = m_targetMap.get(targetIdentifier);
         if (!target)
             return;
@@ -342,7 +342,7 @@ void RemoteInspector::setup(unsigned targetIdentifier)
         return;
     }
 
-    std::lock_guard<Lock> lock(m_mutex);
+    LockHolder lock(m_mutex);
     m_targetConnectionMap.set(targetIdentifier, WTFMove(connectionToTarget));
 
     updateHasActiveDebugSession();
index 6c5103f..f3dfbcb 100644 (file)
@@ -57,7 +57,7 @@ void RemoteInspector::didClose(ClientID clientID)
         return;
 
     RunLoop::current().dispatch([=] {
-        std::lock_guard<Lock> lock(m_mutex);
+        LockHolder lock(m_mutex);
         stopInternal(StopSource::API);
     });
 }
@@ -85,7 +85,7 @@ void RemoteInspector::sendWebInspectorEvent(const String& event)
 
 void RemoteInspector::start()
 {
-    std::lock_guard<Lock> lock(m_mutex);
+    LockHolder lock(m_mutex);
 
     if (m_enabled || s_connectionIdentifier == INVALID_SOCKET_VALUE)
         return;
@@ -178,7 +178,7 @@ void RemoteInspector::pushListingsSoon()
     m_pushScheduled = true;
 
     RunLoop::current().dispatch([=] {
-        std::lock_guard<Lock> lock(m_mutex);
+        LockHolder lock(m_mutex);
         if (m_pushScheduled)
             pushListingsNow();
     });
@@ -194,7 +194,7 @@ void RemoteInspector::sendAutomaticInspectionCandidateMessage()
 
 void RemoteInspector::sendMessageToRemote(unsigned targetIdentifier, const String& message)
 {
-    std::lock_guard<Lock> lock(m_mutex);
+    LockHolder lock(m_mutex);
     if (!m_socketConnection)
         return;
 
@@ -209,7 +209,7 @@ void RemoteInspector::receivedGetTargetListMessage(const Event&)
 {
     ASSERT(isMainThread());
 
-    std::lock_guard<Lock> lock(m_mutex);
+    LockHolder lock(m_mutex);
     pushListingsNow();
 }
 
@@ -230,7 +230,7 @@ void RemoteInspector::receivedDataMessage(const Event& event)
 
     RefPtr<RemoteConnectionToTarget> connectionToTarget;
     {
-        std::lock_guard<Lock> lock(m_mutex);
+        LockHolder lock(m_mutex);
         connectionToTarget = m_targetConnectionMap.get(event.targetID.value());
         if (!connectionToTarget)
             return;
@@ -248,7 +248,7 @@ void RemoteInspector::receivedCloseMessage(const Event& event)
 
     RefPtr<RemoteConnectionToTarget> connectionToTarget;
     {
-        std::lock_guard<Lock> lock(m_mutex);
+        LockHolder lock(m_mutex);
         RemoteControllableTarget* target = m_targetMap.get(event.targetID.value());
         if (!target)
             return;
@@ -265,7 +265,7 @@ void RemoteInspector::setup(unsigned targetIdentifier)
 {
     RemoteControllableTarget* target;
     {
-        std::lock_guard<Lock> lock(m_mutex);
+        LockHolder lock(m_mutex);
         target = m_targetMap.get(targetIdentifier);
         if (!target)
             return;
@@ -278,7 +278,7 @@ void RemoteInspector::setup(unsigned targetIdentifier)
         return;
     }
 
-    std::lock_guard<Lock> lock(m_mutex);
+    LockHolder lock(m_mutex);
     m_targetConnectionMap.set(targetIdentifier, WTFMove(connectionToTarget));
 
     updateHasActiveDebugSession();
index 81f84ec..c6935c8 100644 (file)
@@ -44,8 +44,8 @@ RemoteInspectorSocketClient::RemoteInspectorSocketClient(RemoteInspectorConnecti
 
 Optional<ClientID> RemoteInspectorSocketClient::connectInet(const char* serverAddress, uint16_t serverPort)
 {
-    struct sockaddr_in address;
-    memset(&address, 0, sizeof(address));
+    struct sockaddr_in address = { };
+
     address.sin_family = AF_INET;
     inet_aton(serverAddress, &address.sin_addr);
     address.sin_port = htons(serverPort);
index 775def1..96deb3d 100644 (file)
@@ -257,8 +257,8 @@ void RemoteInspectorSocket::acceptInetSocketIfEnabled(ClientID id)
 
     LockHolder lock(m_connectionsLock);
     if (const auto& connection = m_connections.get(id)) {
-        struct sockaddr_in address;
-        memset(&address, 0, sizeof(address));
+        struct sockaddr_in address = { };
+
         socklen_t len = sizeof(struct sockaddr_in);
         int fd = accept(connection->socket, (struct sockaddr*)&address, &len);
         if (fd < 0) {
index 9187a06..7f1d831 100644 (file)
@@ -44,8 +44,7 @@ RemoteInspectorSocketServer::RemoteInspectorSocketServer(RemoteInspectorConnecti
 
 bool RemoteInspectorSocketServer::listenInet(uint16_t port)
 {
-    struct sockaddr_in address;
-    memset(&address, 0, sizeof(address));
+    struct sockaddr_in address = { };
 
     int fdListen = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
     if (fdListen < 0) {