[webkit-dev] WebCore's ResourceLoader

Nate Chapin japhet at chromium.org
Mon Apr 23 08:50:20 PDT 2012


You can do a non-cached resource load still, I just haven't figured out
where to document it.  Suggestions welcome :-)

It's possible via CachedRawResource.  When you call
CachedResourceLoader::requestRawResource(), the DataBufferingPolicy in the
ResourceLoaderOptions parameter should be DoNotBufferData.  This will
prevent buffering of the data at both the CachedRawResource and
ResourceLoader levels, and since the CachedRawResource won't have any
useful data, it will also prevent caching.

EventSource use this for its resource loads, albeit indirectly via
DocumentThreadableLoader.

Hope this helps,
~Nate

On Mon, Apr 23, 2012 at 1:05 AM, Boris Brönner <borisbroenner at googlemail.com
> wrote:

> Hi everyone,
>
> I want to use the ResourceLoader (WebCore/loader), but without
> caching. It was possible a while
> ago using SubresourceLoaderClient (removed in revision 100311), but
> now it seems like there are no resources but CachedResources and it is
> not possible to do no caching for certain types of resources. When I
> look at the ImageLoader class (WebCore/loader/ImageLoader.cpp) the
> resource loading is deferred to the document's cachedResourceLoader,
> but the document doesn't seem to have a noncached resource loader.
>
> Is it, if at all, possible to get access to a non-caching resource loader?
>
> Up to now I investigated the following:
> o as far as I see, I can't get access to such a thing.
> o Also it is not really possible to disable caching for a certain type
> of resources. That would be I define my own CachedResource and
> overwrite a method that tells "do not cache me", this is not possible.
> o I could manually remove the resource after loading from the cache by
> using the global memoryCache() accessor. But the CachedResourceLoader
> operates only on bare resource pointers, so simply removing it from
> the cache is not enough, the resource might be stored somewhere else
> (and in fact it is, the loader already stores a map from URLs to
> loaded resources)
> o I could declare my own resource to have the type
> CachedResource::RawResource. In this case the CachedResourceLoader
> doesn't cache it. I don't like this, since the implementation could
> change and decide to cache RawResources and I would have to keep track
> of this.
>
>
> All in all, my conclusion up to now is, I can't really do non-cached
> resource loading without extending WebCore code probably by
> implementing my own ResourceLoader.
>
> Is this right?
>
> Thanks in advance!
>
> Regards,
> bobbel
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20120423/0ee84a5c/attachment.html>


More information about the webkit-dev mailing list