Changeset 163433 in webkit


Ignore:
Timestamp:
Feb 5, 2014 1:46:25 AM (10 years ago)
Author:
zandobersek@gmail.com
Message:

[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.

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:
Location:
trunk/Source
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/gtk/ChangeLog

    r163427 r163433  
     12014-02-05  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        [GTK] Replace DEFINE_STATIC_LOCAL with NeverDestroyed<T> in GTK WK1 and WK2 code
     4        https://bugs.webkit.org/show_bug.cgi?id=128195
     5
     6        Reviewed by Martin Robinson.
     7
     8        Use static NeverDestroyed<T> variables instead of the DEFINE_STATIC_LOCAL macro.
     9
     10        * WebCoreSupport/PlatformStrategiesGtk.cpp:
     11        (PlatformStrategiesGtk::initialize):
     12        * WebCoreSupport/PlatformStrategiesGtk.h:
     13        * webkit/webkitwebsettings.cpp:
     14        (isGoogleDomain):
     15
    1162014-02-04  Andreas Kling  <akling@apple.com>
    217
  • trunk/Source/WebKit/gtk/WebCoreSupport/PlatformStrategiesGtk.cpp

    r156550 r163433  
    3131void PlatformStrategiesGtk::initialize()
    3232{
    33     DEFINE_STATIC_LOCAL(PlatformStrategiesGtk, platformStrategies, ());
    34     setPlatformStrategies(&platformStrategies);
     33    static NeverDestroyed<PlatformStrategiesGtk> platformStrategies;
     34    setPlatformStrategies(&platformStrategies.get());
    3535}
    3636
  • trunk/Source/WebKit/gtk/WebCoreSupport/PlatformStrategiesGtk.h

    r156550 r163433  
    2929#include "StorageStrategy.h"
    3030#include "VisitedLinkStrategy.h"
     31#include <wtf/NeverDestroyed.h>
    3132
    3233class 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 {
     
    6566    virtual bool isLinkVisited(WebCore::Page*, WebCore::LinkHash, const WebCore::URL& baseURL, const WTF::AtomicString& attributeURL);
    6667    virtual void addVisitedLink(WebCore::Page*, WebCore::LinkHash);
     68
     69    friend class NeverDestroyed<PlatformStrategiesGtk>;
    6770};
    6871
  • trunk/Source/WebKit/gtk/webkit/webkitwebsettings.cpp

    r162644 r163433  
    3636#include "webkitversion.h"
    3737#include "webkitwebsettingsprivate.h"
     38#include <glib/gi18n-lib.h>
     39#include <wtf/NeverDestroyed.h>
    3840#include <wtf/gobject/GUniquePtr.h>
    3941#include <wtf/text/CString.h>
    4042#include <wtf/text/StringConcatenate.h>
    41 #include <glib/gi18n-lib.h>
    4243
    4344/**
     
    15871588static bool isGoogleDomain(String host)
    15881589{
    1589     DEFINE_STATIC_LOCAL(HashSet<String>, googleDomains, ());
    1590     DEFINE_STATIC_LOCAL(Vector<String>, otherGoogleDomains, ());
    1591 
    1592     if (googleDomains.isEmpty())
    1593         initializeDomainsList(googleDomains);
    1594 
    1595     if (otherGoogleDomains.isEmpty())
    1596         initializeOtherGoogleDomains(otherGoogleDomains);
     1590    static NeverDestroyed<HashSet<String>> googleDomains;
     1591    static NeverDestroyed<Vector<String>> otherGoogleDomains;
     1592
     1593    if (googleDomains.get().isEmpty())
     1594        initializeDomainsList(googleDomains.get());
     1595
     1596    if (otherGoogleDomains.get().isEmpty())
     1597        initializeOtherGoogleDomains(otherGoogleDomains.get());
    15971598
    15981599    // First check if this is one of the various google.com international domains.
    15991600    int position = host.find(".google.");
    1600     if (position > 0 && googleDomains.contains(host.substring(position + sizeof(".google.") - 1)))
     1601    if (position > 0 && googleDomains.get().contains(host.substring(position + sizeof(".google.") - 1)))
    16011602        return true;
    16021603
    16031604    // Then we check the possibility of it being one of the other, .com-only google domains.
    1604     for (unsigned int i = 0; i < otherGoogleDomains.size(); i++) {
    1605         if (host.endsWith(otherGoogleDomains.at(i)))
     1605    for (unsigned i = 0; i < otherGoogleDomains.get().size(); i++) {
     1606        if (host.endsWith(otherGoogleDomains.get().at(i)))
    16061607            return true;
    16071608    }
  • trunk/Source/WebKit2/ChangeLog

    r163427 r163433  
     12014-02-05  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        [GTK] Replace DEFINE_STATIC_LOCAL with NeverDestroyed<T> in GTK WK1 and WK2 code
     4        https://bugs.webkit.org/show_bug.cgi?id=128195
     5
     6        Reviewed by Martin Robinson.
     7
     8        Use static NeverDestroyed<T> variables instead of the DEFINE_STATIC_LOCAL macro.
     9
     10        * UIProcess/API/gtk/WebKitBackForwardListItem.cpp:
     11        (historyItemsMap):
     12        * UIProcess/API/gtk/WebKitWebContext.cpp:
     13        (downloadsMap):
     14        * UIProcess/gtk/WebPageProxyGtk.cpp:
     15        (WebKit::pluginWindowMap):
     16        * WebProcess/gtk/WebGtkExtensionManager.cpp:
     17        (WebKit::WebGtkExtensionManager::shared):
     18        * WebProcess/gtk/WebGtkExtensionManager.h:
     19
    1202014-02-04  Andreas Kling  <akling@apple.com>
    221
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardListItem.cpp

    r137469 r163433  
    2424#include "WebKitPrivate.h"
    2525#include <wtf/HashMap.h>
     26#include <wtf/NeverDestroyed.h>
    2627#include <wtf/gobject/GRefPtr.h>
    2728#include <wtf/text/CString.h>
     
    5758static HistoryItemsMap& historyItemsMap()
    5859{
    59     DEFINE_STATIC_LOCAL(HistoryItemsMap, itemsMap, ());
     60    static NeverDestroyed<HistoryItemsMap> itemsMap;
    6061    return itemsMap;
    6162}
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp

    r162928 r163433  
    4848#include <WebCore/Language.h>
    4949#include <wtf/HashMap.h>
     50#include <wtf/NeverDestroyed.h>
    5051#include <wtf/OwnPtr.h>
    5152#include <wtf/PassRefPtr.h>
     
    358359static DownloadsMap& downloadsMap()
    359360{
    360     DEFINE_STATIC_LOCAL(DownloadsMap, downloads, ());
     361    static NeverDestroyed<DownloadsMap> downloads;
    361362    return downloads;
    362363}
  • trunk/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp

    r159913 r163433  
    3636#include <WebCore/UserAgentGtk.h>
    3737#include <gtk/gtkx.h>
     38#include <wtf/NeverDestroyed.h>
    3839
    3940namespace WebKit {
     
    8081static PluginWindowMap& pluginWindowMap()
    8182{
    82     DEFINE_STATIC_LOCAL(PluginWindowMap, map, ());
     83    static NeverDestroyed<PluginWindowMap> map;
    8384    return map;
    8485}
  • trunk/Source/WebKit2/WebProcess/gtk/WebGtkExtensionManager.cpp

    r162533 r163433  
    3535WebGtkExtensionManager& WebGtkExtensionManager::shared()
    3636{
    37     DEFINE_STATIC_LOCAL(WebGtkExtensionManager, extensionManager, ());
     37    static NeverDestroyed<WebGtkExtensionManager> extensionManager;
    3838    return extensionManager;
    3939}
  • trunk/Source/WebKit2/WebProcess/gtk/WebGtkExtensionManager.h

    r162441 r163433  
    2323#include "Module.h"
    2424#include "WKBundle.h"
     25#include <wtf/NeverDestroyed.h>
    2526#include <wtf/Noncopyable.h>
    2627#include <wtf/Vector.h>
     
    5152    Vector<Module*> m_extensionModules;
    5253    GRefPtr<WebKitWebExtension> m_extension;
     54
     55    friend class NeverDestroyed<WebGtkExtensionManager>;
    5356};
    5457
Note: See TracChangeset for help on using the changeset viewer.