Changeset 31355
- Timestamp:
- 03/26/08 20:58:19 (8 months ago)
- Location:
- trunk
- Files:
-
- 10 modified
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/WebCore.base.exp (modified) (1 diff)
-
WebCore/loader/DocumentLoader.cpp (modified) (1 diff)
-
WebCore/loader/DocumentLoader.h (modified) (1 diff)
-
WebCore/loader/archive/ArchiveResource.cpp (modified) (2 diffs)
-
WebCore/loader/archive/ArchiveResource.h (modified) (2 diffs)
-
WebKit/mac/ChangeLog (modified) (1 diff)
-
WebKit/mac/WebView/WebDataSource.mm (modified) (1 diff)
-
WebKit/mac/WebView/WebFrame.mm (modified) (1 diff)
-
WebKit/mac/WebView/WebFrameInternal.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r31354 r31355 1 2008-03-26 Brady Eidson <beidson@apple.com> 2 3 Reviewed by Mark Rowe 4 5 Part of the continued push to move WebArchive-related code down to WebCore, this 6 moves [WebDataSource subresourceForURL:] down to DocumentLoader->subresource() 7 8 * WebCore.base.exp: 9 * loader/DocumentLoader.cpp: 10 (WebCore::DocumentLoader::subresource): Create an ArchiveResource from a CachedResource if it exists 11 Otherwise, fallback to an ArchiveResource from the current Archive if any. Otherwise, return null 12 * loader/DocumentLoader.h: 13 14 * loader/archive/ArchiveResource.cpp: 15 (WebCore::ArchiveResource::create): 16 (WebCore::ArchiveResource::ArchiveResource): 17 * loader/archive/ArchiveResource.h: 18 1 19 2008-03-26 Sam Weinig <sam@webkit.org> 2 20 -
trunk/WebCore/WebCore.base.exp
r31316 r31355 266 266 __ZN7WebCore13toDeviceSpaceERKNS_9FloatRectEP8NSWindow 267 267 __ZN7WebCore14CachedResource5derefEPNS_20CachedResourceClientE 268 __ZN7WebCore14DocumentLoader11subresourceERKNS_4KURLE 268 269 __ZN7WebCore14DocumentLoader13attachToFrameEv 269 270 __ZN7WebCore14DocumentLoader15detachFromFrameEv -
trunk/WebCore/loader/DocumentLoader.cpp
r31293 r31355 466 466 } 467 467 468 PassRefPtr<ArchiveResource> DocumentLoader::subresource(const KURL& url) 469 { 470 if (!isCommitted()) 471 return 0; 472 473 Document* doc = m_frame->document(); 474 if (!doc) 475 return archiveResourceForURL(url); 476 477 CachedResource* resource = doc->docLoader()->cachedResource(url); 478 if (!resource) 479 return archiveResourceForURL(url); 480 481 return ArchiveResource::create(resource->data(), url, resource->response()); 482 } 483 468 484 ArchiveResource* DocumentLoader::archiveResourceForURL(const KURL& url) 469 485 { -
trunk/WebCore/loader/DocumentLoader.h
r31293 r31355 123 123 void addAllArchiveResources(Archive*); 124 124 void addArchiveResource(PassRefPtr<ArchiveResource>); 125 126 // Return an ArchiveResource for the URL, either creating from live data or 127 // pulling from the ArchiveResourceCollection 128 PassRefPtr<ArchiveResource> subresource(const KURL&); 129 // Return the ArchiveResource for the URL only when loading an Archive 125 130 ArchiveResource* archiveResourceForURL(const KURL&); 131 126 132 PassRefPtr<Archive> popArchiveForSubframe(const String& frameName); 127 133 void clearArchiveResources(); -
trunk/WebCore/loader/archive/ArchiveResource.cpp
r31281 r31355 34 34 namespace WebCore { 35 35 36 PassRefPtr<ArchiveResource> ArchiveResource::create(PassRefPtr<SharedBuffer> data, const KURL& url, const ResourceResponse& response) 37 { 38 return adoptRef(new ArchiveResource(data, url, response)); 39 } 40 36 41 PassRefPtr<ArchiveResource> ArchiveResource::create(PassRefPtr<SharedBuffer> data, const KURL& url, const String& mimeType, const String& textEncoding, const String& frameName) 37 42 { … … 42 47 { 43 48 return adoptRef(new ArchiveResource(data, url, mimeType, textEncoding, frameName, resourceResponse)); 49 } 50 51 ArchiveResource::ArchiveResource(PassRefPtr<SharedBuffer> data, const KURL& url, const ResourceResponse& response) 52 : m_data(data) 53 , m_url(url) 54 , m_mimeType(response.mimeType()) 55 , m_textEncoding(response.textEncodingName()) 56 , m_response(response) 57 { 44 58 } 45 59 -
trunk/WebCore/loader/archive/ArchiveResource.h
r31281 r31355 41 41 class ArchiveResource : public RefCounted<ArchiveResource> { 42 42 public: 43 static PassRefPtr<ArchiveResource> create(PassRefPtr<SharedBuffer>, const KURL&, const ResourceResponse&); 43 44 static PassRefPtr<ArchiveResource> create(PassRefPtr<SharedBuffer>, const KURL&, const String& mimeType, const String& textEncoding, const String& frameName); 44 45 static PassRefPtr<ArchiveResource> create(PassRefPtr<SharedBuffer>, const KURL&, const String& mimeType, const String& textEncoding, const String& frameName, const ResourceResponse&); … … 56 57 57 58 private: 59 ArchiveResource(PassRefPtr<SharedBuffer>, const KURL&, const ResourceResponse&); 58 60 ArchiveResource(PassRefPtr<SharedBuffer>, const KURL&, const String& mimeType, const String& textEncoding, const String& frameName); 59 61 ArchiveResource(PassRefPtr<SharedBuffer>, const KURL&, const String& mimeType, const String& textEncoding, const String& frameName, const ResourceResponse&); -
trunk/WebKit/mac/ChangeLog
r31353 r31355 1 2008-03-26 Brady Eidson <beidson@apple.com> 2 3 Reviewed by Mark Rowe 4 5 Part of the continued push to move WebArchive-related code down to WebCore, this 6 moves [WebDataSource subresourceForURL:] down to DocumentLoader->subresource() 7 8 * WebView/WebDataSource.mm: 9 (-[WebDataSource subresourceForURL:]): Call through to the DocumentLoader 10 11 * WebView/WebFrame.mm: Remove [WebFrame _getData:andResponse:forURL:], as its only use 12 has now been ported down to WebCore 13 * WebView/WebFrameInternal.h: 14 1 15 2008-03-26 Mark Rowe <mrowe@apple.com> 2 16 -
trunk/WebKit/mac/WebView/WebDataSource.mm
r31281 r31355 483 483 - (WebResource *)subresourceForURL:(NSURL *)URL 484 484 { 485 if (!_private->loader->isCommitted()) 486 return nil; 487 488 NSData *data; 489 NSURLResponse *response; 490 if (![[self webFrame] _getData:&data andResponse:&response forURL:[URL _web_originalDataAsString]]) { 491 DocumentLoader* loader = [self _documentLoader]; 492 ArchiveResource* coreResource = loader->archiveResourceForURL(URL); 493 return coreResource ? [[[WebResource alloc] _initWithCoreResource:coreResource] autorelease] : nil; 494 } 495 496 return [[[WebResource alloc] _initWithData:data URL:URL response:response] autorelease]; 485 RefPtr<ArchiveResource> subresource = _private->loader->subresource(URL); 486 487 return subresource ? [[[WebResource alloc] _initWithCoreResource:subresource.get()] autorelease] : nil; 497 488 } 498 489 -
trunk/WebKit/mac/WebView/WebFrame.mm
r31281 r31355 971 971 } 972 972 973 - (BOOL)_getData:(NSData **)data andResponse:(NSURLResponse **)response forURL:(NSString *)url974 {975 Document* doc = _private->coreFrame->document();976 if (!doc)977 return NO;978 979 CachedResource* resource = doc->docLoader()->cachedResource(url);980 if (!resource)981 return NO;982 983 SharedBuffer* buffer = resource->data();984 if (buffer)985 *data = [buffer->createNSData() autorelease];986 else987 *data = nil;988 989 *response = resource->response().nsURLResponse();990 return YES;991 }992 993 973 - (void)_getAllResourceDatas:(NSArray **)datas andResponses:(NSArray **)responses 994 974 { -
trunk/WebKit/mac/WebView/WebFrameInternal.h
r31281 r31355 182 182 - (void)_dragSourceEndedAt:(NSPoint)windowLoc operation:(NSDragOperation)operation; 183 183 184 - (BOOL)_getData:(NSData **)data andResponse:(NSURLResponse **)response forURL:(NSString *)URL;185 184 - (void)_getAllResourceDatas:(NSArray **)datas andResponses:(NSArray **)responses; 186 185