Changeset 25557 in webkit


Ignore:
Timestamp:
Sep 13, 2007 6:46:54 PM (17 years ago)
Author:
beidson
Message:

Reviewed by Maciej

<rdar://problem/5480437> - No site icon at launch and related error messages

The error message was actually indicative of a larger bug that might've resulted in icons getting
improperly pruned because they were never added to the set of retained page URLs.

To solve the no-icon-at-launch problem, we send the "didReceiveIcon:" delegate call for every page
load that has an icon, whether the icon comes in from network, from disk, or was already in ram

  • loader/FrameLoader.cpp: (WebCore::FrameLoader::startIconLoader): Always send the didReceiveIcon delegate call when an icon's image data is known
  • loader/icon/IconDatabase.cpp: (WebCore::IconDatabase::retainIconForPageURL): Much more accurately track the set of retained pages by adding them when their retain count moves from 0 to 1
  • loader/icon/PageURLRecord.h: (WebCore::PageURLRecord::retain): Correctly distinguish the "retain count just went from 0 to 1" case in the return value
Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r25553 r25557  
     12007-09-13  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Maciej
     4
     5        <rdar://problem/5480437> - No site icon at launch and related error messages
     6
     7        The error message was actually indicative of a larger bug that might've resulted in icons getting
     8        improperly pruned because they were never added to the set of retained page URLs.
     9
     10        To solve the no-icon-at-launch problem, we send the "didReceiveIcon:" delegate call for every page
     11        load that has an icon, whether the icon comes in from network, from disk, or was already in ram
     12
     13        * loader/FrameLoader.cpp:
     14        (WebCore::FrameLoader::startIconLoader): Always send the didReceiveIcon delegate call when an icon's
     15          image data is known
     16
     17        * loader/icon/IconDatabase.cpp:
     18        (WebCore::IconDatabase::retainIconForPageURL): Much more accurately track the set of retained pages by
     19          adding them when their retain count moves from 0 to 1
     20
     21        * loader/icon/PageURLRecord.h:
     22        (WebCore::PageURLRecord::retain): Correctly distinguish the "retain count just went from 0 to 1" case
     23          in the return value
     24
    1252007-09-13  Brady Eidson  <beidson@apple.com>
    226
  • trunk/WebCore/loader/FrameLoader.cpp

    r25547 r25557  
    10621062            // If the icon data hasn't been read in from disk yet, kick off the read of the icon from the database to make sure someone
    10631063            // has done it.  This is after registering for the notification so the WebView can call the appropriate delegate method.
    1064             // Otherwise if the icon data *is* available, and this icon load was previously deferred, we need to notifiy the delegate
     1064            // Otherwise if the icon data *is* available, notify the delegate
    10651065            if (!iconDatabase()->iconDataKnownForIconURL(urlString)) {
    10661066                LOG(IconDatabase, "Told not to load icon %s but icon data is not yet available - registering for notification and requesting load from disk", urlString.ascii().data());
     
    10681068                iconDatabase()->iconForPageURL(m_URL.url(), IntSize(0, 0));
    10691069                iconDatabase()->iconForPageURL(originalRequestURL().url(), IntSize(0, 0));
    1070             } else if (m_mayLoadIconLater)
     1070            } else
    10711071                m_client->dispatchDidReceiveIcon();
    10721072               
  • trunk/WebCore/loader/icon/IconDatabase.cpp

    r25553 r25557  
    441441        record = new PageURLRecord(pageURL);
    442442        m_pageURLToRecordMap.set(pageURL, record);
     443    }
     444   
     445    if (!record->retain()) {
     446        if (pageURL.isNull())
     447            pageURL = pageURLOriginal.copy();
     448
     449        // This page just had its retain count bumped from 0 to 1 - Record that fact
    443450        m_retainedPageURLs.add(pageURL);
    444     }
    445    
    446     if (record->retain()) {
     451
    447452        // If we read the iconURLs yet, we want to avoid any pageURL->iconURL lookups and the pageURLsPendingDeletion is moot,
    448453        // so we bail here and skip those steps
     
    453458        // If this pageURL waiting to be sync'ed, update the sync record
    454459        // This saves us in the case where a page was ready to be deleted from the database but was just retained - so theres no need to delete it!
    455         if (!m_privateBrowsingEnabled && m_pageURLsPendingSync.contains(pageURLOriginal)) {
    456             if (pageURL.isNull())
    457                 pageURL = pageURLOriginal.copy();
    458        
     460        if (!m_privateBrowsingEnabled && m_pageURLsPendingSync.contains(pageURL)) {
    459461            LOG(IconDatabase, "Bringing %s back from the brink", pageURL.utf8().data());
    460462            m_pageURLsPendingSync.set(pageURL, record->snapshot());
  • trunk/WebCore/loader/icon/PageURLRecord.h

    r25454 r25557  
    6363    PageURLSnapshot snapshot(bool forDeletion = false) const;
    6464
    65     inline bool retain() { return ++m_retainCount; }
     65    // Returns false if the page wasn't retained beforehand, true if the retain count was already 1 or higher
     66    inline bool retain() { return m_retainCount++; }
    6667
     68    // Returns true if the page is still retained after the call.  False if the retain count just dropped to 0
    6769    inline bool release()
    6870    {
Note: See TracChangeset for help on using the changeset viewer.