Skip to content
Permalink
Browse files
[GTK] Replace DEFINE_STATIC_LOCAL with NeverDestroyed<T> in GTK WK1 a…
…nd WK2 code

https://bugs.webkit.org/show_bug.cgi?id=128195

Reviewed by Martin Robinson.

Use static NeverDestroyed<T> variables instead of the DEFINE_STATIC_LOCAL macro.

Source/WebKit/gtk:

* WebCoreSupport/PlatformStrategiesGtk.cpp:
(PlatformStrategiesGtk::initialize):
* WebCoreSupport/PlatformStrategiesGtk.h:
* webkit/webkitwebsettings.cpp:
(isGoogleDomain):

Source/WebKit2:

* UIProcess/API/gtk/WebKitBackForwardListItem.cpp:
(historyItemsMap):
* UIProcess/API/gtk/WebKitWebContext.cpp:
(downloadsMap):
* UIProcess/gtk/WebPageProxyGtk.cpp:
(WebKit::pluginWindowMap):
* WebProcess/gtk/WebGtkExtensionManager.cpp:
(WebKit::WebGtkExtensionManager::shared):
* WebProcess/gtk/WebGtkExtensionManager.h:


Canonical link: https://commits.webkit.org/146236@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@163433 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
zdobersek committed Feb 5, 2014
1 parent 05a7530 commit 60a659d9c5bd1b8c692e9e59802551305d46f7c1
@@ -1,3 +1,18 @@
2014-02-05 Zan Dobersek <zdobersek@igalia.com>

[GTK] Replace DEFINE_STATIC_LOCAL with NeverDestroyed<T> in GTK WK1 and WK2 code
https://bugs.webkit.org/show_bug.cgi?id=128195

Reviewed by Martin Robinson.

Use static NeverDestroyed<T> variables instead of the DEFINE_STATIC_LOCAL macro.

* WebCoreSupport/PlatformStrategiesGtk.cpp:
(PlatformStrategiesGtk::initialize):
* WebCoreSupport/PlatformStrategiesGtk.h:
* webkit/webkitwebsettings.cpp:
(isGoogleDomain):

2014-02-04 Andreas Kling <akling@apple.com>

Remove <iframe seamless> support.
@@ -30,8 +30,8 @@ using namespace WebCore;

void PlatformStrategiesGtk::initialize()
{
DEFINE_STATIC_LOCAL(PlatformStrategiesGtk, platformStrategies, ());
setPlatformStrategies(&platformStrategies);
static NeverDestroyed<PlatformStrategiesGtk> platformStrategies;
setPlatformStrategies(&platformStrategies.get());
}

PlatformStrategiesGtk::PlatformStrategiesGtk()
@@ -28,6 +28,7 @@
#include "SharedWorkerStrategy.h"
#include "StorageStrategy.h"
#include "VisitedLinkStrategy.h"
#include <wtf/NeverDestroyed.h>

class PlatformStrategiesGtk : public WebCore::PlatformStrategies, private WebCore::CookiesStrategy, private WebCore::DatabaseStrategy, private WebCore::LoaderStrategy, private WebCore::PluginStrategy, private WebCore::SharedWorkerStrategy, private WebCore::StorageStrategy, private WebCore::VisitedLinkStrategy {
public:
@@ -64,6 +65,8 @@ class PlatformStrategiesGtk : public WebCore::PlatformStrategies, private WebCor
// WebCore::VisitedLinkStrategy
virtual bool isLinkVisited(WebCore::Page*, WebCore::LinkHash, const WebCore::URL& baseURL, const WTF::AtomicString& attributeURL);
virtual void addVisitedLink(WebCore::Page*, WebCore::LinkHash);

friend class NeverDestroyed<PlatformStrategiesGtk>;
};

#endif // PlatformStrategiesGtk_h
@@ -35,10 +35,11 @@
#include "webkitglobalsprivate.h"
#include "webkitversion.h"
#include "webkitwebsettingsprivate.h"
#include <glib/gi18n-lib.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/gobject/GUniquePtr.h>
#include <wtf/text/CString.h>
#include <wtf/text/StringConcatenate.h>
#include <glib/gi18n-lib.h>

/**
* SECTION:webkitwebsettings
@@ -1586,23 +1587,23 @@ static void initializeOtherGoogleDomains(Vector<String>& otherGoogleDomains)

static bool isGoogleDomain(String host)
{
DEFINE_STATIC_LOCAL(HashSet<String>, googleDomains, ());
DEFINE_STATIC_LOCAL(Vector<String>, otherGoogleDomains, ());
static NeverDestroyed<HashSet<String>> googleDomains;
static NeverDestroyed<Vector<String>> otherGoogleDomains;

if (googleDomains.isEmpty())
initializeDomainsList(googleDomains);
if (googleDomains.get().isEmpty())
initializeDomainsList(googleDomains.get());

if (otherGoogleDomains.isEmpty())
initializeOtherGoogleDomains(otherGoogleDomains);
if (otherGoogleDomains.get().isEmpty())
initializeOtherGoogleDomains(otherGoogleDomains.get());

// First check if this is one of the various google.com international domains.
int position = host.find(".google.");
if (position > 0 && googleDomains.contains(host.substring(position + sizeof(".google.") - 1)))
if (position > 0 && googleDomains.get().contains(host.substring(position + sizeof(".google.") - 1)))
return true;

// Then we check the possibility of it being one of the other, .com-only google domains.
for (unsigned int i = 0; i < otherGoogleDomains.size(); i++) {
if (host.endsWith(otherGoogleDomains.at(i)))
for (unsigned i = 0; i < otherGoogleDomains.get().size(); i++) {
if (host.endsWith(otherGoogleDomains.get().at(i)))
return true;
}

@@ -1,3 +1,22 @@
2014-02-05 Zan Dobersek <zdobersek@igalia.com>

[GTK] Replace DEFINE_STATIC_LOCAL with NeverDestroyed<T> in GTK WK1 and WK2 code
https://bugs.webkit.org/show_bug.cgi?id=128195

Reviewed by Martin Robinson.

Use static NeverDestroyed<T> variables instead of the DEFINE_STATIC_LOCAL macro.

* UIProcess/API/gtk/WebKitBackForwardListItem.cpp:
(historyItemsMap):
* UIProcess/API/gtk/WebKitWebContext.cpp:
(downloadsMap):
* UIProcess/gtk/WebPageProxyGtk.cpp:
(WebKit::pluginWindowMap):
* WebProcess/gtk/WebGtkExtensionManager.cpp:
(WebKit::WebGtkExtensionManager::shared):
* WebProcess/gtk/WebGtkExtensionManager.h:

2014-02-04 Andreas Kling <akling@apple.com>

Remove <iframe seamless> support.
@@ -23,6 +23,7 @@
#include "WebKitBackForwardListPrivate.h"
#include "WebKitPrivate.h"
#include <wtf/HashMap.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/gobject/GRefPtr.h>
#include <wtf/text/CString.h>

@@ -56,7 +57,7 @@ typedef HashMap<WebBackForwardListItem*, WebKitBackForwardListItem*> HistoryItem

static HistoryItemsMap& historyItemsMap()
{
DEFINE_STATIC_LOCAL(HistoryItemsMap, itemsMap, ());
static NeverDestroyed<HistoryItemsMap> itemsMap;
return itemsMap;
}

@@ -47,6 +47,7 @@
#include <WebCore/IconDatabase.h>
#include <WebCore/Language.h>
#include <wtf/HashMap.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
@@ -357,7 +358,7 @@ typedef HashMap<DownloadProxy*, GRefPtr<WebKitDownload> > DownloadsMap;

static DownloadsMap& downloadsMap()
{
DEFINE_STATIC_LOCAL(DownloadsMap, downloads, ());
static NeverDestroyed<DownloadsMap> downloads;
return downloads;
}

@@ -35,6 +35,7 @@
#include "WebProcessProxy.h"
#include <WebCore/UserAgentGtk.h>
#include <gtk/gtkx.h>
#include <wtf/NeverDestroyed.h>

namespace WebKit {

@@ -79,7 +80,7 @@ void WebPageProxy::loadRecentSearches(const String&, Vector<String>&)
typedef HashMap<uint64_t, GtkWidget* > PluginWindowMap;
static PluginWindowMap& pluginWindowMap()
{
DEFINE_STATIC_LOCAL(PluginWindowMap, map, ());
static NeverDestroyed<PluginWindowMap> map;
return map;
}

@@ -34,7 +34,7 @@ namespace WebKit {

WebGtkExtensionManager& WebGtkExtensionManager::shared()
{
DEFINE_STATIC_LOCAL(WebGtkExtensionManager, extensionManager, ());
static NeverDestroyed<WebGtkExtensionManager> extensionManager;
return extensionManager;
}

@@ -22,6 +22,7 @@

#include "Module.h"
#include "WKBundle.h"
#include <wtf/NeverDestroyed.h>
#include <wtf/Noncopyable.h>
#include <wtf/Vector.h>
#include <wtf/gobject/GRefPtr.h>
@@ -50,6 +51,8 @@ class WebGtkExtensionManager {

Vector<Module*> m_extensionModules;
GRefPtr<WebKitWebExtension> m_extension;

friend class NeverDestroyed<WebGtkExtensionManager>;
};

} // namespace WebKit

0 comments on commit 60a659d

Please sign in to comment.