Changeset 145753 in webkit
- Timestamp:
- Mar 13, 2013, 2:36:29 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r145752 r145753 1 2013-03-13 Brady Eidson <beidson@apple.com> 2 3 Small ResourceLoader cleanups. 4 https://bugs.webkit.org/show_bug.cgi?id=112279 5 6 Reviewed by Geoff Garen. 7 8 No new tests (Refactor with no behavior change). 9 10 1 - Add "OVERRIDE" to virtual methods in subclasses of ResourceLoader to catch future mistakes. 11 2 - Replace the "bool allAtOnce" flag with a descriptive enum to make reading code easier. 12 13 * GNUmakefile.list.am: 14 * Target.pri: 15 * WebCore.gypi: 16 * WebCore.vcproj/WebCore.vcproj: 17 * WebCore.xcodeproj/project.pbxproj: 18 19 * loader/DocumentLoader.cpp: 20 (WebCore::DocumentLoader::substituteResourceDeliveryTimerFired): 21 22 * loader/NetscapePlugInStreamLoader.cpp: 23 (WebCore::NetscapePlugInStreamLoader::didReceiveData): 24 * loader/NetscapePlugInStreamLoader.h: 25 26 * loader/ResourceLoader.cpp: 27 (WebCore::ResourceLoader::addData): 28 (WebCore::ResourceLoader::didReceiveData): 29 * loader/ResourceLoader.h: 30 * loader/ResourceLoaderTypes.h: Added. 31 32 * loader/SubresourceLoader.cpp: 33 (WebCore::SubresourceLoader::didReceiveData): 34 * loader/SubresourceLoader.h: 35 1 36 2013-03-13 Nate Chapin <japhet@chromium.org> 2 37 -
trunk/Source/WebCore/GNUmakefile.list.am
r145552 r145753 4086 4086 Source/WebCore/loader/ResourceLoader.h \ 4087 4087 Source/WebCore/loader/ResourceLoaderOptions.h \ 4088 Source/WebCore/loader/ResourceLoaderTypes.h \ 4088 4089 Source/WebCore/loader/ResourceLoadNotifier.cpp \ 4089 4090 Source/WebCore/loader/ResourceLoadNotifier.h \ -
trunk/Source/WebCore/Target.pri
r145510 r145753 2088 2088 loader/ResourceBuffer.h \ 2089 2089 loader/ResourceLoader.h \ 2090 loader/ResourceLoaderTypes.h \ 2090 2091 loader/SubresourceLoader.h \ 2091 2092 loader/SubstituteData.h \ -
trunk/Source/WebCore/WebCore.gypi
r145603 r145753 2094 2094 'loader/ResourceLoader.cpp', 2095 2095 'loader/ResourceLoaderOptions.h', 2096 'loader/ResourceLoaderTypes.h', 2096 2097 'loader/SinkDocument.cpp', 2097 2098 'loader/SinkDocument.h', -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r145637 r145753 28084 28084 </File> 28085 28085 <File 28086 RelativePath="..\loader\ResourceLoaderTypes.h" 28087 > 28088 </File> 28089 <File 28086 28090 RelativePath="..\loader\ResourceLoadNotifier.cpp" 28087 28091 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r145592 r145753 1647 1647 51ABAE1F103C1913008C5260 /* SocketStreamHandleCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51ABAE1D103C1913008C5260 /* SocketStreamHandleCFNet.cpp */; }; 1648 1648 51ABF64D16392E2800132A7A /* LoaderStrategy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51ABF64C16392E2800132A7A /* LoaderStrategy.cpp */; }; 1649 51AF503616F100F60095B2E8 /* ResourceLoaderTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 51AF503516F100F60095B2E8 /* ResourceLoaderTypes.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1649 1650 51B2417B0D931F3F00E83F5C /* LegacyWebArchiveMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51B2417A0D931F3F00E83F5C /* LegacyWebArchiveMac.mm */; }; 1650 1651 51BE37E00DAEE00E001085FC /* StorageArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 51BE37DE0DAEE00E001085FC /* StorageArea.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 9120 9121 51ABAE1D103C1913008C5260 /* SocketStreamHandleCFNet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SocketStreamHandleCFNet.cpp; sourceTree = "<group>"; }; 9121 9122 51ABF64C16392E2800132A7A /* LoaderStrategy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoaderStrategy.cpp; sourceTree = "<group>"; }; 9123 51AF503516F100F60095B2E8 /* ResourceLoaderTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoaderTypes.h; sourceTree = "<group>"; }; 9122 9124 51B2417A0D931F3F00E83F5C /* LegacyWebArchiveMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LegacyWebArchiveMac.mm; sourceTree = "<group>"; }; 9123 9125 51BE37DE0DAEE00E001085FC /* StorageArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageArea.h; sourceTree = "<group>"; }; … … 21523 21525 93E227DE0AF589AD00D48324 /* ResourceLoader.cpp */, 21524 21526 656D37270ADBA5DE00A4554D /* ResourceLoader.h */, 21527 51AF503516F100F60095B2E8 /* ResourceLoaderTypes.h */, 21525 21528 D0A3A7301405A39800FB8ED3 /* ResourceLoaderOptions.h */, 21526 21529 973E325410883B7C005BC493 /* ResourceLoadNotifier.cpp */, … … 24299 24302 854163980AC718680001E01B /* DOMSVGTransformInternal.h in Headers */, 24300 24303 8541636B0AC7180B0001E01B /* DOMSVGTransformList.h in Headers */, 24304 51AF503616F100F60095B2E8 /* ResourceLoaderTypes.h in Headers */, 24301 24305 854163970AC718680001E01B /* DOMSVGTransformListInternal.h in Headers */, 24302 24306 859D62BA0AD888EF00012995 /* DOMSVGTRefElement.h in Headers */, -
trunk/Source/WebCore/loader/DocumentLoader.cpp
r145752 r145753 782 782 return; 783 783 784 loader->didReceiveData(data->data(), data->size(), data->size(), true);784 loader->didReceiveData(data->data(), data->size(), data->size(), DataPayloadWholeResource); 785 785 786 786 // Calling ResourceLoader::didReceiveData can end up cancelling the load, -
trunk/Source/WebCore/loader/NetscapePlugInStreamLoader.cpp
r99104 r145753 94 94 } 95 95 96 void NetscapePlugInStreamLoader::didReceiveData(const char* data, int length, long long encodedDataLength, bool allAtOnce)96 void NetscapePlugInStreamLoader::didReceiveData(const char* data, int length, long long encodedDataLength, DataPayloadType dataPayloadType) 97 97 { 98 98 RefPtr<NetscapePlugInStreamLoader> protect(this); … … 100 100 m_client->didReceiveData(this, data, length); 101 101 102 ResourceLoader::didReceiveData(data, length, encodedDataLength, allAtOnce);102 ResourceLoader::didReceiveData(data, length, encodedDataLength, dataPayloadType); 103 103 } 104 104 -
trunk/Source/WebCore/loader/NetscapePlugInStreamLoader.h
r131492 r145753 57 57 58 58 private: 59 virtual void didReceiveResponse(const ResourceResponse&) ;60 virtual void didReceiveData(const char*, int, long long encodedDataLength, bool allAtOnce);61 virtual void didFinishLoading(double finishTime) ;62 virtual void didFail(const ResourceError&) ;59 virtual void didReceiveResponse(const ResourceResponse&) OVERRIDE; 60 virtual void didReceiveData(const char*, int, long long encodedDataLength, DataPayloadType) OVERRIDE; 61 virtual void didFinishLoading(double finishTime) OVERRIDE; 62 virtual void didFail(const ResourceError&) OVERRIDE; 63 63 64 virtual void releaseResources() ;64 virtual void releaseResources() OVERRIDE; 65 65 66 66 NetscapePlugInStreamLoader(Frame*, NetscapePlugInStreamLoaderClient*); 67 67 68 virtual void willCancel(const ResourceError&) ;69 virtual void didCancel(const ResourceError&) ;68 virtual void willCancel(const ResourceError&) OVERRIDE; 69 virtual void didCancel(const ResourceError&) OVERRIDE; 70 70 71 71 NetscapePlugInStreamLoaderClient* m_client; -
trunk/Source/WebCore/loader/ResourceLoader.cpp
r144770 r145753 201 201 202 202 203 void ResourceLoader::addData(const char* data, int length, bool allAtOnce)203 void ResourceLoader::addData(const char* data, int length, DataPayloadType dataPayloadType) 204 204 { 205 205 if (m_options.dataBufferingPolicy == DoNotBufferData) 206 206 return; 207 207 208 if ( allAtOnce) {208 if (dataPayloadType == DataPayloadWholeResource) { 209 209 m_resourceData = ResourceBuffer::create(data, length); 210 210 return; … … 288 288 } 289 289 290 void ResourceLoader::didReceiveData(const char* data, int length, long long encodedDataLength, bool allAtOnce)290 void ResourceLoader::didReceiveData(const char* data, int length, long long encodedDataLength, DataPayloadType dataPayloadType) 291 291 { 292 292 // The following assertions are not quite valid here, since a subclass … … 300 300 RefPtr<ResourceLoader> protector(this); 301 301 302 addData(data, length, allAtOnce);302 addData(data, length, dataPayloadType); 303 303 // FIXME: If we get a resource with more than 2B bytes, this code won't do the right thing. 304 304 // However, with today's computers and networking speeds, this won't happen in practice. … … 466 466 { 467 467 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiveResourceData(m_frame.get(), identifier(), encodedDataLength); 468 didReceiveData(data, length, encodedDataLength, false);468 didReceiveData(data, length, encodedDataLength, DataPayloadBytes); 469 469 InspectorInstrumentation::didReceiveResourceData(cookie); 470 470 } -
trunk/Source/WebCore/loader/ResourceLoader.h
r144770 r145753 32 32 #include "ResourceHandleClient.h" 33 33 #include "ResourceLoaderOptions.h" 34 #include "ResourceLoaderTypes.h" 34 35 #include "ResourceRequest.h" 35 36 #include "ResourceResponse.h" … … 73 74 const ResourceResponse& response() const; 74 75 75 virtual void addData(const char*, int, bool allAtOnce);76 virtual void addData(const char*, int, DataPayloadType); 76 77 virtual PassRefPtr<ResourceBuffer> resourceData(); 77 78 void clearResourceData(); … … 81 82 virtual void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent); 82 83 virtual void didReceiveResponse(const ResourceResponse&); 83 virtual void didReceiveData(const char*, int, long long encodedDataLength, bool allAtOnce);84 virtual void didReceiveData(const char*, int, long long encodedDataLength, DataPayloadType); 84 85 virtual void didReceiveCachedMetadata(const char*, int) { } 85 86 void willStopBufferingData(const char*, int); -
trunk/Source/WebCore/loader/SubresourceLoader.cpp
r145735 r145753 214 214 } 215 215 216 void SubresourceLoader::didReceiveData(const char* data, int length, long long encodedDataLength, bool allAtOnce)216 void SubresourceLoader::didReceiveData(const char* data, int length, long long encodedDataLength, DataPayloadType dataPayloadType) 217 217 { 218 218 if (m_resource->response().httpStatusCode() >= 400 && !m_resource->shouldIgnoreHTTPStatusCodeErrors()) … … 224 224 // anything including removing the last reference to this object; one example of this is 3266216. 225 225 RefPtr<SubresourceLoader> protect(this); 226 addData(data, length, allAtOnce);226 addData(data, length, dataPayloadType); 227 227 if (!m_loadingMultipartContent) 228 228 sendDataToResource(data, length); -
trunk/Source/WebCore/loader/SubresourceLoader.h
r133233 r145753 56 56 virtual ~SubresourceLoader(); 57 57 58 virtual bool init(const ResourceRequest&) ;58 virtual bool init(const ResourceRequest&) OVERRIDE; 59 59 60 virtual void willSendRequest(ResourceRequest&, const ResourceResponse& redirectResponse) ;61 virtual void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent) ;62 virtual void didReceiveResponse(const ResourceResponse&) ;63 virtual void didReceiveData(const char*, int, long long encodedDataLength, bool allAtOnce);64 virtual void didReceiveCachedMetadata(const char*, int) ;65 virtual void didFinishLoading(double finishTime) ;66 virtual void didFail(const ResourceError&) ;67 virtual void willCancel(const ResourceError&) ;68 virtual void didCancel(const ResourceError&) { }60 virtual void willSendRequest(ResourceRequest&, const ResourceResponse& redirectResponse) OVERRIDE; 61 virtual void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent) OVERRIDE; 62 virtual void didReceiveResponse(const ResourceResponse&) OVERRIDE; 63 virtual void didReceiveData(const char*, int, long long encodedDataLength, DataPayloadType) OVERRIDE; 64 virtual void didReceiveCachedMetadata(const char*, int) OVERRIDE; 65 virtual void didFinishLoading(double finishTime) OVERRIDE; 66 virtual void didFail(const ResourceError&) OVERRIDE; 67 virtual void willCancel(const ResourceError&) OVERRIDE; 68 virtual void didCancel(const ResourceError&) OVERRIDE { } 69 69 70 70 #if USE(NETWORK_CFDATA_ARRAY_CALLBACK) 71 virtual bool supportsDataArray() { return true; }72 virtual void didReceiveDataArray(CFArrayRef) ;71 virtual bool supportsDataArray() OVERRIDE { return true; } 72 virtual void didReceiveDataArray(CFArrayRef) OVERRIDE; 73 73 #endif 74 74 #if PLATFORM(CHROMIUM) 75 virtual void didDownloadData(int) ;75 virtual void didDownloadData(int) OVERRIDE; 76 76 #endif 77 virtual void releaseResources() ;77 virtual void releaseResources() OVERRIDE; 78 78 79 79 bool checkForHTTPStatusCodeError(); -
trunk/Source/WebKit2/ChangeLog
r145745 r145753 1 2013-03-13 Brady Eidson <beidson@apple.com> 2 3 Small ResourceLoader cleanups. 4 https://bugs.webkit.org/show_bug.cgi?id=112279 5 6 Reviewed by Geoff Garen. 7 8 Replace the "bool allAtOnce" flag with a descriptive enum to make reading code easier. 9 10 * NetworkProcess/NetworkResourceLoader.cpp: 11 (WebKit::NetworkResourceLoader::didReceiveData): 12 13 * WebProcess/Network/WebResourceLoader.cpp: 14 (WebKit::WebResourceLoader::didReceiveData): 15 (WebKit::WebResourceLoader::didReceiveResource): 16 * WebProcess/Network/WebResourceLoader.h: 17 * WebProcess/Network/WebResourceLoader.messages.in: Get rid of the "allAtOnce" flag since it was always false. 18 1 19 2013-03-13 Abhishek Arya <inferno@chromium.org> 2 20 -
trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp
r145485 r145753 206 206 207 207 CoreIPC::DataReference dataReference(reinterpret_cast<const uint8_t*>(data), length); 208 sendAbortingOnFailure(Messages::WebResourceLoader::DidReceiveData(dataReference, encodedDataLength , false));208 sendAbortingOnFailure(Messages::WebResourceLoader::DidReceiveData(dataReference, encodedDataLength)); 209 209 } 210 210 -
trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp
r141824 r145753 88 88 } 89 89 90 void WebResourceLoader::didReceiveData(const CoreIPC::DataReference& data, int64_t encodedDataLength , bool allAtOnce)90 void WebResourceLoader::didReceiveData(const CoreIPC::DataReference& data, int64_t encodedDataLength) 91 91 { 92 92 LOG(Network, "(WebProcess) WebResourceLoader::didReceiveData of size %i for '%s'", (int)data.size(), m_coreLoader->url().string().utf8().data()); 93 m_coreLoader->didReceiveData(reinterpret_cast<const char*>(data.data()), data.size(), encodedDataLength, allAtOnce);93 m_coreLoader->didReceiveData(reinterpret_cast<const char*>(data.data()), data.size(), encodedDataLength, DataPayloadBytes); 94 94 } 95 95 … … 118 118 // That will allow us to pass it along to CachedResources and allow them to hang on to the shared memory behind the scenes. 119 119 // FIXME (NetworkProcess): Pass along the correct value for encodedDataLength. 120 m_coreLoader->didReceiveData(reinterpret_cast<const char*>(resource->data()), resource->size(), -1 /* encodedDataLength */ , true);120 m_coreLoader->didReceiveData(reinterpret_cast<const char*>(resource->data()), resource->size(), -1 /* encodedDataLength */ , DataPayloadWholeResource); 121 121 } 122 122 -
trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.h
r141824 r145753 76 76 void willSendRequest(const WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse, WebCore::ResourceRequest& newRequest); 77 77 void didReceiveResponseWithCertificateInfo(const WebCore::ResourceResponse&, const PlatformCertificateInfo&); 78 void didReceiveData(const CoreIPC::DataReference&, int64_t encodedDataLength , bool allAtOnce);78 void didReceiveData(const CoreIPC::DataReference&, int64_t encodedDataLength); 79 79 void didFinishResourceLoad(double finishTime); 80 80 void didFailResourceLoad(const WebCore::ResourceError&); -
trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.messages.in
r140921 r145753 28 28 WillSendRequest(WebCore::ResourceRequest request, WebCore::ResourceResponse redirectResponse) -> (WebCore::ResourceRequest newRequest) 29 29 DidReceiveResponseWithCertificateInfo(WebCore::ResourceResponse response, WebKit::PlatformCertificateInfo certificateInfo) 30 DidReceiveData(CoreIPC::DataReference data, int64_t encodedDataLength , bool allAtOnce)30 DidReceiveData(CoreIPC::DataReference data, int64_t encodedDataLength) 31 31 DidFinishResourceLoad(double finishTime) 32 32 DidFailResourceLoad(WebCore::ResourceError error)
Note:
See TracChangeset
for help on using the changeset viewer.