Source/WebCore: Make DocumentThreadableLoader a CachedResourceClient.
authorjaphet@chromium.org <japhet@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Oct 2011 16:31:32 +0000 (16:31 +0000)
committerjaphet@chromium.org <japhet@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Oct 2011 16:31:32 +0000 (16:31 +0000)
commit2217d50d8fce12fd7cb04398b7bb2c7b70de835d
tree221fb37bbac578aea4806bcb38f9273f868e1b6a
parentb6eba46ab8fe9f53f0f7fa70429b1447e934d0a0
Source/WebCore: Make DocumentThreadableLoader a CachedResourceClient.
This will allow us to cache ThreadableLoaderClients as
appropriate in a later patch.
https://bugs.webkit.org/show_bug.cgi?id=61225

Reviewed by Antti Koivisto.

No new tests, no functionality change intended.

* WebCore.gypi:
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::notifyFinished): CachedResourceClients don't send separate callbacks
    for didFail() and didFinishLoading(), so we need to differentiate here.
(WebCore::DocumentThreadableLoader::loadRequest): Call CachedResourceLoader::requestRawResource()
    instead of ResourceLoadScheduler::scheduleSubresourceLoad().
* loader/DocumentThreadableLoader.h:
* loader/cache/CachedRawResource.cpp:
(WebCore::CachedRawResource::data): Handle the complexity of some ThreadableLoaderClients setting
    DoNotBufferData in ResoureLoaderOptions. If the DataBufferingPolicy is BufferData, then the
    'data' input parameter will contain all data received so far, and we need to determine the
    incremental data to forward to the clients. If the policy is DoNotBufferData, 'data' is just
    the incremental data.
* loader/cache/CachedRawResource.h:
* loader/cache/CachedResource.cpp:
* loader/cache/CachedResource.h:
(WebCore::CachedResource::preloadResult):
(WebCore::CachedResource::didSendData):
(WebCore::CachedResource::didDownloadData):
(WebCore::CachedResource::setLoadFinishTime):
(WebCore::CachedResource::loadFinishTime):
* loader/cache/CachedResourceClient.h: Add several new callbacks needed by DocumentThreadableLoader.
* loader/cache/CachedResourceRequest.cpp:
(WebCore::CachedResourceRequest::didReceiveResponse): CachedResource::setResponse() can now cancel
    the request, so protect appropriately.
* loader/cache/CachedResourceRequest.h:
* loader/chromium/CachedRawResourceChromium.cpp: Added (plumb didDownloadData() to DocumentThreadableLoader).
* loader/chromium/CachedResourceRequestChromium.cpp: Added (plumb didDownloadData() to DocumentThreadableLoader).
* loader/chromium/DocumentThreadableLoaderChromium.cpp:
* platform/network/BlobResourceHandle.cpp:
(WebCore::BlobResourceHandle::notifyResponse): Protect before setting response, since it might kill us.

LayoutTests: Test update for https://bugs.webkit.org/show_bug.cgi?id=61225.
Due to changes in the implementation of DocumentThreadableLoader (and
therefore XHR), this test will have empty (rather than null) content
if we go over the length limit.

Reviewed by Antti Koivisto.

* http/tests/inspector/network/network-content-replacement-xhr-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@97765 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/inspector/network/network-content-replacement-xhr-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.gypi
Source/WebCore/loader/DocumentThreadableLoader.cpp
Source/WebCore/loader/DocumentThreadableLoader.h
Source/WebCore/loader/cache/CachedRawResource.cpp
Source/WebCore/loader/cache/CachedRawResource.h
Source/WebCore/loader/cache/CachedResource.cpp
Source/WebCore/loader/cache/CachedResource.h
Source/WebCore/loader/cache/CachedResourceClient.h
Source/WebCore/loader/cache/CachedResourceRequest.cpp
Source/WebCore/loader/cache/CachedResourceRequest.h
Source/WebCore/loader/chromium/CachedRawResourceChromium.cpp [new file with mode: 0644]
Source/WebCore/loader/chromium/CachedResourceRequestChromium.cpp [new file with mode: 0644]
Source/WebCore/loader/chromium/DocumentThreadableLoaderChromium.cpp
Source/WebCore/loader/icon/IconLoader.h
Source/WebCore/platform/network/BlobResourceHandle.cpp