Title: [230583] trunk/Source/WebCore
Revision
230583
Author
cdu...@apple.com
Date
2018-04-12 10:51:33 -0700 (Thu, 12 Apr 2018)

Log Message

Process::setIdentifier() / Process::identifier() do not need a lock
https://bugs.webkit.org/show_bug.cgi?id=184544

Reviewed by Brady Eidson.

Process::setIdentifier() / Process::identifier() do not need a lock.
Process::setIdentifier() gets called in ChildProcess::initialize(),
before we start any background threads. It is then safe to query
this process identifier later on from background threads without
locks.

* platform/Process.cpp:
(WebCore::Process::setIdentifier):
(WebCore::Process::identifier):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (230582 => 230583)


--- trunk/Source/WebCore/ChangeLog	2018-04-12 17:41:37 UTC (rev 230582)
+++ trunk/Source/WebCore/ChangeLog	2018-04-12 17:51:33 UTC (rev 230583)
@@ -1,3 +1,20 @@
+2018-04-12  Chris Dumez  <cdu...@apple.com>
+
+        Process::setIdentifier() / Process::identifier() do not need a lock
+        https://bugs.webkit.org/show_bug.cgi?id=184544
+
+        Reviewed by Brady Eidson.
+
+        Process::setIdentifier() / Process::identifier() do not need a lock.
+        Process::setIdentifier() gets called in ChildProcess::initialize(),
+        before we start any background threads. It is then safe to query
+        this process identifier later on from background threads without
+        locks.
+
+        * platform/Process.cpp:
+        (WebCore::Process::setIdentifier):
+        (WebCore::Process::identifier):
+
 2018-04-12  Antoine Quint  <grao...@apple.com>
 
         Unreviewed, fix the Windows build.

Modified: trunk/Source/WebCore/platform/Process.cpp (230582 => 230583)


--- trunk/Source/WebCore/platform/Process.cpp	2018-04-12 17:41:37 UTC (rev 230582)
+++ trunk/Source/WebCore/platform/Process.cpp	2018-04-12 17:51:33 UTC (rev 230583)
@@ -26,8 +26,6 @@
 #include "config.h"
 #include "Process.h"
 
-#include <wtf/Lock.h>
-#include <wtf/Locker.h>
 #include <wtf/MainThread.h>
 
 namespace WebCore {
@@ -34,12 +32,10 @@
 namespace Process {
 
 static std::optional<ProcessIdentifier> globalIdentifier;
-static Lock globalIdentifierLock;
 
 void setIdentifier(ProcessIdentifier processIdentifier)
 {
     ASSERT(isMainThread());
-    Locker<Lock> locker(globalIdentifierLock);
     globalIdentifier = processIdentifier;
 }
 
@@ -47,12 +43,10 @@
 {
     static std::once_flag onceFlag;
     std::call_once(onceFlag, [] {
-        Locker<Lock> locker(globalIdentifierLock);
         if (!globalIdentifier)
             globalIdentifier = generateObjectIdentifier<ProcessIdentifierType>();
     });
 
-    Locker<Lock> locker(globalIdentifierLock);
     return *globalIdentifier;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to