[webkit-dev] Async IconDatabase and reading icons from disk on startup

Darin Adler darin at apple.com
Sun May 11 19:06:28 PDT 2008


On May 11, 2008, at 7:02 PM, Darin Adler wrote:

> On May 11, 2008, at 6:44 PM, Adam Treat wrote:
>
>> How is it actually read from disk then?  Looking at the code... the  
>> only time it is actually read from disk is in  
>> IconDatabase::readFromDatabase and even then it only reads in icons  
>> that are flagged in m_iconsPendingReading.  And when grepping the  
>> code the only time I see that an icon is inserted into  
>> m_iconsPendingReading is when iconForPageURL is called?
>
> I guess my knowledge of the class is out of date and incomplete.
>
> Studying further, I think that clients also need to call  
> readIconForPageURLFromDisk as well as retainIconForPageURL.
>
> And as you say, this does mean that iconForPageURL is called twice,  
> but strictly speaking that's an implementation detail.

Or you could do as Safari does and call iconForPageURL twice; the  
first time it's "display the icon if we already have it" but the  
second time it's "I heard you have a new icon, lets display the new  
icon we now know about".

It would probably be cleaner if triggering the load of the icon was  
completely separate from actually fetching the icon data.

     -- Darin



More information about the webkit-dev mailing list