Changeset 220694 in webkit


Ignore:
Timestamp:
Aug 14, 2017 8:44:02 AM (7 years ago)
Author:
Carlos Garcia Campos
Message:

[GTK][WPE] Avoid emitting WebKitFaviconDatabase::favicon-changed multiple times while setting an icon
https://bugs.webkit.org/show_bug.cgi?id=175531

Reviewed by Michael Catanzaro.

When webkitFaviconDatabaseSetIconForPageURL() is called, both setIconURLForPageURL() and setIconDataForIconURL()
might notify the client, which ends up emitting the WebKitFaviconDatabase::favicon-changed signal and calling
webkitFaviconDatabaseSetIconURLForPageURL(). Both things are already done by
webkitFaviconDatabaseSetIconForPageURL() itself, so we can just ignore the client notification while setting a
new icon.

  • UIProcess/API/glib/WebKitFaviconDatabase.cpp:

(webkitFaviconDatabaseSetIconURLForPageURL): Return early if isSettingIcon is true.
(webkitFaviconDatabaseSetIconForPageURL): Set isSettingIcon to true for the scope.

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r220677 r220694  
     12017-08-14  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK][WPE] Avoid emitting WebKitFaviconDatabase::favicon-changed multiple times while setting an icon
     4        https://bugs.webkit.org/show_bug.cgi?id=175531
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        When webkitFaviconDatabaseSetIconForPageURL() is called, both setIconURLForPageURL() and setIconDataForIconURL()
     9        might notify the client, which ends up emitting the WebKitFaviconDatabase::favicon-changed signal and calling
     10        webkitFaviconDatabaseSetIconURLForPageURL(). Both things are already done by
     11        webkitFaviconDatabaseSetIconForPageURL() itself, so we can just ignore the client notification while setting a
     12        new icon.
     13
     14        * UIProcess/API/glib/WebKitFaviconDatabase.cpp:
     15        (webkitFaviconDatabaseSetIconURLForPageURL): Return early if isSettingIcon is true.
     16        (webkitFaviconDatabaseSetIconForPageURL): Set isSettingIcon to true for the scope.
     17
    1182017-08-14  Carlos Garcia Campos  <cgarcia@igalia.com>
    219
  • trunk/Source/WebKit/UIProcess/API/glib/WebKitFaviconDatabase.cpp

    r220580 r220694  
    3030#include <glib/gi18n-lib.h>
    3131#include <wtf/RunLoop.h>
     32#include <wtf/SetForScope.h>
    3233#include <wtf/glib/GRefPtr.h>
    3334#include <wtf/glib/GUniquePtr.h>
     
    7677    HashMap<String, String> pageURLToIconURLMap;
    7778    bool isURLImportCompleted;
     79    bool isSettingIcon;
    7880};
    7981
     
    194196
    195197    priv->pageURLToIconURLMap.set(pageURL, iconURL);
     198    if (priv->isSettingIcon)
     199        return;
     200
    196201    g_signal_emit(database, signals[FAVICON_CHANGED], 0, pageURL.utf8().data(), iconURL.utf8().data());
    197202}
     
    213218    void didChangeIconForPageURL(const String& pageURL) override
    214219    {
     220        if (m_database->priv->isSettingIcon)
     221            return;
    215222        String iconURL = m_database->priv->iconDatabase->synchronousIconURLForPageURL(pageURL);
    216223        webkitFaviconDatabaseSetIconURLForPageURL(m_database, iconURL, pageURL);
     
    306313
    307314    WebKitFaviconDatabasePrivate* priv = database->priv;
     315    SetForScope<bool> change(priv->isSettingIcon, true);
    308316    priv->iconDatabase->setIconURLForPageURL(icon.url.string(), pageURL);
    309317    priv->iconDatabase->setIconDataForIconURL(SharedBuffer::create(iconData.bytes(), iconData.size()), icon.url.string());
Note: See TracChangeset for help on using the changeset viewer.