Commit 7e40ab00 authored by kocienda's avatar kocienda
Browse files

Changed WebKit so that it no longer relies on WebResourceHandle to buffer

	resource data as it is loaded. Instead, this buffering task has been moved
	out to the WebResourceClient, WebMainResourceClient in this case. This
	change is a "proof of concept" for the upcoming change where the API in
	WebFoundation for buffering resource data in WebResourceHandle will be
	removed altogether.

        * WebView.subproj/WebDataSource.m:
        (-[WebDataSource data]): Changed to call WebMainResourceClient when resource data is needed.
        * WebView.subproj/WebMainResourceClient.h: Added mutable data ivar.
        * WebView.subproj/WebMainResourceClient.m:
        (-[WebMainResourceClient initWithDataSource:]): Added mutable data ivar.
        (-[WebMainResourceClient dealloc]): Release new mutable data ivar.
        (-[WebMainResourceClient resourceData]): Added accessor method.
        (-[WebMainResourceClient handleDidReceiveData:data:]): Append received data to the new mutable data object.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1957 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent bbe89dd8
2002-09-04 Ken Kocienda <kocienda@apple.com>
Changed WebKit so that it no longer relies on WebResourceHandle to buffer
resource data as it is loaded. Instead, this buffering task has been moved
out to the WebResourceClient, WebMainResourceClient in this case. This
change is a "proof of concept" for the upcoming change where the API in
WebFoundation for buffering resource data in WebResourceHandle will be
removed altogether.
* WebView.subproj/WebDataSource.m:
(-[WebDataSource data]): Changed to call WebMainResourceClient when resource data is needed.
* WebView.subproj/WebMainResourceClient.h: Added mutable data ivar.
* WebView.subproj/WebMainResourceClient.m:
(-[WebMainResourceClient initWithDataSource:]): Added mutable data ivar.
(-[WebMainResourceClient dealloc]): Release new mutable data ivar.
(-[WebMainResourceClient resourceData]): Added accessor method.
(-[WebMainResourceClient handleDidReceiveData:data:]): Append received data to the new mutable data object.
2002-09-03 John Sullivan <sullivan@apple.com>
* Resources/url_icon.tiff: New image (still a placeholder)
......
2002-09-04 Ken Kocienda <kocienda@apple.com>
Changed WebKit so that it no longer relies on WebResourceHandle to buffer
resource data as it is loaded. Instead, this buffering task has been moved
out to the WebResourceClient, WebMainResourceClient in this case. This
change is a "proof of concept" for the upcoming change where the API in
WebFoundation for buffering resource data in WebResourceHandle will be
removed altogether.
* WebView.subproj/WebDataSource.m:
(-[WebDataSource data]): Changed to call WebMainResourceClient when resource data is needed.
* WebView.subproj/WebMainResourceClient.h: Added mutable data ivar.
* WebView.subproj/WebMainResourceClient.m:
(-[WebMainResourceClient initWithDataSource:]): Added mutable data ivar.
(-[WebMainResourceClient dealloc]): Release new mutable data ivar.
(-[WebMainResourceClient resourceData]): Added accessor method.
(-[WebMainResourceClient handleDidReceiveData:data:]): Append received data to the new mutable data object.
2002-09-03 John Sullivan <sullivan@apple.com>
* Resources/url_icon.tiff: New image (still a placeholder)
......
......@@ -71,7 +71,7 @@ -(unsigned)flags;
- (NSData *)data
{
if(!_private->resourceData){
return [_private->mainHandle resourceData];
return [_private->mainHandleClient resourceData];
}else{
return _private->resourceData;
}
......
......@@ -23,7 +23,9 @@
WebDownloadHandler *downloadHandler;
id <WebResourceProgressHandler> downloadProgressHandler;
WebContentAction policyAction;
NSMutableData *resourceData;
}
- initWithDataSource:(WebDataSource *)dataSource;
- (WebDownloadHandler *)downloadHandler;
- (NSData *)resourceData;
@end
......@@ -32,6 +32,7 @@ @implementation WebMainResourceClient
if (self) {
dataSource = [ds retain];
resourceData = [[NSMutableData alloc] init];
isFirstChunk = YES;
}
......@@ -59,11 +60,17 @@ - (void)dealloc
WEBKIT_ASSERT(downloadHandler == nil);
[downloadProgressHandler release];
[resourceData release];
[dataSource release];
[super dealloc];
}
- (NSData *)resourceData
{
return resourceData;
}
- (WebDownloadHandler *)downloadHandler
{
return downloadHandler;
......@@ -203,6 +210,8 @@ - (void)handleDidReceiveData:(WebResourceHandle *)handle data:(NSData *)data
WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "main content type: %s", DEBUG_OBJECT(contentType));
}
[resourceData appendData:data];
switch (policyAction) {
case WebContentPolicyShow:
[dataSource _receivedData:data];
......
......@@ -23,7 +23,9 @@
WebDownloadHandler *downloadHandler;
id <WebResourceProgressHandler> downloadProgressHandler;
WebContentAction policyAction;
NSMutableData *resourceData;
}
- initWithDataSource:(WebDataSource *)dataSource;
- (WebDownloadHandler *)downloadHandler;
- (NSData *)resourceData;
@end
......@@ -32,6 +32,7 @@ @implementation WebMainResourceClient
if (self) {
dataSource = [ds retain];
resourceData = [[NSMutableData alloc] init];
isFirstChunk = YES;
}
......@@ -59,11 +60,17 @@ - (void)dealloc
WEBKIT_ASSERT(downloadHandler == nil);
[downloadProgressHandler release];
[resourceData release];
[dataSource release];
[super dealloc];
}
- (NSData *)resourceData
{
return resourceData;
}
- (WebDownloadHandler *)downloadHandler
{
return downloadHandler;
......@@ -203,6 +210,8 @@ - (void)handleDidReceiveData:(WebResourceHandle *)handle data:(NSData *)data
WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "main content type: %s", DEBUG_OBJECT(contentType));
}
[resourceData appendData:data];
switch (policyAction) {
case WebContentPolicyShow:
[dataSource _receivedData:data];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment