Changeset 120694 in webkit


Ignore:
Timestamp:
Jun 19, 2012 1:55:09 AM (12 years ago)
Author:
sergio@webkit.org
Message:

Calling nativeImageForCurrentFrame() causes assertion failure: m_verifier.isSafeToUse()
https://bugs.webkit.org/show_bug.cgi?id=67582

Reviewed by David Levin.

Source/WebCore:

Added a new synchronous method to the IconDatabase that returns a
native image for the platform instead of a WebCore::Image*.

  • loader/icon/IconDatabase.cpp:

(WebCore::IconDatabase::synchronousNativeIconForPageURL):
(WebCore):

  • loader/icon/IconDatabase.h:

(IconDatabase):

  • loader/icon/IconDatabaseBase.h:

(WebCore::IconDatabaseBase::synchronousNativeIconForPageURL):
(IconDatabaseBase):

Source/WebKit/blackberry:

Use synchronousNativeIconForPageURL() to retrieve favicons.

  • WebCoreSupport/FrameLoaderClientBlackBerry.cpp:

(WebCore::FrameLoaderClientBlackBerry::dispatchDidReceiveIcon):

Source/WebKit/cf:

Fixes windows build.

  • WebCoreSupport/WebInspectorClientCF.cpp:

Source/WebKit/efl:

Use synchronousNativeIconForPageURL() to retrieve favicons.

  • ewk/ewk_history.cpp:

(ewk_history_item_icon_surface_get):
(ewk_history_item_icon_object_add):

  • ewk/ewk_settings.cpp:

(ewk_settings_icon_database_icon_surface_get):
(ewk_settings_icon_database_icon_object_add):

Source/WebKit/gtk:

Use synchronousNativeIconForPageURL() to retrieve favicons.

  • webkit/webkitfavicondatabase.cpp:

(getIconPixbufSynchronously):

Source/WebKit/qt:

Use synchronousNativeIconForPageURL() to retrieve favicons.

  • Api/qwebhistory.cpp:

(QWebHistoryItem::icon):

  • Api/qwebsettings.cpp:

(QWebSettings::iconForUrl):

Location:
trunk/Source
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r120693 r120694  
     12012-06-19  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        Calling nativeImageForCurrentFrame() causes assertion failure: m_verifier.isSafeToUse()
     4        https://bugs.webkit.org/show_bug.cgi?id=67582
     5
     6        Reviewed by David Levin.
     7
     8        Added a new synchronous method to the IconDatabase that returns a
     9        native image for the platform instead of a WebCore::Image*.
     10
     11        * loader/icon/IconDatabase.cpp:
     12        (WebCore::IconDatabase::synchronousNativeIconForPageURL):
     13        (WebCore):
     14        * loader/icon/IconDatabase.h:
     15        (IconDatabase):
     16        * loader/icon/IconDatabaseBase.h:
     17        (WebCore::IconDatabaseBase::synchronousNativeIconForPageURL):
     18        (IconDatabaseBase):
     19
    1202012-06-19  Andy Estes  <aestes@apple.com>
    221
  • trunk/Source/WebCore/loader/icon/IconDatabase.cpp

    r120364 r120694  
    3535#include "IconDatabaseClient.h"
    3636#include "IconRecord.h"
     37#include "Image.h"
    3738#include "IntSize.h"
    3839#include "Logging.h"
     
    291292    // delete the image on the secondary thread if the image already exists.
    292293    return iconRecord->image(size);
     294}
     295
     296NativeImagePtr IconDatabase::synchronousNativeIconForPageURL(const String& pageURLOriginal, const IntSize& size)
     297{
     298    Image* icon = synchronousIconForPageURL(pageURLOriginal, size);
     299    if (!icon)
     300        return 0;
     301
     302    MutexLocker locker(m_urlAndIconLock);
     303    return icon->nativeImageForCurrentFrame();
    293304}
    294305
  • trunk/Source/WebCore/loader/icon/IconDatabase.h

    r117744 r120694  
    9898
    9999    virtual Image* synchronousIconForPageURL(const String&, const IntSize&);
     100    virtual NativeImagePtr synchronousNativeIconForPageURL(const String& pageURLOriginal, const IntSize&);
    100101    virtual String synchronousIconURLForPageURL(const String&);
    101102    virtual bool synchronousIconDataKnownForIconURL(const String&);
  • trunk/Source/WebCore/loader/icon/IconDatabaseBase.h

    r95901 r120694  
    2727#define IconDatabaseBase_h
    2828
     29#include "ImageSource.h"
    2930#include "SharedBuffer.h"
    3031
     
    3334#include <wtf/PassRefPtr.h>
    3435
    35 namespace WebCore { 
     36namespace WebCore {
    3637
    3738class DocumentLoader;
     
    179180    virtual IconLoadDecision synchronousLoadDecisionForIconURL(const String&, DocumentLoader*) { return IconLoadNo; }
    180181    virtual Image* synchronousIconForPageURL(const String&, const IntSize&) { return 0; }
    181    
     182    virtual NativeImagePtr synchronousNativeIconForPageURL(const String&, const IntSize&) { return 0; }
     183
    182184    // Asynchronous calls we should use to replace the above when supported.
    183185    virtual bool supportsAsynchronousMode() { return false; }
  • trunk/Source/WebKit/blackberry/ChangeLog

    r120622 r120694  
     12012-06-19  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        Calling nativeImageForCurrentFrame() causes assertion failure: m_verifier.isSafeToUse()
     4        https://bugs.webkit.org/show_bug.cgi?id=67582
     5
     6        Reviewed by David Levin.
     7
     8        Use synchronousNativeIconForPageURL() to retrieve favicons.
     9
     10        * WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
     11        (WebCore::FrameLoaderClientBlackBerry::dispatchDidReceiveIcon):
     12
    1132012-06-18  Antonio Gomes  <agomes@rim.com>
    214
  • trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp

    r120399 r120694  
    11501150{
    11511151    String url = m_frame->document()->url().string();
    1152     Image* img = iconDatabase().synchronousIconForPageURL(url, IntSize(10, 10));
    1153     if (!img || !img->data())
    1154         return;
    1155 
    1156     NativeImageSkia* bitmap = img->nativeImageForCurrentFrame();
     1152    NativeImageSkia* bitmap = iconDatabase().synchronousNativeIconForPageURL(url, IntSize(10, 10));
    11571153    if (!bitmap)
    11581154        return;
     1155
    11591156    bitmap->lockPixels();
    11601157    String iconUrl = iconDatabase().synchronousIconURLForPageURL(url);
  • trunk/Source/WebKit/cf/ChangeLog

    r103314 r120694  
     12012-06-19  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        Calling nativeImageForCurrentFrame() causes assertion failure: m_verifier.isSafeToUse()
     4        https://bugs.webkit.org/show_bug.cgi?id=67582
     5
     6        Reviewed by David Levin.
     7
     8        Fixes windows build.
     9
     10        * WebCoreSupport/WebInspectorClientCF.cpp:
     11
    1122011-12-20  Pavel Feldman  <pavel.feldman@gmail.com>
    213
  • trunk/Source/WebKit/cf/WebCoreSupport/WebInspectorClientCF.cpp

    r103314 r120694  
    3232#ifndef WTF_USE_CF
    3333#define WTF_USE_CF 1
     34#endif
     35
     36#include <wtf/Platform.h>
     37
     38#if PLATFORM(WIN) && !OS(WINCE)
     39#ifndef WTF_USE_CG
     40#define WTF_USE_CG 1
     41#endif
    3442#endif
    3543
  • trunk/Source/WebKit/efl/ChangeLog

    r120692 r120694  
     12012-06-19  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        Calling nativeImageForCurrentFrame() causes assertion failure: m_verifier.isSafeToUse()
     4        https://bugs.webkit.org/show_bug.cgi?id=67582
     5
     6        Reviewed by David Levin.
     7
     8        Use synchronousNativeIconForPageURL() to retrieve favicons.
     9
     10        * ewk/ewk_history.cpp:
     11        (ewk_history_item_icon_surface_get):
     12        (ewk_history_item_icon_object_add):
     13        * ewk/ewk_settings.cpp:
     14        (ewk_settings_icon_database_icon_surface_get):
     15        (ewk_settings_icon_database_icon_object_add):
     16
    1172012-06-19  Christophe Dumez  <christophe.dumez@intel.com>
    218
  • trunk/Source/WebKit/efl/ewk/ewk_history.cpp

    r117046 r120694  
    337337    EWK_HISTORY_ITEM_CORE_GET_OR_RETURN(item, core, 0);
    338338
    339     WebCore::Image* icon = WebCore::iconDatabase().synchronousIconForPageURL(core->url(), WebCore::IntSize(16, 16));
     339    WebCore::NativeImagePtr icon = WebCore::iconDatabase().synchronousNativeIconForPageURL(core->url(), WebCore::IntSize(16, 16));
     340    if (!icon)
     341        ERR("icon is NULL.");
     342
     343    return icon ? icon->surface() : 0;
     344}
     345
     346Evas_Object* ewk_history_item_icon_object_add(const Ewk_History_Item* item, Evas* canvas)
     347{
     348    EWK_HISTORY_ITEM_CORE_GET_OR_RETURN(item, core, 0);
     349    EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
     350
     351    WebCore::NativeImagePtr icon = WebCore::iconDatabase().synchronousNativeIconForPageURL(core->url(), WebCore::IntSize(16, 16));
    340352    if (!icon) {
    341353        ERR("icon is NULL.");
     
    343355    }
    344356
    345     WebCore::NativeImageCairo* nativeImage = icon->nativeImageForCurrentFrame();
    346     return nativeImage ? nativeImage->surface() : 0;
    347 }
    348 
    349 Evas_Object* ewk_history_item_icon_object_add(const Ewk_History_Item* item, Evas* canvas)
    350 {
    351     EWK_HISTORY_ITEM_CORE_GET_OR_RETURN(item, core, 0);
    352     EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
    353     WebCore::Image* icon = WebCore::iconDatabase().synchronousIconForPageURL(core->url(), WebCore::IntSize(16, 16));
    354 
    355     if (!icon) {
    356         ERR("icon is NULL.");
    357         return 0;
    358     }
    359 
    360     WebCore::NativeImageCairo* nativeImage = icon->nativeImageForCurrentFrame();
    361     return nativeImage ? ewk_util_image_from_cairo_surface_add(canvas, nativeImage->surface()) : 0;
     357    cairo_surface_t* surface = icon->surface();
     358    return surface ? ewk_util_image_from_cairo_surface_add(canvas, surface) : 0;
    362359}
    363360
  • trunk/Source/WebKit/efl/ewk/ewk_settings.cpp

    r120144 r120694  
    208208
    209209    WebCore::KURL kurl(WebCore::KURL(), WTF::String::fromUTF8(url));
    210     WebCore::Image* icon = WebCore::iconDatabase().synchronousIconForPageURL(kurl.string(), WebCore::IntSize(16, 16));
     210    WebCore::NativeImagePtr icon = WebCore::iconDatabase().synchronousNativeIconForPageURL(kurl.string(), WebCore::IntSize(16, 16));
     211    if (!icon)
     212        ERR("no icon for url %s", url);
     213
     214    return icon ? icon->surface() : 0;
     215}
     216
     217Evas_Object* ewk_settings_icon_database_icon_object_get(const char* url, Evas* canvas)
     218{
     219    EINA_SAFETY_ON_NULL_RETURN_VAL(url, 0);
     220    EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
     221
     222    WebCore::KURL kurl(WebCore::KURL(), WTF::String::fromUTF8(url));
     223    WebCore::NativeImagePtr icon = WebCore::iconDatabase().synchronousNativeIconForPageURL(kurl.string(), WebCore::IntSize(16, 16));
    211224
    212225    if (!icon) {
     
    215228    }
    216229
    217     WebCore::NativeImageCairo* nativeImage = icon->nativeImageForCurrentFrame();
    218     return nativeImage ? nativeImage->surface() : 0;
    219 }
    220 
    221 Evas_Object* ewk_settings_icon_database_icon_object_get(const char* url, Evas* canvas)
    222 {
    223     EINA_SAFETY_ON_NULL_RETURN_VAL(url, 0);
    224     EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
    225 
    226     WebCore::KURL kurl(WebCore::KURL(), WTF::String::fromUTF8(url));
    227     WebCore::Image* icon = WebCore::iconDatabase().synchronousIconForPageURL(kurl.string(), WebCore::IntSize(16, 16));
    228 
    229     if (!icon) {
    230         ERR("no icon for url %s", url);
    231         return 0;
    232     }
    233 
    234     WebCore::NativeImageCairo* nativeImage = icon->nativeImageForCurrentFrame();
    235     return nativeImage ? ewk_util_image_from_cairo_surface_add(canvas, nativeImage->surface()) : 0;
     230    cairo_surface_t* surface = icon->surface();
     231    return surface ? ewk_util_image_from_cairo_surface_add(canvas, surface) : 0;
    236232}
    237233
  • trunk/Source/WebKit/gtk/ChangeLog

    r120588 r120694  
     12012-06-19  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        Calling nativeImageForCurrentFrame() causes assertion failure: m_verifier.isSafeToUse()
     4        https://bugs.webkit.org/show_bug.cgi?id=67582
     5
     6        Reviewed by David Levin.
     7
     8        Use synchronousNativeIconForPageURL() to retrieve favicons.
     9
     10        * webkit/webkitfavicondatabase.cpp:
     11        (getIconPixbufSynchronously):
     12
    1132012-06-18  Mario Sanchez Prada  <msanchez@igalia.com>
    214
  • trunk/Source/WebKit/gtk/webkit/webkitfavicondatabase.cpp

    r111698 r120694  
    2525#include "DatabaseTracker.h"
    2626#include "FileSystem.h"
     27#include "GdkCairoUtilities.h"
    2728#include "IconDatabase.h"
    2829#include "IconDatabaseClient.h"
     
    395396    // The exact size we pass is irrelevant to the iconDatabase code.
    396397    // We must pass something greater than 0x0 to get a pixbuf.
    397     Image* icon = iconDatabase().synchronousIconForPageURL(pageURL, !iconSize.isZero() ? iconSize : IntSize(1, 1));
     398    NativeImagePtr icon = iconDatabase().synchronousNativeIconForPageURL(pageURL, !iconSize.isZero() ? iconSize : IntSize(1, 1));
    398399    if (!icon)
    399400        return 0;
    400401
    401     GRefPtr<GdkPixbuf> pixbuf = adoptGRef(icon->getGdkPixbuf());
     402    GRefPtr<GdkPixbuf> pixbuf = adoptGRef(cairoImageSurfaceToGdkPixbuf(icon->surface()));
    402403    if (!pixbuf)
    403404        return 0;
    404405
    405406    // A size of (0, 0) means the maximum available size.
    406     if (!iconSize.isZero() && (icon->width() != iconSize.width() || icon->height() != iconSize.height()))
     407    int pixbufWidth = gdk_pixbuf_get_width(pixbuf.get());
     408    int pixbufHeight = gdk_pixbuf_get_height(pixbuf.get());
     409    if (!iconSize.isZero() && (pixbufWidth != iconSize.width() || pixbufHeight != iconSize.height()))
    407410        pixbuf = gdk_pixbuf_scale_simple(pixbuf.get(), iconSize.width(), iconSize.height(), GDK_INTERP_BILINEAR);
    408411    return pixbuf.leakRef();
  • trunk/Source/WebKit/qt/Api/qwebhistory.cpp

    r109572 r120694  
    159159{
    160160    if (d->item)
    161         return *WebCore::iconDatabase().synchronousIconForPageURL(d->item->url(), WebCore::IntSize(16, 16))->nativeImageForCurrentFrame();
     161        return *WebCore::iconDatabase().synchronousNativeIconForPageURL(d->item->url(), WebCore::IntSize(16, 16));
    162162
    163163    return QIcon();
  • trunk/Source/WebKit/qt/Api/qwebsettings.cpp

    r119098 r120694  
    716716{
    717717    WebCore::initializeWebCoreQt();
    718     WebCore::Image* image = WebCore::iconDatabase().synchronousIconForPageURL(WebCore::KURL(url).string(),
     718    QPixmap* icon = WebCore::iconDatabase().synchronousNativeIconForPageURL(WebCore::KURL(url).string(),
    719719                                WebCore::IntSize(16, 16));
    720     if (!image)
    721         return QPixmap();
    722 
    723     QPixmap* icon = image->nativeImageForCurrentFrame();
    724720    if (!icon)
    725721        return QPixmap();
  • trunk/Source/WebKit/qt/ChangeLog

    r120594 r120694  
     12012-06-19  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        Calling nativeImageForCurrentFrame() causes assertion failure: m_verifier.isSafeToUse()
     4        https://bugs.webkit.org/show_bug.cgi?id=67582
     5
     6        Reviewed by David Levin.
     7
     8        Use synchronousNativeIconForPageURL() to retrieve favicons.
     9
     10        * Api/qwebhistory.cpp:
     11        (QWebHistoryItem::icon):
     12        * Api/qwebsettings.cpp:
     13        (QWebSettings::iconForUrl):
     14
    1152012-06-18  Andras Becsi  <andras.becsi@nokia.com>
    216
  • trunk/Source/WebKit2/UIProcess/WebIconDatabase.cpp

    r117141 r120694  
    191191}
    192192
     193WebCore::NativeImagePtr WebIconDatabase::nativeImageForPageURL(const String& pageURL, const WebCore::IntSize& iconSize)
     194{
     195    if (!m_webContext || !m_iconDatabaseImpl || !m_iconDatabaseImpl->isOpen() || pageURL.isEmpty())
     196        return 0;
     197
     198    return m_iconDatabaseImpl->synchronousNativeIconForPageURL(pageURL, iconSize);
     199}
     200
    193201bool WebIconDatabase::isOpen()
    194202{
  • trunk/Source/WebKit2/UIProcess/WebIconDatabase.h

    r117141 r120694  
    3232#include "WebIconDatabaseClient.h"
    3333#include <WebCore/IconDatabaseClient.h>
     34#include <WebCore/ImageSource.h>
    3435#include <WebCore/IntSize.h>
    3536#include <wtf/Forward.h>
     
    7980
    8081    WebCore::Image* imageForPageURL(const String&, const WebCore::IntSize& iconSize = WebCore::IntSize(32, 32));
     82    WebCore::NativeImagePtr nativeImageForPageURL(const String&, const WebCore::IntSize& iconSize = WebCore::IntSize(32, 32));
    8183    bool isOpen();
    8284
  • trunk/Source/WebKit2/UIProcess/qt/QtWebIconDatabaseClient.cpp

    r118762 r120694  
    9090
    9191    WebCore::IntSize size(iconSize.width(), iconSize.height());
    92     RefPtr<WebCore::Image> image = m_iconDatabase->imageForPageURL(pageURL, size);
    93     if (!image)
    94         return QImage();
    9592
    96     QPixmap* nativeImage = image->nativeImageForCurrentFrame();
     93    QPixmap* nativeImage = m_iconDatabase->nativeImageForPageURL(pageURL, size);
    9794    if (!nativeImage)
    9895        return QImage();
Note: See TracChangeset for help on using the changeset viewer.