Title: [233295] trunk/Source
Revision
233295
Author
[email protected]
Date
2018-06-27 18:10:37 -0700 (Wed, 27 Jun 2018)

Log Message

[GTK][WPE] Use LazyNeverDestroyed<XErrorTrapper> to remove static initializers
https://bugs.webkit.org/show_bug.cgi?id=187089

Reviewed by Michael Catanzaro.

Source/WebCore:

Do not allow copying since XErrorTrapper's logic relies on the address of XErrorTrapper.

* platform/graphics/x11/XErrorTrapper.h:

Source/WebKit:

Use LazyNeverDestroyed<XErrorTrapper> instead of global std::unique_ptr<XErrorTrapper>.
Since this variable's exit time destructor is not important in this code, using
LazyNeverDestroyed<XErrorTrapper> is fine. This removes the last static initializer
of libwebkit2gtk.so.

* PluginProcess/unix/PluginProcessMainUnix.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (233294 => 233295)


--- trunk/Source/WebCore/ChangeLog	2018-06-28 01:04:54 UTC (rev 233294)
+++ trunk/Source/WebCore/ChangeLog	2018-06-28 01:10:37 UTC (rev 233295)
@@ -1,3 +1,14 @@
+2018-06-27  Yusuke Suzuki  <[email protected]>
+
+        [GTK][WPE] Use LazyNeverDestroyed<XErrorTrapper> to remove static initializers
+        https://bugs.webkit.org/show_bug.cgi?id=187089
+
+        Reviewed by Michael Catanzaro.
+
+        Do not allow copying since XErrorTrapper's logic relies on the address of XErrorTrapper.
+
+        * platform/graphics/x11/XErrorTrapper.h:
+
 2018-06-27  Zalan Bujtas  <[email protected]>
 
         [LFC] Align inFlowNonReplacedWidthAndMargin() style with the rest of the compute functions.

Modified: trunk/Source/WebCore/platform/graphics/x11/XErrorTrapper.h (233294 => 233295)


--- trunk/Source/WebCore/platform/graphics/x11/XErrorTrapper.h	2018-06-28 01:04:54 UTC (rev 233294)
+++ trunk/Source/WebCore/platform/graphics/x11/XErrorTrapper.h	2018-06-28 01:10:37 UTC (rev 233295)
@@ -32,6 +32,7 @@
 namespace WebCore {
 
 class XErrorTrapper {
+    WTF_MAKE_NONCOPYABLE(XErrorTrapper);
 public:
     enum class Policy { Ignore, Warn, Crash };
     XErrorTrapper(Display*, Policy = Policy::Ignore, Vector<unsigned char>&& expectedErrors = { });

Modified: trunk/Source/WebKit/ChangeLog (233294 => 233295)


--- trunk/Source/WebKit/ChangeLog	2018-06-28 01:04:54 UTC (rev 233294)
+++ trunk/Source/WebKit/ChangeLog	2018-06-28 01:10:37 UTC (rev 233295)
@@ -1,3 +1,17 @@
+2018-06-27  Yusuke Suzuki  <[email protected]>
+
+        [GTK][WPE] Use LazyNeverDestroyed<XErrorTrapper> to remove static initializers
+        https://bugs.webkit.org/show_bug.cgi?id=187089
+
+        Reviewed by Michael Catanzaro.
+
+        Use LazyNeverDestroyed<XErrorTrapper> instead of global std::unique_ptr<XErrorTrapper>.
+        Since this variable's exit time destructor is not important in this code, using
+        LazyNeverDestroyed<XErrorTrapper> is fine. This removes the last static initializer
+        of libwebkit2gtk.so.
+
+        * PluginProcess/unix/PluginProcessMainUnix.cpp:
+
 2018-06-27  Youenn Fablet  <[email protected]>
 
         Add a sandbox profile for some additional bank plugins

Modified: trunk/Source/WebKit/PluginProcess/unix/PluginProcessMainUnix.cpp (233294 => 233295)


--- trunk/Source/WebKit/PluginProcess/unix/PluginProcessMainUnix.cpp	2018-06-28 01:04:54 UTC (rev 233294)
+++ trunk/Source/WebKit/PluginProcess/unix/PluginProcessMainUnix.cpp	2018-06-28 01:10:37 UTC (rev 233295)
@@ -44,12 +44,13 @@
 #if PLATFORM(X11)
 #include <WebCore/PlatformDisplayX11.h>
 #include <WebCore/XErrorTrapper.h>
+#include <wtf/NeverDestroyed.h>
 #endif
 
 namespace WebKit {
 
 #if PLATFORM(X11)
-static std::unique_ptr<WebCore::XErrorTrapper> xErrorTrapper;
+static LazyNeverDestroyed<WebCore::XErrorTrapper> xErrorTrapper;
 #endif
 
 class PluginProcessMain final: public ChildProcessMainBase {
@@ -82,7 +83,7 @@
 #if PLATFORM(X11)
         if (WebCore::PlatformDisplay::sharedDisplay().type() == WebCore::PlatformDisplay::Type::X11) {
             auto* display = downcast<WebCore::PlatformDisplayX11>(WebCore::PlatformDisplay::sharedDisplay()).native();
-            xErrorTrapper = std::make_unique<WebCore::XErrorTrapper>(display, WebCore::XErrorTrapper::Policy::Warn);
+            xErrorTrapper.construct(display, WebCore::XErrorTrapper::Policy::Warn);
         }
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to