Necko/Cache/Plans/Draft Proposal: Difference between revisions

Jump to navigation Jump to search
no edit summary
(Created page with "Before you start reading, fixing this requirement depends more on the implementation then on the API, keep this in mind when reading please. Few implementation points, to def...")
 
No edit summary
Line 20: Line 20:


* Get a storage to look in memory and then disk cache / store in both ; when aLookupAppCacheFirst == true then appcache is first looked up to satisfy opening requests - used for top level loads only ; for reference why we need to look appcache up first please see the offline application cache specification, explanation is out of scope of this email
* Get a storage to look in memory and then disk cache / store in both ; when aLookupAppCacheFirst == true then appcache is first looked up to satisfy opening requests - used for top level loads only ; for reference why we need to look appcache up first please see the offline application cache specification, explanation is out of scope of this email
<pre>CacheStorage* mozilla::net::DiskCacheStorage(nsILoadContextInfo* aLoadContextInfo, bool aLookupAppCacheFirst);</pre>
<pre>
CacheStorage* mozilla::net::DiskCacheStorage(nsILoadContextInfo* aLoadContextInfo,
                                            bool aLookupAppCacheFirst);</pre>


* When having appcache object in hands (obtained via AppCacheIndex or onAppCacheEntryAvailable (both described bellow) or by association of sub resource channels with an appcache) create or open entries using that particular appcache ; again, refer to the offline application cache specification for more info
* When having appcache object in hands (obtained via AppCacheIndex or onAppCacheEntryAvailable (both described bellow) or by association of sub resource channels with an appcache) create or open entries using that particular appcache ; again, refer to the offline application cache specification for more info
Line 46: Line 48:
     const uint32_t CACHE_OPEN_TRUNCATE = 1;
     const uint32_t CACHE_OPEN_TRUNCATE = 1;


     void asyncOpenURI(nsIURI* aURI, uint32_t aFlags, nsICacheEntryOpenCallback* aCallback);
     void asyncOpenURI(nsIURI* aURI, uint32_t aFlags,
                      nsICacheEntryOpenCallback* aCallback);
     void asyncDoomURI(nsIURI* aURI, some_kind_of_callback_if_neccessary);
     void asyncDoomURI(nsIURI* aURI, some_kind_of_callback_if_neccessary);
     void asyncEvictAll(some_kind_of_callback_if_neccessary);
     void asyncEvictAll(some_kind_of_callback_if_neccessary);


     // async, iterates information about the storage status and entries, similar to current visitor API, but completely async
     // async, iterates information about the storage status and entries,
    // similar to current visitor API, but completely async
     void asyncGetInfo(nsICacheStorageInfoCallback* aCallback);
     void asyncGetInfo(nsICacheStorageInfoCallback* aCallback);
}
}
Line 61: Line 65:
     // HTTP disk + memory cache lookup result
     // HTTP disk + memory cache lookup result
     // aNew argument:
     // aNew argument:
     //    true - this entry is new and the consumer (channel) is the first one that asked for it, hence it's responsible for data write
     //    true - this entry is new and the consumer (channel) is the first
     //    false - this entry has data or other channel is currently in process of filling the entry with response from a server, we can read it
    // one that asked for it, hence it's responsible for data write
     void onHttpCacheEntryAvailable(nsICacheEntryDescriptor* aEntry, bool aNew, nsresult aRv);
     //    false - this entry has data or other channel is currently  
    // in process of filling the entry with response from a server, we can read it
     void onHttpCacheEntryAvailable(nsICacheEntryDescriptor* aEntry,  
                                  bool aNew, nsresult aRv);


     // appcache lookup result ; entry may not be found, but the URI may be part of a namespace defined by an appcache, hence we must provide appcache object only to work with
     // appcache lookup result ; entry may not be found, but the URI  
     void onAppCacheEntryAvailable(nsICacheEntryDescriptor* aEntry, nsIApplicationCache* aAppCache, nsresult aRv);
    // may be part of a namespace defined by an appcache, hence we must  
    // provide appcache object only to work with
     void onAppCacheEntryAvailable(nsICacheEntryDescriptor* aEntry,
                                  sIApplicationCache* aAppCache, nsresult aRv);
}
}
</pre>
</pre>
185

edits

Navigation menu