[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
cblu
cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:23:55 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 987f4d30ea6850acee1d6f6e752c160e32a8f5d1
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Feb 7 00:08:13 2003 +0000
Renamed WebDownloadHandler to WebDownload.
Made ivars of WebDownload private.
Reviewed by kocienda.
* Downloads.subproj/WebDownload.h: Added.
* Downloads.subproj/WebDownload.m: Added.
(-[WebDownloadPrivate init]):
(-[WebDownloadPrivate dealloc]):
(-[WebDownload initWithDataSource:]):
(-[WebDownload dealloc]):
(-[WebDownload decodeHeaderData:dataForkData:resourceForkData:]):
(-[WebDownload decodeData:dataForkData:resourceForkData:]):
(-[WebDownload closeFork:deleteFile:]):
(-[WebDownload closeFileAndDelete:]):
(-[WebDownload closeFile]):
(-[WebDownload cleanUpAfterFailure]):
(-[WebDownload createFileIfNecessary]):
(-[WebDownload writeDataForkData:resourceForkData:]):
(-[WebDownload dataIfDoneBufferingData:]):
(-[WebDownload decodeData:]):
(-[WebDownload receivedData:]):
(-[WebDownload finishDecoding]):
(-[WebDownload finishedLoading]):
(-[WebDownload cancel]):
(-[WebDownload path]):
(-[WebDownload writeForkData:isDataFork:]):
(-[WebDownload errorWithCode:]):
(-[WebDownload cancelWithError:]):
(-[WebDownload dataForkReferenceNumber]):
(-[WebDownload setDataForkReferenceNumber:]):
(-[WebDownload resourceForkReferenceNumber]):
(-[WebDownload setResourceForkReferenceNumber:]):
(-[WebDownload areWritesCancelled]):
(-[WebDownload setWritesCancelled:]):
(WriteCompletionCallback):
(CloseCompletionCallback):
(DeleteCompletionCallback):
* Downloads.subproj/WebDownloadHandler.h: Removed.
* Downloads.subproj/WebDownloadHandler.m: Removed.
* WebKit.pbproj/project.pbxproj:
* WebView.subproj/WebController.h:
* WebView.subproj/WebDataSource.m:
* WebView.subproj/WebDataSourcePrivate.m:
* WebView.subproj/WebMainResourceClient.h:
* WebView.subproj/WebMainResourceClient.m:
(-[WebMainResourceClient dealloc]):
(-[WebMainResourceClient download]):
(-[WebMainResourceClient isDownload]):
(-[WebMainResourceClient receivedError:complete:]):
(-[WebMainResourceClient continueAfterContentPolicy:response:]):
(-[WebMainResourceClient handle:didReceiveData:]):
(-[WebMainResourceClient handleDidFinishLoading:]):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3587 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 33002c2..d0817ce 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,5 +1,61 @@
2003-02-06 Chris Blumenberg <cblu at apple.com>
+ Renamed WebDownloadHandler to WebDownload.
+ Made ivars of WebDownload private.
+
+ Reviewed by kocienda.
+
+ * Downloads.subproj/WebDownload.h: Added.
+ * Downloads.subproj/WebDownload.m: Added.
+ (-[WebDownloadPrivate init]):
+ (-[WebDownloadPrivate dealloc]):
+ (-[WebDownload initWithDataSource:]):
+ (-[WebDownload dealloc]):
+ (-[WebDownload decodeHeaderData:dataForkData:resourceForkData:]):
+ (-[WebDownload decodeData:dataForkData:resourceForkData:]):
+ (-[WebDownload closeFork:deleteFile:]):
+ (-[WebDownload closeFileAndDelete:]):
+ (-[WebDownload closeFile]):
+ (-[WebDownload cleanUpAfterFailure]):
+ (-[WebDownload createFileIfNecessary]):
+ (-[WebDownload writeDataForkData:resourceForkData:]):
+ (-[WebDownload dataIfDoneBufferingData:]):
+ (-[WebDownload decodeData:]):
+ (-[WebDownload receivedData:]):
+ (-[WebDownload finishDecoding]):
+ (-[WebDownload finishedLoading]):
+ (-[WebDownload cancel]):
+ (-[WebDownload path]):
+ (-[WebDownload writeForkData:isDataFork:]):
+ (-[WebDownload errorWithCode:]):
+ (-[WebDownload cancelWithError:]):
+ (-[WebDownload dataForkReferenceNumber]):
+ (-[WebDownload setDataForkReferenceNumber:]):
+ (-[WebDownload resourceForkReferenceNumber]):
+ (-[WebDownload setResourceForkReferenceNumber:]):
+ (-[WebDownload areWritesCancelled]):
+ (-[WebDownload setWritesCancelled:]):
+ (WriteCompletionCallback):
+ (CloseCompletionCallback):
+ (DeleteCompletionCallback):
+ * Downloads.subproj/WebDownloadHandler.h: Removed.
+ * Downloads.subproj/WebDownloadHandler.m: Removed.
+ * WebKit.pbproj/project.pbxproj:
+ * WebView.subproj/WebController.h:
+ * WebView.subproj/WebDataSource.m:
+ * WebView.subproj/WebDataSourcePrivate.m:
+ * WebView.subproj/WebMainResourceClient.h:
+ * WebView.subproj/WebMainResourceClient.m:
+ (-[WebMainResourceClient dealloc]):
+ (-[WebMainResourceClient download]):
+ (-[WebMainResourceClient isDownload]):
+ (-[WebMainResourceClient receivedError:complete:]):
+ (-[WebMainResourceClient continueAfterContentPolicy:response:]):
+ (-[WebMainResourceClient handle:didReceiveData:]):
+ (-[WebMainResourceClient handleDidFinishLoading:]):
+
+2003-02-06 Chris Blumenberg <cblu at apple.com>
+
Fixed: 3125067 - Investigate performance implications of writing download file data
Reviewed by trey, rjw, darin.
diff --git a/WebKit/Downloads.subproj/WebDownload.h b/WebKit/Downloads.subproj/WebDownload.h
index 184da84..25ca7e7 100644
--- a/WebKit/Downloads.subproj/WebDownload.h
+++ b/WebKit/Downloads.subproj/WebDownload.h
@@ -1,41 +1,25 @@
-//
-// WebDownloadHandler.h
-// WebKit
-//
-// Created by Chris Blumenberg on Thu Apr 11 2002.
-// Copyright (c) 2002 Apple computer, Inc. All rights reserved.
-//
+/*
+ WebDownload.h
+ Copyright 2003, Apple, Inc. All rights reserved.
+
+ Public header file.
+*/
#import <Foundation/Foundation.h>
@class WebDataSource;
+ at class WebDownloadPrivate;
@class WebError;
- at class WebResourceResponse;
- at interface WebDownloadHandler : NSObject
+ at interface WebDownload : NSObject
{
- WebDataSource *dataSource;
-
- NSArray *decoderClasses;
- NSMutableArray *decoderSequence;
- NSMutableData *bufferedData;
-
- FSRef fileRef;
- FSRefPtr fileRefPtr;
-
- SInt16 dataForkRefNum;
- SInt16 resourceForkRefNum;
-
- // isCancelled is used to make sure we don't write after cancelling the load.
- BOOL isCancelled;
-
- // areWritesCancelled is only used by WriteCompletionCallback to make
- // sure that only 1 write failure cancels the load.
- BOOL areWritesCancelled;
+ at private
+ WebDownloadPrivate *_private;
}
- initWithDataSource:(WebDataSource *)dSource;
- (WebError *)receivedData:(NSData *)data;
- (WebError *)finishedLoading;
- (void)cancel;
+
@end
diff --git a/WebKit/Downloads.subproj/WebDownload.m b/WebKit/Downloads.subproj/WebDownload.m
index 9f700cd..fc5cb3b 100644
--- a/WebKit/Downloads.subproj/WebDownload.m
+++ b/WebKit/Downloads.subproj/WebDownload.m
@@ -1,12 +1,12 @@
//
-// WebDownloadHandler.m
+// WebDownload.m
// WebKit
//
// Created by Chris Blumenberg on Thu Apr 11 2002.
// Copyright (c) 2002 Apple Computer, Inc.
//
-#import <WebKit/WebDownloadHandler.h>
+#import <WebKit/WebDownloadPrivate.h>
#import <WebKit/WebBinHexDecoder.h>
#import <WebKit/WebDataSourcePrivate.h>
@@ -26,7 +26,7 @@
typedef struct WebFSForkIOParam
{
FSForkIOParam paramBlock;
- WebDownloadHandler *downloadHandler;
+ WebDownload *download;
BOOL deleteFile;
NSData *data;
} WebFSForkIOParam;
@@ -34,41 +34,49 @@ typedef struct WebFSForkIOParam
typedef struct WebFSRefParam
{
FSRefParam paramBlock;
- WebDownloadHandler *downloadHandler;
+ WebDownload *download;
} WebFSRefParam;
+ at interface WebDownloadPrivate : NSObject
+{
+ at public
+ WebDataSource *dataSource;
+
+ NSArray *decoderClasses;
+ NSMutableArray *decoderSequence;
+ NSMutableData *bufferedData;
+
+ FSRef fileRef;
+ FSRefPtr fileRefPtr;
+
+ SInt16 dataForkRefNum;
+ SInt16 resourceForkRefNum;
+
+ // isCancelled is used to make sure we don't write after cancelling the load.
+ BOOL isCancelled;
+
+ // areWritesCancelled is only used by WriteCompletionCallback to make
+ // sure that only 1 write failure cancels the load.
+ BOOL areWritesCancelled;
+}
+ at end
+
static void WriteCompletionCallback(ParmBlkPtr paramBlock);
static void CloseCompletionCallback(ParmBlkPtr paramBlock);
static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
- at interface WebDownloadHandler (WebPrivate)
-- (NSString *)path;
-- (WebError *)errorWithCode:(int)code;
-- (void)cancelWithError:(WebError *)error;
-- (SInt16)dataForkReferenceNumber;
-- (void)setDataForkReferenceNumber:(SInt16)forkRefNum;
-- (SInt16)resourceForkReferenceNumber;
-- (void)setResourceForkReferenceNumber:(SInt16)forkRefNum;
-- (BOOL)writeForkData:(NSData *)data isDataFork:(BOOL)isDataFork;
-- (BOOL)areWritesCancelled;
-- (void)setWritesCancelled:(BOOL)cancelled;
- at end
-
- at implementation WebDownloadHandler
+ at implementation WebDownloadPrivate
-- initWithDataSource:(WebDataSource *)dSource
+- init
{
[super init];
- dataSource = [dSource retain];
-
decoderClasses = [[NSArray arrayWithObjects:
[WebBinHexDecoder class],
[WebMacBinaryDecoder class],
[WebGZipDecoder class],
nil] retain];
-
- LOG(Download, "Download started for: %@", [[dSource request] URL]);
+
return self;
}
@@ -81,6 +89,27 @@ static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
[super dealloc];
}
+ at end
+
+ at implementation WebDownload
+
+- initWithDataSource:(WebDataSource *)dSource
+{
+ [super init];
+
+ _private = [[WebDownloadPrivate alloc] init];
+ _private->dataSource = [dSource retain];
+
+ LOG(Download, "Download started for: %@", [[dSource request] URL]);
+ return self;
+}
+
+- (void)dealloc
+{
+ [_private release];
+ [super dealloc];
+}
+
- (void)decodeHeaderData:(NSData *)headerData
dataForkData:(NSData **)dataForkData
resourceForkData:(NSData **)resourceForkData
@@ -91,8 +120,8 @@ static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
ASSERT(resourceForkData);
unsigned i;
- for (i = 0; i < [decoderClasses count]; i++) {
- Class decoderClass = [decoderClasses objectAtIndex:i];
+ for (i = 0; i < [_private->decoderClasses count]; i++) {
+ Class decoderClass = [_private->decoderClasses objectAtIndex:i];
if ([decoderClass canDecodeHeaderData:headerData]) {
NSObject <WebDownloadDecoder> *decoder = [[[decoderClass alloc] init] autorelease];
@@ -104,7 +133,7 @@ static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
continue;
}
- [decoderSequence addObject:decoder];
+ [_private->decoderSequence addObject:decoder];
[self decodeHeaderData:*dataForkData dataForkData:dataForkData resourceForkData:resourceForkData];
break;
@@ -121,13 +150,13 @@ static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
ASSERT(dataForkData);
ASSERT(resourceForkData);
- if (!decoderSequence) {
- decoderSequence = [[NSMutableArray array] retain];
+ if (!_private->decoderSequence) {
+ _private->decoderSequence = [[NSMutableArray array] retain];
[self decodeHeaderData:data dataForkData:dataForkData resourceForkData:resourceForkData];
} else {
unsigned i;
- for (i = 0; i< [decoderSequence count]; i++) {
- NSObject <WebDownloadDecoder> *decoder = [decoderSequence objectAtIndex:i];
+ for (i = 0; i< [_private->decoderSequence count]; i++) {
+ NSObject <WebDownloadDecoder> *decoder = [_private->decoderSequence objectAtIndex:i];
BOOL didDecode = [decoder decodeData:data dataForkData:dataForkData resourceForkData:resourceForkData];
if (!didDecode) {
@@ -138,7 +167,7 @@ static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
}
}
- if ([decoderSequence count] == 0) {
+ if ([_private->decoderSequence count] == 0) {
*dataForkData = data;
*resourceForkData = nil;
}
@@ -152,8 +181,8 @@ static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
WebFSForkIOParam *block = malloc(sizeof(WebFSForkIOParam));
block->paramBlock.ioCompletion = CloseCompletionCallback;
block->paramBlock.forkRefNum = forkRefNum;
- block->paramBlock.ref = fileRefPtr;
- block->downloadHandler = [self retain];
+ block->paramBlock.ref = _private->fileRefPtr;
+ block->download = [self retain];
block->deleteFile = deleteFile;
PBCloseForkAsync(&block->paramBlock);
}
@@ -161,8 +190,8 @@ static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
- (void)closeFileAndDelete:(BOOL)deleteFile
{
- [self closeFork:dataForkRefNum deleteFile:deleteFile];
- [self closeFork:resourceForkRefNum deleteFile:deleteFile];
+ [self closeFork:_private->dataForkRefNum deleteFile:deleteFile];
+ [self closeFork:_private->resourceForkRefNum deleteFile:deleteFile];
}
- (void)closeFile
@@ -177,13 +206,13 @@ static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
- (WebError *)createFileIfNecessary
{
- if (fileRefPtr) {
+ if (_private->fileRefPtr) {
return nil;
}
NSFileManager *fileManager = [NSFileManager defaultManager];
- NSString *path = [dataSource downloadPath];
- NSObject <WebDownloadDecoder> *lastDecoder = [decoderSequence lastObject];
+ NSString *path = [_private->dataSource downloadPath];
+ NSObject <WebDownloadDecoder> *lastDecoder = [_private->decoderSequence lastObject];
NSString *filename = [[lastDecoder filename] _web_filenameByFixingIllegalCharacters];
@@ -210,13 +239,13 @@ static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
}
}
- [dataSource _setDownloadPath:path];
+ [_private->dataSource _setDownloadPath:path];
NSDictionary *fileAttributes = [lastDecoder fileAttributes];
// FIXME: This assumes that if we get any file attributes, they will include the creation
// and modification date, which is not necessarily true.
if (!fileAttributes) {
- WebResourceResponse *response = [dataSource response];
+ WebResourceResponse *response = [_private->dataSource response];
fileAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
[response createdDate], NSFileCreationDate,
[response lastModifiedDate], NSFileModificationDate, nil];
@@ -229,9 +258,9 @@ static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
[[NSWorkspace sharedWorkspace] _web_noteFileChangedAtPath:path];
- OSErr result = FSPathMakeRef((const UInt8 *)[path fileSystemRepresentation], &fileRef, NULL);
+ OSErr result = FSPathMakeRef((const UInt8 *)[path fileSystemRepresentation], &_private->fileRef, NULL);
if (result == noErr) {
- fileRefPtr = &fileRef;
+ _private->fileRefPtr = &_private->fileRef;
} else {
ERROR("FSPathMakeRef failed.");
[self cleanUpAfterFailure];
@@ -268,21 +297,21 @@ static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
- (NSData *)dataIfDoneBufferingData:(NSData *)data
{
- if (!bufferedData) {
- bufferedData = [data mutableCopy];
- } else if ([bufferedData length] == 0) {
+ if (!_private->bufferedData) {
+ _private->bufferedData = [data mutableCopy];
+ } else if ([_private->bufferedData length] == 0) {
// When bufferedData's length is 0, we're done buffering.
return data;
} else {
// Append new data.
- [bufferedData appendData:data];
+ [_private->bufferedData appendData:data];
}
- if ([bufferedData length] >= WEB_DOWNLOAD_DECODER_MINIMUM_HEADER_LENGTH) {
+ if ([_private->bufferedData length] >= WEB_DOWNLOAD_DECODER_MINIMUM_HEADER_LENGTH) {
// We've have enough now. Make a copy so we can set bufferedData's length to 0,
// so we're know we're done buffering.
- data = [[bufferedData copy] autorelease];
- [bufferedData setLength:0];
+ data = [[_private->bufferedData copy] autorelease];
+ [_private->bufferedData setLength:0];
return data;
} else {
// Keep buffering. The header is not big enough to determine the encoding sequence.
@@ -325,8 +354,8 @@ static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
NSObject <WebDownloadDecoder> *decoder;
unsigned i;
- for (i = 0; i < [decoderSequence count]; i++) {
- decoder = [decoderSequence objectAtIndex:i];
+ for (i = 0; i < [_private->decoderSequence count]; i++) {
+ decoder = [_private->decoderSequence objectAtIndex:i];
if (![decoder finishDecoding]) {
return NO;
}
@@ -337,9 +366,9 @@ static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
- (WebError *)finishedLoading
{
- WebError *error = [self decodeData:bufferedData];
- [bufferedData release];
- bufferedData = nil;
+ WebError *error = [self decodeData:_private->bufferedData];
+ [_private->bufferedData release];
+ _private->bufferedData = nil;
if (error) {
return error;
}
@@ -352,33 +381,32 @@ static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
[self closeFile];
- LOG(Download, "Download complete. Saved to: %@", [dataSource downloadPath]);
+ LOG(Download, "Download complete. Saved to: %@", [_private->dataSource downloadPath]);
return nil;
}
- (void)cancel
{
- isCancelled = YES;
+ _private->isCancelled = YES;
[self cleanUpAfterFailure];
}
@end
-
- at implementation WebDownloadHandler (WebPrivate)
+ at implementation WebDownload (WebPrivate)
- (NSString *)path
{
- return [dataSource downloadPath];
+ return [_private->dataSource downloadPath];
}
- (BOOL)writeForkData:(NSData *)data isDataFork:(BOOL)isDataFork
{
- ASSERT(!isCancelled);
+ ASSERT(!_private->isCancelled);
OSErr result;
- SInt16 *forkRefNum = isDataFork ? &dataForkRefNum : &resourceForkRefNum;
+ SInt16 *forkRefNum = isDataFork ? &_private->dataForkRefNum : &_private->resourceForkRefNum;
if (*forkRefNum == 0) {
HFSUniStr255 forkName;
@@ -393,7 +421,7 @@ static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
return NO;
}
- result = FSOpenFork(fileRefPtr, forkName.length, forkName.unicode, fsWrPerm, forkRefNum);
+ result = FSOpenFork(_private->fileRefPtr, forkName.length, forkName.unicode, fsWrPerm, forkRefNum);
if (result != noErr) {
ERROR("Couldn't open fork of download file.");
return NO;
@@ -407,7 +435,7 @@ static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
block->paramBlock.positionOffset = 0;
block->paramBlock.requestCount = [data length];
block->paramBlock.buffer = (Ptr)[data bytes];
- block->downloadHandler = [self retain];
+ block->download = [self retain];
block->data = [data copy];
PBWriteForkAsync(&block->paramBlock);
@@ -416,42 +444,44 @@ static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
- (WebError *)errorWithCode:(int)code
{
- return [WebError errorWithCode:code inDomain:WebErrorDomainWebKit failingURL:[[dataSource URL] absoluteString]];
+ return [WebError errorWithCode:code
+ inDomain:WebErrorDomainWebKit
+ failingURL:[[_private->dataSource URL] absoluteString]];
}
- (void)cancelWithError:(WebError *)error
{
- [dataSource _stopLoadingWithError:error];
+ [_private->dataSource _stopLoadingWithError:error];
}
- (SInt16)dataForkReferenceNumber
{
- return dataForkRefNum;
+ return _private->dataForkRefNum;
}
- (void)setDataForkReferenceNumber:(SInt16)forkRefNum
{
- dataForkRefNum = forkRefNum;
+ _private->dataForkRefNum = forkRefNum;
}
- (SInt16)resourceForkReferenceNumber
{
- return resourceForkRefNum;
+ return _private->resourceForkRefNum;
}
- (void)setResourceForkReferenceNumber:(SInt16)forkRefNum
{
- resourceForkRefNum = forkRefNum;
+ _private->resourceForkRefNum = forkRefNum;
}
- (BOOL)areWritesCancelled
{
- return areWritesCancelled;
+ return _private->areWritesCancelled;
}
- (void)setWritesCancelled:(BOOL)cancelled
{
- areWritesCancelled = cancelled;
+ _private->areWritesCancelled = cancelled;
}
@end
@@ -460,17 +490,17 @@ static void WriteCompletionCallback(ParmBlkPtr paramBlock)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
WebFSForkIOParam *block = (WebFSForkIOParam *)paramBlock;
- WebDownloadHandler *downloadHandler = block->downloadHandler;
+ WebDownload *download = block->download;
- if (block->paramBlock.ioResult != noErr && ![downloadHandler areWritesCancelled]) {
+ if (block->paramBlock.ioResult != noErr && ![download areWritesCancelled]) {
ERROR("Writing to fork of download file failed with error: %d", block->paramBlock.ioResult);
- [downloadHandler setWritesCancelled:YES];
- [downloadHandler performSelectorOnMainThread:@selector(cancelWithError:)
- withObject:[downloadHandler errorWithCode:WebKitErrorCannotWriteToFile]
+ [download setWritesCancelled:YES];
+ [download performSelectorOnMainThread:@selector(cancelWithError:)
+ withObject:[download errorWithCode:WebKitErrorCannotWriteToFile]
waitUntilDone:NO];
}
- [downloadHandler release];
+ [download release];
[block->data release];
[pool release];
free(block);
@@ -480,35 +510,35 @@ static void CloseCompletionCallback(ParmBlkPtr paramBlock)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
WebFSForkIOParam *block = (WebFSForkIOParam *)paramBlock;
- WebDownloadHandler *downloadHandler = block->downloadHandler;
+ WebDownload *download = block->download;
if (block->paramBlock.ioResult != noErr) {
ERROR("Closing fork of download file failed with error: %d", block->paramBlock.ioResult);
// FIXME: Need to report close errors.
}
- if (block->paramBlock.forkRefNum == [downloadHandler dataForkReferenceNumber]) {
- [downloadHandler setDataForkReferenceNumber:0];
+ if (block->paramBlock.forkRefNum == [download dataForkReferenceNumber]) {
+ [download setDataForkReferenceNumber:0];
} else {
- [downloadHandler setResourceForkReferenceNumber:0];
+ [download setResourceForkReferenceNumber:0];
}
// Check if both the data fork and resource fork are now closed.
- if ([downloadHandler dataForkReferenceNumber] == 0 && [downloadHandler resourceForkReferenceNumber] == 0) {
+ if ([download dataForkReferenceNumber] == 0 && [download resourceForkReferenceNumber] == 0) {
if (block->deleteFile && block->paramBlock.ref) {
WebFSRefParam *deleteBlock = malloc(sizeof(WebFSRefParam));
deleteBlock->paramBlock.ioCompletion = DeleteCompletionCallback;
deleteBlock->paramBlock.ref = block->paramBlock.ref;
- deleteBlock->downloadHandler = [downloadHandler retain];
+ deleteBlock->download = [download retain];
PBDeleteObjectAsync(&deleteBlock->paramBlock);
} else {
[[NSWorkspace sharedWorkspace] performSelectorOnMainThread:@selector(_web_noteFileChangedAtPath:)
- withObject:[downloadHandler path]
+ withObject:[download path]
waitUntilDone:NO];
}
}
- [downloadHandler release];
+ [download release];
[pool release];
free(block);
}
@@ -517,17 +547,17 @@ static void DeleteCompletionCallback(ParmBlkPtr paramBlock)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
WebFSRefParam *block = (WebFSRefParam *)paramBlock;
- WebDownloadHandler *downloadHandler = block->downloadHandler;
+ WebDownload *download = block->download;
if (block->paramBlock.ioResult != noErr) {
ERROR("Removal of download file failed with error: %d", block->paramBlock.ioResult);
} else {
[[NSWorkspace sharedWorkspace] performSelectorOnMainThread:@selector(_web_noteFileChangedAtPath:)
- withObject:[downloadHandler path]
+ withObject:[download path]
waitUntilDone:NO];
}
- [downloadHandler release];
+ [download release];
[pool release];
free(block);
}
diff --git a/WebKit/Downloads.subproj/WebDownloadHandler.h b/WebKit/Downloads.subproj/WebDownloadHandler.h
deleted file mode 100644
index 184da84..0000000
--- a/WebKit/Downloads.subproj/WebDownloadHandler.h
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// WebDownloadHandler.h
-// WebKit
-//
-// Created by Chris Blumenberg on Thu Apr 11 2002.
-// Copyright (c) 2002 Apple computer, Inc. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
- at class WebDataSource;
- at class WebError;
- at class WebResourceResponse;
-
- at interface WebDownloadHandler : NSObject
-{
- WebDataSource *dataSource;
-
- NSArray *decoderClasses;
- NSMutableArray *decoderSequence;
- NSMutableData *bufferedData;
-
- FSRef fileRef;
- FSRefPtr fileRefPtr;
-
- SInt16 dataForkRefNum;
- SInt16 resourceForkRefNum;
-
- // isCancelled is used to make sure we don't write after cancelling the load.
- BOOL isCancelled;
-
- // areWritesCancelled is only used by WriteCompletionCallback to make
- // sure that only 1 write failure cancels the load.
- BOOL areWritesCancelled;
-}
-
-- initWithDataSource:(WebDataSource *)dSource;
-- (WebError *)receivedData:(NSData *)data;
-- (WebError *)finishedLoading;
-- (void)cancel;
- at end
diff --git a/WebKit/Downloads.subproj/WebDownloadHandler.m b/WebKit/Downloads.subproj/WebDownloadHandler.m
deleted file mode 100644
index 9f700cd..0000000
--- a/WebKit/Downloads.subproj/WebDownloadHandler.m
+++ /dev/null
@@ -1,534 +0,0 @@
-//
-// WebDownloadHandler.m
-// WebKit
-//
-// Created by Chris Blumenberg on Thu Apr 11 2002.
-// Copyright (c) 2002 Apple Computer, Inc.
-//
-
-#import <WebKit/WebDownloadHandler.h>
-
-#import <WebKit/WebBinHexDecoder.h>
-#import <WebKit/WebDataSourcePrivate.h>
-#import <WebKit/WebDownloadDecoder.h>
-#import <WebKit/WebGZipDecoder.h>
-#import <WebKit/WebKitErrors.h>
-#import <WebKit/WebKitLogging.h>
-#import <WebKit/WebMacBinaryDecoder.h>
-#import <WebKit/WebNSWorkspaceExtras.h>
-
-#import <WebFoundation/WebError.h>
-#import <WebFoundation/WebNSFileManagerExtras.h>
-#import <WebFoundation/WebNSStringExtras.h>
-#import <WebFoundation/WebResourceRequest.h>
-#import <WebFoundation/WebResourceResponse.h>
-
-typedef struct WebFSForkIOParam
-{
- FSForkIOParam paramBlock;
- WebDownloadHandler *downloadHandler;
- BOOL deleteFile;
- NSData *data;
-} WebFSForkIOParam;
-
-typedef struct WebFSRefParam
-{
- FSRefParam paramBlock;
- WebDownloadHandler *downloadHandler;
-} WebFSRefParam;
-
-static void WriteCompletionCallback(ParmBlkPtr paramBlock);
-static void CloseCompletionCallback(ParmBlkPtr paramBlock);
-static void DeleteCompletionCallback(ParmBlkPtr paramBlock);
-
- at interface WebDownloadHandler (WebPrivate)
-- (NSString *)path;
-- (WebError *)errorWithCode:(int)code;
-- (void)cancelWithError:(WebError *)error;
-- (SInt16)dataForkReferenceNumber;
-- (void)setDataForkReferenceNumber:(SInt16)forkRefNum;
-- (SInt16)resourceForkReferenceNumber;
-- (void)setResourceForkReferenceNumber:(SInt16)forkRefNum;
-- (BOOL)writeForkData:(NSData *)data isDataFork:(BOOL)isDataFork;
-- (BOOL)areWritesCancelled;
-- (void)setWritesCancelled:(BOOL)cancelled;
- at end
-
- at implementation WebDownloadHandler
-
-- initWithDataSource:(WebDataSource *)dSource
-{
- [super init];
-
- dataSource = [dSource retain];
-
- decoderClasses = [[NSArray arrayWithObjects:
- [WebBinHexDecoder class],
- [WebMacBinaryDecoder class],
- [WebGZipDecoder class],
- nil] retain];
-
- LOG(Download, "Download started for: %@", [[dSource request] URL]);
- return self;
-}
-
-- (void)dealloc
-{
- [bufferedData release];
- [dataSource release];
- [decoderClasses release];
- [decoderSequence release];
- [super dealloc];
-}
-
-- (void)decodeHeaderData:(NSData *)headerData
- dataForkData:(NSData **)dataForkData
- resourceForkData:(NSData **)resourceForkData
-{
- ASSERT(headerData);
- ASSERT([headerData length]);
- ASSERT(dataForkData);
- ASSERT(resourceForkData);
-
- unsigned i;
- for (i = 0; i < [decoderClasses count]; i++) {
- Class decoderClass = [decoderClasses objectAtIndex:i];
-
- if ([decoderClass canDecodeHeaderData:headerData]) {
- NSObject <WebDownloadDecoder> *decoder = [[[decoderClass alloc] init] autorelease];
- BOOL didDecode = [decoder decodeData:headerData dataForkData:dataForkData resourceForkData:resourceForkData];
- if (!didDecode) {
- // Though the decoder said it could decode the header, actual decoding failed. Shouldn't happen.
- ERROR("Download decoder \"%s\" failed to decode header even though it claimed to handle it.",
- [[decoder className] lossyCString]);
- continue;
- }
-
- [decoderSequence addObject:decoder];
-
- [self decodeHeaderData:*dataForkData dataForkData:dataForkData resourceForkData:resourceForkData];
- break;
- }
- }
-}
-
-- (BOOL)decodeData:(NSData *)data
- dataForkData:(NSData **)dataForkData
- resourceForkData:(NSData **)resourceForkData
-{
- ASSERT(data);
- ASSERT([data length]);
- ASSERT(dataForkData);
- ASSERT(resourceForkData);
-
- if (!decoderSequence) {
- decoderSequence = [[NSMutableArray array] retain];
- [self decodeHeaderData:data dataForkData:dataForkData resourceForkData:resourceForkData];
- } else {
- unsigned i;
- for (i = 0; i< [decoderSequence count]; i++) {
- NSObject <WebDownloadDecoder> *decoder = [decoderSequence objectAtIndex:i];
- BOOL didDecode = [decoder decodeData:data dataForkData:dataForkData resourceForkData:resourceForkData];
-
- if (!didDecode) {
- return NO;
- }
-
- data = *dataForkData;
- }
- }
-
- if ([decoderSequence count] == 0) {
- *dataForkData = data;
- *resourceForkData = nil;
- }
-
- return YES;
-}
-
-- (void)closeFork:(SInt16)forkRefNum deleteFile:(BOOL)deleteFile
-{
- if (forkRefNum) {
- WebFSForkIOParam *block = malloc(sizeof(WebFSForkIOParam));
- block->paramBlock.ioCompletion = CloseCompletionCallback;
- block->paramBlock.forkRefNum = forkRefNum;
- block->paramBlock.ref = fileRefPtr;
- block->downloadHandler = [self retain];
- block->deleteFile = deleteFile;
- PBCloseForkAsync(&block->paramBlock);
- }
-}
-
-- (void)closeFileAndDelete:(BOOL)deleteFile
-{
- [self closeFork:dataForkRefNum deleteFile:deleteFile];
- [self closeFork:resourceForkRefNum deleteFile:deleteFile];
-}
-
-- (void)closeFile
-{
- [self closeFileAndDelete:NO];
-}
-
-- (void)cleanUpAfterFailure
-{
- [self closeFileAndDelete:YES];
-}
-
-- (WebError *)createFileIfNecessary
-{
- if (fileRefPtr) {
- return nil;
- }
-
- NSFileManager *fileManager = [NSFileManager defaultManager];
- NSString *path = [dataSource downloadPath];
- NSObject <WebDownloadDecoder> *lastDecoder = [decoderSequence lastObject];
-
- NSString *filename = [[lastDecoder filename] _web_filenameByFixingIllegalCharacters];
-
- if ([filename length] != 0) {
- path = [[path stringByDeletingLastPathComponent] stringByAppendingPathComponent:filename];
- }
-
- if ([fileManager fileExistsAtPath:path]) {
- NSString *pathWithoutExtension = [path stringByDeletingPathExtension];
- NSString *extension = [path pathExtension];
- NSString *pathWithAppendedNumber;
- unsigned i;
-
- for (i = 1; 1; i++) {
- pathWithAppendedNumber = [NSString stringWithFormat:@"%@-%d", pathWithoutExtension, i];
- if (extension && [extension length]) {
- path = [pathWithAppendedNumber stringByAppendingPathExtension:extension];
- } else {
- path = pathWithAppendedNumber;
- }
- if (![fileManager fileExistsAtPath:path]) {
- break;
- }
- }
- }
-
- [dataSource _setDownloadPath:path];
-
- NSDictionary *fileAttributes = [lastDecoder fileAttributes];
- // FIXME: This assumes that if we get any file attributes, they will include the creation
- // and modification date, which is not necessarily true.
- if (!fileAttributes) {
- WebResourceResponse *response = [dataSource response];
- fileAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
- [response createdDate], NSFileCreationDate,
- [response lastModifiedDate], NSFileModificationDate, nil];
- }
-
- if (![fileManager _web_createFileAtPath:path contents:nil attributes:fileAttributes]) {
- ERROR("-[NSFileManager _web_createFileAtPath:contents:attributes:] failed.");
- return [self errorWithCode:WebKitErrorCannotCreateFile];
- }
-
- [[NSWorkspace sharedWorkspace] _web_noteFileChangedAtPath:path];
-
- OSErr result = FSPathMakeRef((const UInt8 *)[path fileSystemRepresentation], &fileRef, NULL);
- if (result == noErr) {
- fileRefPtr = &fileRef;
- } else {
- ERROR("FSPathMakeRef failed.");
- [self cleanUpAfterFailure];
- return [self errorWithCode:WebKitErrorCannotCreateFile];
- }
-
- return nil;
-}
-
-- (WebError *)writeDataForkData:(NSData *)dataForkData resourceForkData:(NSData *)resourceForkData
-{
- WebError *error = [self createFileIfNecessary];
- if (error) {
- return error;
- }
-
- BOOL didWrite = YES;
-
- if ([dataForkData length]) {
- didWrite = [self writeForkData:dataForkData isDataFork:YES];
- }
-
- if (didWrite && [resourceForkData length]) {
- didWrite = [self writeForkData:resourceForkData isDataFork:NO];
- }
-
- if (!didWrite) {
- [self cleanUpAfterFailure];
- return [self errorWithCode:WebKitErrorCannotWriteToFile];
- }
-
- return nil;
-}
-
-- (NSData *)dataIfDoneBufferingData:(NSData *)data
-{
- if (!bufferedData) {
- bufferedData = [data mutableCopy];
- } else if ([bufferedData length] == 0) {
- // When bufferedData's length is 0, we're done buffering.
- return data;
- } else {
- // Append new data.
- [bufferedData appendData:data];
- }
-
- if ([bufferedData length] >= WEB_DOWNLOAD_DECODER_MINIMUM_HEADER_LENGTH) {
- // We've have enough now. Make a copy so we can set bufferedData's length to 0,
- // so we're know we're done buffering.
- data = [[bufferedData copy] autorelease];
- [bufferedData setLength:0];
- return data;
- } else {
- // Keep buffering. The header is not big enough to determine the encoding sequence.
- return nil;
- }
-}
-
-- (WebError *)decodeData:(NSData *)data
-{
- if ([data length] == 0) {
- return nil;
- }
-
- NSData *dataForkData = nil;
- NSData *resourceForkData = nil;
-
- if (![self decodeData:data dataForkData:&dataForkData resourceForkData:&resourceForkData]) {
- ERROR("Download decoding failed.");
- [self cleanUpAfterFailure];
- return [self errorWithCode:WebKitErrorDownloadDecodingFailedMidStream];
- }
-
- WebError *error = [self writeDataForkData:dataForkData resourceForkData:resourceForkData];
- if (error) {
- return error;
- }
-
- return nil;
-}
-
-- (WebError *)receivedData:(NSData *)data
-{
- ASSERT(data);
-
- return [self decodeData:[self dataIfDoneBufferingData:data]];
-}
-
-- (BOOL)finishDecoding
-{
- NSObject <WebDownloadDecoder> *decoder;
- unsigned i;
-
- for (i = 0; i < [decoderSequence count]; i++) {
- decoder = [decoderSequence objectAtIndex:i];
- if (![decoder finishDecoding]) {
- return NO;
- }
- }
-
- return YES;
-}
-
-- (WebError *)finishedLoading
-{
- WebError *error = [self decodeData:bufferedData];
- [bufferedData release];
- bufferedData = nil;
- if (error) {
- return error;
- }
-
- if (![self finishDecoding]) {
- ERROR("Download decoding failed.");
- [self cleanUpAfterFailure];
- return [self errorWithCode:WebKitErrorDownloadDecodingFailedToComplete];
- }
-
- [self closeFile];
-
- LOG(Download, "Download complete. Saved to: %@", [dataSource downloadPath]);
-
- return nil;
-}
-
-- (void)cancel
-{
- isCancelled = YES;
- [self cleanUpAfterFailure];
-}
-
- at end
-
-
- at implementation WebDownloadHandler (WebPrivate)
-
-- (NSString *)path
-{
- return [dataSource downloadPath];
-}
-
-- (BOOL)writeForkData:(NSData *)data isDataFork:(BOOL)isDataFork
-{
- ASSERT(!isCancelled);
-
- OSErr result;
- SInt16 *forkRefNum = isDataFork ? &dataForkRefNum : &resourceForkRefNum;
-
- if (*forkRefNum == 0) {
- HFSUniStr255 forkName;
- if (isDataFork) {
- result = FSGetDataForkName(&forkName);
- } else {
- result = FSGetResourceForkName(&forkName);
- }
-
- if (result != noErr) {
- ERROR("Couldn't get fork name of download file.");
- return NO;
- }
-
- result = FSOpenFork(fileRefPtr, forkName.length, forkName.unicode, fsWrPerm, forkRefNum);
- if (result != noErr) {
- ERROR("Couldn't open fork of download file.");
- return NO;
- }
- }
-
- WebFSForkIOParam *block = malloc(sizeof(WebFSForkIOParam));
- block->paramBlock.ioCompletion = WriteCompletionCallback;
- block->paramBlock.forkRefNum = *forkRefNum;
- block->paramBlock.positionMode = fsAtMark;
- block->paramBlock.positionOffset = 0;
- block->paramBlock.requestCount = [data length];
- block->paramBlock.buffer = (Ptr)[data bytes];
- block->downloadHandler = [self retain];
- block->data = [data copy];
- PBWriteForkAsync(&block->paramBlock);
-
- return YES;
-}
-
-- (WebError *)errorWithCode:(int)code
-{
- return [WebError errorWithCode:code inDomain:WebErrorDomainWebKit failingURL:[[dataSource URL] absoluteString]];
-}
-
-- (void)cancelWithError:(WebError *)error
-{
- [dataSource _stopLoadingWithError:error];
-}
-
-- (SInt16)dataForkReferenceNumber
-{
- return dataForkRefNum;
-}
-
-- (void)setDataForkReferenceNumber:(SInt16)forkRefNum
-{
- dataForkRefNum = forkRefNum;
-}
-
-- (SInt16)resourceForkReferenceNumber
-{
- return resourceForkRefNum;
-}
-
-- (void)setResourceForkReferenceNumber:(SInt16)forkRefNum
-{
- resourceForkRefNum = forkRefNum;
-}
-
-- (BOOL)areWritesCancelled
-{
- return areWritesCancelled;
-}
-
-- (void)setWritesCancelled:(BOOL)cancelled
-{
- areWritesCancelled = cancelled;
-}
-
- at end
-
-static void WriteCompletionCallback(ParmBlkPtr paramBlock)
-{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- WebFSForkIOParam *block = (WebFSForkIOParam *)paramBlock;
- WebDownloadHandler *downloadHandler = block->downloadHandler;
-
- if (block->paramBlock.ioResult != noErr && ![downloadHandler areWritesCancelled]) {
- ERROR("Writing to fork of download file failed with error: %d", block->paramBlock.ioResult);
- [downloadHandler setWritesCancelled:YES];
- [downloadHandler performSelectorOnMainThread:@selector(cancelWithError:)
- withObject:[downloadHandler errorWithCode:WebKitErrorCannotWriteToFile]
- waitUntilDone:NO];
- }
-
- [downloadHandler release];
- [block->data release];
- [pool release];
- free(block);
-}
-
-static void CloseCompletionCallback(ParmBlkPtr paramBlock)
-{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- WebFSForkIOParam *block = (WebFSForkIOParam *)paramBlock;
- WebDownloadHandler *downloadHandler = block->downloadHandler;
-
- if (block->paramBlock.ioResult != noErr) {
- ERROR("Closing fork of download file failed with error: %d", block->paramBlock.ioResult);
- // FIXME: Need to report close errors.
- }
-
- if (block->paramBlock.forkRefNum == [downloadHandler dataForkReferenceNumber]) {
- [downloadHandler setDataForkReferenceNumber:0];
- } else {
- [downloadHandler setResourceForkReferenceNumber:0];
- }
-
- // Check if both the data fork and resource fork are now closed.
- if ([downloadHandler dataForkReferenceNumber] == 0 && [downloadHandler resourceForkReferenceNumber] == 0) {
- if (block->deleteFile && block->paramBlock.ref) {
- WebFSRefParam *deleteBlock = malloc(sizeof(WebFSRefParam));
- deleteBlock->paramBlock.ioCompletion = DeleteCompletionCallback;
- deleteBlock->paramBlock.ref = block->paramBlock.ref;
- deleteBlock->downloadHandler = [downloadHandler retain];
- PBDeleteObjectAsync(&deleteBlock->paramBlock);
- } else {
- [[NSWorkspace sharedWorkspace] performSelectorOnMainThread:@selector(_web_noteFileChangedAtPath:)
- withObject:[downloadHandler path]
- waitUntilDone:NO];
- }
- }
-
- [downloadHandler release];
- [pool release];
- free(block);
-}
-
-static void DeleteCompletionCallback(ParmBlkPtr paramBlock)
-{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- WebFSRefParam *block = (WebFSRefParam *)paramBlock;
- WebDownloadHandler *downloadHandler = block->downloadHandler;
-
- if (block->paramBlock.ioResult != noErr) {
- ERROR("Removal of download file failed with error: %d", block->paramBlock.ioResult);
- } else {
- [[NSWorkspace sharedWorkspace] performSelectorOnMainThread:@selector(_web_noteFileChangedAtPath:)
- withObject:[downloadHandler path]
- waitUntilDone:NO];
- }
-
- [downloadHandler release];
- [pool release];
- free(block);
-}
-
diff --git a/WebKit/Downloads.subproj/WebDownloadPrivate.h b/WebKit/Downloads.subproj/WebDownloadPrivate.h
new file mode 100644
index 0000000..a1ebabf
--- /dev/null
+++ b/WebKit/Downloads.subproj/WebDownloadPrivate.h
@@ -0,0 +1,21 @@
+/*
+ WebDownloadPrivate.h
+ Copyright 2003, Apple, Inc. All rights reserved.
+
+ Private header file.
+*/
+
+#import <WebKit/WebDownload.h>
+
+ at interface WebDownload (WebPrivate)
+- (NSString *)path;
+- (WebError *)errorWithCode:(int)code;
+- (void)cancelWithError:(WebError *)error;
+- (SInt16)dataForkReferenceNumber;
+- (void)setDataForkReferenceNumber:(SInt16)forkRefNum;
+- (SInt16)resourceForkReferenceNumber;
+- (void)setResourceForkReferenceNumber:(SInt16)forkRefNum;
+- (BOOL)writeForkData:(NSData *)data isDataFork:(BOOL)isDataFork;
+- (BOOL)areWritesCancelled;
+- (void)setWritesCancelled:(BOOL)cancelled;
+ at end
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index 732da2a..41b6570 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -299,6 +299,7 @@
832B2D1603B10990009CF105,
84A992C403CE696800CA2ACA,
8466AEDE03F1F82100CA2ACA,
+ 8324709A03F32305003026AC,
);
isa = PBXHeadersBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@@ -1636,6 +1637,18 @@
settings = {
};
};
+ 8324709903F32305003026AC = {
+ fileEncoding = 4;
+ isa = PBXFileReference;
+ path = WebDownloadPrivate.h;
+ refType = 4;
+ };
+ 8324709A03F32305003026AC = {
+ fileRef = 8324709903F32305003026AC;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
832B2D1403B10990009CF105 = {
fileEncoding = 30;
isa = PBXFileReference;
@@ -1668,6 +1681,7 @@
9316400D0379832D008635CE,
832E26A1036F95CA005E2B4F,
832E26A3036F9614005E2B4F,
+ 8324709903F32305003026AC,
832E26A4036F9614005E2B4F,
936F62BD039DF0BF008635CE,
936F62BE039DF0BF008635CE,
@@ -1694,13 +1708,13 @@
832E26A3036F9614005E2B4F = {
fileEncoding = 30;
isa = PBXFileReference;
- path = WebDownloadHandler.h;
+ path = WebDownload.h;
refType = 4;
};
832E26A4036F9614005E2B4F = {
fileEncoding = 30;
isa = PBXFileReference;
- path = WebDownloadHandler.m;
+ path = WebDownload.m;
refType = 4;
};
832E26A5036F9614005E2B4F = {
diff --git a/WebKit/WebView.subproj/WebController.h b/WebKit/WebView.subproj/WebController.h
index 194f322..75915a1 100644
--- a/WebKit/WebView.subproj/WebController.h
+++ b/WebKit/WebView.subproj/WebController.h
@@ -12,7 +12,7 @@
@class WebController;
@class WebControllerPrivate;
@class WebDataSource;
- at class WebDownloadHandler;
+ at class WebDownload;
@class WebError;
@class WebFrame;
@class WebResourceHandle;
diff --git a/WebKit/WebView.subproj/WebDataSource.m b/WebKit/WebView.subproj/WebDataSource.m
index ce5afbf..8ab8238 100644
--- a/WebKit/WebView.subproj/WebDataSource.m
+++ b/WebKit/WebView.subproj/WebDataSource.m
@@ -4,7 +4,7 @@
*/
#import <WebKit/WebDocument.h>
-#import <WebKit/WebDownloadHandler.h>
+#import <WebKit/WebDownload.h>
#import <WebKit/WebException.h>
#import <WebKit/WebHTMLRepresentation.h>
#import <WebKit/WebMainResourceClient.h>
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index 8ff81cc..78da38d 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -9,7 +9,7 @@
#import <WebKit/WebControllerPolicyDelegate.h>
#import <WebKit/WebControllerPrivate.h>
#import <WebKit/WebDocument.h>
-#import <WebKit/WebDownloadHandler.h>
+#import <WebKit/WebDownload.h>
#import <WebKit/WebException.h>
#import <WebKit/WebFramePrivate.h>
#import <WebKit/WebHistory.h>
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.h b/WebKit/WebView.subproj/WebMainResourceClient.h
index 8e84eb8..0290599 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.h
+++ b/WebKit/WebView.subproj/WebMainResourceClient.h
@@ -11,7 +11,7 @@
#import <WebKit/WebBaseResourceHandleDelegate.h>
#import <WebKit/WebControllerPolicyDelegate.h>
- at class WebDownloadHandler;
+ at class WebDownload;
@class WebDataSource;
@class WebResourceHandle;
@class WebResourceRequest;
@@ -22,14 +22,14 @@
@interface WebMainResourceClient : WebBaseResourceHandleDelegate
{
- WebDownloadHandler *downloadHandler;
+ WebDownload *download;
NSMutableData *resourceData;
int _contentLength; // for logging only
int _bytesReceived; // for logging only
}
- initWithDataSource:(WebDataSource *)dataSource;
-- (WebDownloadHandler *)downloadHandler;
+- (WebDownload *)download;
- (NSData *)resourceData;
@end
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index 0c33164..46c580c 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -22,7 +22,7 @@
#import <WebKit/WebDataSource.h>
#import <WebKit/WebDataSourcePrivate.h>
#import <WebKit/WebDocument.h>
-#import <WebKit/WebDownloadHandler.h>
+#import <WebKit/WebDownload.h>
#import <WebKit/WebFrame.h>
#import <WebKit/WebFramePrivate.h>
#import <WebKit/WebKitErrors.h>
@@ -51,7 +51,7 @@
- (void)dealloc
{
- ASSERT(downloadHandler == nil);
+ ASSERT(download == nil);
[resourceData release];
@@ -63,23 +63,23 @@
return resourceData;
}
-- (WebDownloadHandler *)downloadHandler
+- (WebDownload *)download
{
- return downloadHandler;
+ return download;
}
- (BOOL)isDownload
{
- return downloadHandler != nil;
+ return download != nil;
}
- (void)receivedError:(WebError *)error complete:(BOOL)isComplete
{
- if (downloadHandler) {
+ if (download) {
ASSERT(isComplete);
- [downloadHandler cancel];
- [downloadHandler release];
- downloadHandler = nil;
+ [download cancel];
+ [download release];
+ download = nil;
[dataSource _setPrimaryLoadComplete:YES];
} else {
[[dataSource controller] _mainReceivedError:error
@@ -207,7 +207,7 @@
// Hand off the dataSource to the download handler. This will cause the remaining
// handle delegate callbacks to go to the controller's download delegate.
- downloadHandler = [[WebDownloadHandler alloc] initWithDataSource:dataSource];
+ download = [[WebDownload alloc] initWithDataSource:dataSource];
break;
case WebPolicyOpenURL:
@@ -296,8 +296,8 @@
WebError *downloadError= nil;
- if (downloadHandler) {
- downloadError = [downloadHandler receivedData:data];
+ if (download) {
+ downloadError = [download receivedData:data];
} else {
[resourceData appendData:data];
[dataSource _receivedData:data];
@@ -329,8 +329,8 @@
WebError *downloadError = nil;
- if (downloadHandler) {
- downloadError = [downloadHandler finishedLoading];
+ if (download) {
+ downloadError = [download finishedLoading];
[dataSource _setPrimaryLoadComplete:YES];
} else {
[dataSource _setResourceData:resourceData];
@@ -346,8 +346,8 @@
[super handleDidFinishLoading:h];
}
- [downloadHandler release];
- downloadHandler = nil;
+ [download release];
+ download = nil;
[self release];
}
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.h b/WebKit/WebView.subproj/WebMainResourceLoader.h
index 8e84eb8..0290599 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.h
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.h
@@ -11,7 +11,7 @@
#import <WebKit/WebBaseResourceHandleDelegate.h>
#import <WebKit/WebControllerPolicyDelegate.h>
- at class WebDownloadHandler;
+ at class WebDownload;
@class WebDataSource;
@class WebResourceHandle;
@class WebResourceRequest;
@@ -22,14 +22,14 @@
@interface WebMainResourceClient : WebBaseResourceHandleDelegate
{
- WebDownloadHandler *downloadHandler;
+ WebDownload *download;
NSMutableData *resourceData;
int _contentLength; // for logging only
int _bytesReceived; // for logging only
}
- initWithDataSource:(WebDataSource *)dataSource;
-- (WebDownloadHandler *)downloadHandler;
+- (WebDownload *)download;
- (NSData *)resourceData;
@end
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index 0c33164..46c580c 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -22,7 +22,7 @@
#import <WebKit/WebDataSource.h>
#import <WebKit/WebDataSourcePrivate.h>
#import <WebKit/WebDocument.h>
-#import <WebKit/WebDownloadHandler.h>
+#import <WebKit/WebDownload.h>
#import <WebKit/WebFrame.h>
#import <WebKit/WebFramePrivate.h>
#import <WebKit/WebKitErrors.h>
@@ -51,7 +51,7 @@
- (void)dealloc
{
- ASSERT(downloadHandler == nil);
+ ASSERT(download == nil);
[resourceData release];
@@ -63,23 +63,23 @@
return resourceData;
}
-- (WebDownloadHandler *)downloadHandler
+- (WebDownload *)download
{
- return downloadHandler;
+ return download;
}
- (BOOL)isDownload
{
- return downloadHandler != nil;
+ return download != nil;
}
- (void)receivedError:(WebError *)error complete:(BOOL)isComplete
{
- if (downloadHandler) {
+ if (download) {
ASSERT(isComplete);
- [downloadHandler cancel];
- [downloadHandler release];
- downloadHandler = nil;
+ [download cancel];
+ [download release];
+ download = nil;
[dataSource _setPrimaryLoadComplete:YES];
} else {
[[dataSource controller] _mainReceivedError:error
@@ -207,7 +207,7 @@
// Hand off the dataSource to the download handler. This will cause the remaining
// handle delegate callbacks to go to the controller's download delegate.
- downloadHandler = [[WebDownloadHandler alloc] initWithDataSource:dataSource];
+ download = [[WebDownload alloc] initWithDataSource:dataSource];
break;
case WebPolicyOpenURL:
@@ -296,8 +296,8 @@
WebError *downloadError= nil;
- if (downloadHandler) {
- downloadError = [downloadHandler receivedData:data];
+ if (download) {
+ downloadError = [download receivedData:data];
} else {
[resourceData appendData:data];
[dataSource _receivedData:data];
@@ -329,8 +329,8 @@
WebError *downloadError = nil;
- if (downloadHandler) {
- downloadError = [downloadHandler finishedLoading];
+ if (download) {
+ downloadError = [download finishedLoading];
[dataSource _setPrimaryLoadComplete:YES];
} else {
[dataSource _setResourceData:resourceData];
@@ -346,8 +346,8 @@
[super handleDidFinishLoading:h];
}
- [downloadHandler release];
- downloadHandler = nil;
+ [download release];
+ download = nil;
[self release];
}
diff --git a/WebKit/WebView.subproj/WebView.h b/WebKit/WebView.subproj/WebView.h
index 194f322..75915a1 100644
--- a/WebKit/WebView.subproj/WebView.h
+++ b/WebKit/WebView.subproj/WebView.h
@@ -12,7 +12,7 @@
@class WebController;
@class WebControllerPrivate;
@class WebDataSource;
- at class WebDownloadHandler;
+ at class WebDownload;
@class WebError;
@class WebFrame;
@class WebResourceHandle;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list