Title: [260714] trunk/Source/WebCore
Revision
260714
Author
[email protected]
Date
2020-04-25 17:31:57 -0700 (Sat, 25 Apr 2020)

Log Message

Use static initialized Lock instead of LazyNeverDestroyed<Lock>
https://bugs.webkit.org/show_bug.cgi?id=211010

Reviewed by Mark Lam.

WTF::Lock can be static-initialized, so no need to use LazyNeverDestroyed<Lock>.

* Modules/webgpu/WebGPUDevice.cpp:
(WebCore::WebGPUDevice::instancesMutex):
* Modules/webgpu/WebGPUPipeline.cpp:
(WebCore::WebGPUPipeline::instancesMutex):
* html/canvas/CanvasRenderingContext.cpp:
(WebCore::CanvasRenderingContext::instancesMutex):
* html/canvas/WebGLProgram.cpp:
(WebCore::WebGLProgram::instancesMutex):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (260713 => 260714)


--- trunk/Source/WebCore/ChangeLog	2020-04-26 00:13:27 UTC (rev 260713)
+++ trunk/Source/WebCore/ChangeLog	2020-04-26 00:31:57 UTC (rev 260714)
@@ -1,3 +1,21 @@
+2020-04-25  Yusuke Suzuki  <[email protected]>
+
+        Use static initialized Lock instead of LazyNeverDestroyed<Lock>
+        https://bugs.webkit.org/show_bug.cgi?id=211010
+
+        Reviewed by Mark Lam.
+
+        WTF::Lock can be static-initialized, so no need to use LazyNeverDestroyed<Lock>.
+
+        * Modules/webgpu/WebGPUDevice.cpp:
+        (WebCore::WebGPUDevice::instancesMutex):
+        * Modules/webgpu/WebGPUPipeline.cpp:
+        (WebCore::WebGPUPipeline::instancesMutex):
+        * html/canvas/CanvasRenderingContext.cpp:
+        (WebCore::CanvasRenderingContext::instancesMutex):
+        * html/canvas/WebGLProgram.cpp:
+        (WebCore::WebGLProgram::instancesMutex):
+
 2020-04-25  Darin Adler  <[email protected]>
 
         [Cocoa] Deal with another round of Xcode upgrade checks

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp (260713 => 260714)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp	2020-04-26 00:13:27 UTC (rev 260713)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp	2020-04-26 00:31:57 UTC (rev 260714)
@@ -109,12 +109,8 @@
 
 Lock& WebGPUDevice::instancesMutex()
 {
-    static LazyNeverDestroyed<Lock> mutex;
-    static std::once_flag initializeMutex;
-    std::call_once(initializeMutex, [] {
-        mutex.construct();
-    });
-    return mutex.get();
+    static Lock mutex;
+    return mutex;
 }
 
 WebGPUDevice::WebGPUDevice(ScriptExecutionContext& context, Ref<const WebGPUAdapter>&& adapter, Ref<GPUDevice>&& device)

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUPipeline.cpp (260713 => 260714)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUPipeline.cpp	2020-04-26 00:13:27 UTC (rev 260713)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUPipeline.cpp	2020-04-26 00:31:57 UTC (rev 260714)
@@ -47,12 +47,8 @@
 
 Lock& WebGPUPipeline::instancesMutex()
 {
-    static LazyNeverDestroyed<Lock> mutex;
-    static std::once_flag initializeMutex;
-    std::call_once(initializeMutex, [] {
-        mutex.construct();
-    });
-    return mutex.get();
+    static Lock mutex;
+    return mutex;
 }
 
 WebGPUPipeline::WebGPUPipeline(WebGPUDevice& device, GPUErrorScopes& errorScopes)

Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext.cpp (260713 => 260714)


--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext.cpp	2020-04-26 00:13:27 UTC (rev 260713)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext.cpp	2020-04-26 00:31:57 UTC (rev 260714)
@@ -52,12 +52,8 @@
 
 Lock& CanvasRenderingContext::instancesMutex()
 {
-    static LazyNeverDestroyed<Lock> mutex;
-    static std::once_flag initializeMutex;
-    std::call_once(initializeMutex, [] {
-        mutex.construct();
-    });
-    return mutex.get();
+    static Lock mutex;
+    return mutex;
 }
 
 CanvasRenderingContext::CanvasRenderingContext(CanvasBase& canvas)

Modified: trunk/Source/WebCore/html/canvas/WebGLProgram.cpp (260713 => 260714)


--- trunk/Source/WebCore/html/canvas/WebGLProgram.cpp	2020-04-26 00:13:27 UTC (rev 260713)
+++ trunk/Source/WebCore/html/canvas/WebGLProgram.cpp	2020-04-26 00:31:57 UTC (rev 260714)
@@ -46,12 +46,8 @@
 
 Lock& WebGLProgram::instancesMutex()
 {
-    static LazyNeverDestroyed<Lock> mutex;
-    static std::once_flag initializeMutex;
-    std::call_once(initializeMutex, [] {
-        mutex.construct();
-    });
-    return mutex.get();
+    static Lock mutex;
+    return mutex;
 }
 
 Ref<WebGLProgram> WebGLProgram::create(WebGLRenderingContextBase& ctx)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to