Title: [270677] trunk/Source/WebKit
Revision
270677
Author
[email protected]
Date
2020-12-11 08:38:16 -0800 (Fri, 11 Dec 2020)

Log Message

[GLib] Move GCrypt initialization to platformInitialize
https://bugs.webkit.org/show_bug.cgi?id=219749

Reviewed by Adrian Perez de Castro.

It makes more sense for initialization of GCrypt to occur in platformInitialize
than in the main method of the process. This means that the process does not have
to link gcrypt libraries and can just link WebKit only.

* NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp:
(main):
* NetworkProcess/soup/NetworkProcessMainSoup.cpp:
* WebProcess/EntryPoint/unix/WebProcessMain.cpp:
(main):
* WebProcess/gtk/WebProcessMainGtk.cpp:
(WebKit::WebProcessMain):
* WebProcess/wpe/WebProcessMainWPE.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (270676 => 270677)


--- trunk/Source/WebKit/ChangeLog	2020-12-11 16:06:22 UTC (rev 270676)
+++ trunk/Source/WebKit/ChangeLog	2020-12-11 16:38:16 UTC (rev 270677)
@@ -1,3 +1,23 @@
+2020-12-11  Don Olmstead  <[email protected]>
+
+        [GLib] Move GCrypt initialization to platformInitialize
+        https://bugs.webkit.org/show_bug.cgi?id=219749
+
+        Reviewed by Adrian Perez de Castro.
+
+        It makes more sense for initialization of GCrypt to occur in platformInitialize
+        than in the main method of the process. This means that the process does not have
+        to link gcrypt libraries and can just link WebKit only.
+
+        * NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp:
+        (main):
+        * NetworkProcess/soup/NetworkProcessMainSoup.cpp:
+        * WebProcess/EntryPoint/unix/WebProcessMain.cpp:
+        (main):
+        * WebProcess/gtk/WebProcessMainGtk.cpp:
+        (WebKit::WebProcessMain):
+        * WebProcess/wpe/WebProcessMainWPE.cpp:
+
 2020-12-11  Per Arne Vollan  <[email protected]>
 
         [iOS] Remove access to the IOKIt class AGXDeviceUserClient in the WebContent process

Modified: trunk/Source/WebKit/NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp (270676 => 270677)


--- trunk/Source/WebKit/NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp	2020-12-11 16:06:22 UTC (rev 270676)
+++ trunk/Source/WebKit/NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp	2020-12-11 16:38:16 UTC (rev 270677)
@@ -23,21 +23,10 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "config.h"
 #include "NetworkProcessMain.h"
 
-#include <cstdlib>
-
-#if USE(GCRYPT)
-#include <pal/crypto/gcrypt/Initialization.h>
-#endif
-
-using namespace WebKit;
-
 int main(int argc, char** argv)
 {
-#if USE(GCRYPT)
-    PAL::GCrypt::initialize();
-#endif
-
-    return NetworkProcessMain(argc, argv);
+    return WebKit::NetworkProcessMain(argc, argv);
 }

Modified: trunk/Source/WebKit/NetworkProcess/soup/NetworkProcessMainSoup.cpp (270676 => 270677)


--- trunk/Source/WebKit/NetworkProcess/soup/NetworkProcessMainSoup.cpp	2020-12-11 16:06:22 UTC (rev 270676)
+++ trunk/Source/WebKit/NetworkProcess/soup/NetworkProcessMainSoup.cpp	2020-12-11 16:38:16 UTC (rev 270677)
@@ -31,6 +31,10 @@
 #include "NetworkProcess.h"
 #include <WebCore/NetworkStorageSession.h>
 
+#if USE(GCRYPT)
+#include <pal/crypto/gcrypt/Initialization.h>
+#endif
+
 namespace WebKit {
 
 static RefPtr<NetworkProcess> globalNetworkProcess;
@@ -37,6 +41,14 @@
 
 class NetworkProcessMainSoup final: public AuxiliaryProcessMainBase {
 public:
+    bool platformInitialize() override
+    {
+#if USE(GCRYPT)
+        PAL::GCrypt::initialize();
+#endif
+        return true;
+    }
+
     void platformFinalize() override
     {
         // FIXME: Is this still needed? We should probably destroy all existing sessions at this point instead.

Modified: trunk/Source/WebKit/WebProcess/EntryPoint/unix/WebProcessMain.cpp (270676 => 270677)


--- trunk/Source/WebKit/WebProcess/EntryPoint/unix/WebProcessMain.cpp	2020-12-11 16:06:22 UTC (rev 270676)
+++ trunk/Source/WebKit/WebProcess/EntryPoint/unix/WebProcessMain.cpp	2020-12-11 16:38:16 UTC (rev 270677)
@@ -23,24 +23,10 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "config.h"
 #include "WebProcessMain.h"
 
-#include <cstdlib>
-
-#if USE(GCRYPT)
-#include <pal/crypto/gcrypt/Initialization.h>
-#endif
-
-using namespace WebKit;
-
 int main(int argc, char** argv)
 {
-    // Ignore the GTK_THEME environment variable, the theme is always set by the UI process now.
-    unsetenv("GTK_THEME");
-
-#if USE(GCRYPT)
-    PAL::GCrypt::initialize();
-#endif
-
-    return WebProcessMain(argc, argv);
+    return WebKit::WebProcessMain(argc, argv);
 }

Modified: trunk/Source/WebKit/WebProcess/gtk/WebProcessMainGtk.cpp (270676 => 270677)


--- trunk/Source/WebKit/WebProcess/gtk/WebProcessMainGtk.cpp	2020-12-11 16:06:22 UTC (rev 270676)
+++ trunk/Source/WebKit/WebProcess/gtk/WebProcessMainGtk.cpp	2020-12-11 16:38:16 UTC (rev 270677)
@@ -36,6 +36,10 @@
 #include <X11/Xlib.h>
 #endif
 
+#if USE(GCRYPT)
+#include <pal/crypto/gcrypt/Initialization.h>
+#endif
+
 namespace WebKit {
 using namespace WebCore;
 
@@ -43,6 +47,10 @@
 public:
     bool platformInitialize() override
     {
+#if USE(GCRYPT)
+        PAL::GCrypt::initialize();
+#endif
+
 #if ENABLE(DEVELOPER_MODE)
         if (g_getenv("WEBKIT2_PAUSE_WEB_PROCESS_ON_LAUNCH"))
             g_usleep(30 * G_USEC_PER_SEC);
@@ -63,6 +71,10 @@
 
 int WebProcessMain(int argc, char** argv)
 {
+    // Ignore the GTK_THEME environment variable, the theme is always set by the UI process now.
+    // This call needs to happen before any threads begin execution
+    unsetenv("GTK_THEME");
+
     return AuxiliaryProcessMain<WebProcess, WebProcessMainGtk>(argc, argv);
 }
 

Modified: trunk/Source/WebKit/WebProcess/wpe/WebProcessMainWPE.cpp (270676 => 270677)


--- trunk/Source/WebKit/WebProcess/wpe/WebProcessMainWPE.cpp	2020-12-11 16:06:22 UTC (rev 270676)
+++ trunk/Source/WebKit/WebProcess/wpe/WebProcessMainWPE.cpp	2020-12-11 16:38:16 UTC (rev 270677)
@@ -36,6 +36,10 @@
 #include <atk/atk.h>
 #endif
 
+#if USE(GCRYPT)
+#include <pal/crypto/gcrypt/Initialization.h>
+#endif
+
 namespace WebKit {
 using namespace WebCore;
 
@@ -76,6 +80,10 @@
 public:
     bool platformInitialize() override
     {
+#if USE(GCRYPT)
+        PAL::GCrypt::initialize();
+#endif
+
 #if ENABLE(DEVELOPER_MODE)
         if (g_getenv("WEBKIT2_PAUSE_WEB_PROCESS_ON_LAUNCH"))
             WTF::sleep(30_s);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to