[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:06:11 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 8af5c2d2c8772252ab5ddd4ca54f38618348be82
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Apr 16 22:30:22 2002 +0000

    	* WebView.subproj/IFBaseWebController.mm: Remove special release handling because
    	data sources now retain the controller as long as they are loading.
    
    	* WebView.subproj/IFWebDataSource.mm: Remove special release handling because
    	data sources now retain themselves as long as they are loading.
    
    	* WebView.subproj/IFWebFrame.mm: Remove special release handling, because
    	data sources now retain the controller as long as they are loading, and the
    	controller retains the frame.
    
    	* WebView.subproj/IFWebDataSourcePrivate.h: Add a "loading" boolean.
    	* WebView.subproj/IFWebDataSourcePrivate.mm: (-[IFWebDataSource _setLoading:]):
    	Change the "loading" state, retaining or releasing this object and the controller
    	as necessary.
    	(-[IFWebDataSource _updateLoading]): Update the loading state; called when
    	some part of loading is done to see if it's all done.
    	(-[IFWebDataSource _setController:]): Retain the new controller and release the
    	old controller when loading.
    	(-[IFWebDataSource _setPrimaryLoadComplete:]): Call _updateLoading.
    	(-[IFWebDataSource _startLoading:]): Call _setLoading:YES.
    	(-[IFWebDataSource _addURLHandle:]): Call _setLoading:YES.
    	(-[IFWebDataSource _removeURLHandle:]): Call _updateLoading.
    
    	* WebView.subproj/IFWebFrame.h: Use the real type, IFWebView, for setView and view.
    	* WebView.subproj/IFWebFramePrivate.h: Formatting tweak.
    	* WebKit.pbproj/project.pbxproj: Version wars.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1032 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 0d022da..ce58fab 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,4 +1,33 @@
-ret2002-04-16  John Sullivan  <sullivan at apple.com>
+2002-04-16  Darin Adler  <darin at apple.com>
+
+	* WebView.subproj/IFBaseWebController.mm: Remove special release handling because
+	data sources now retain the controller as long as they are loading.
+
+	* WebView.subproj/IFWebDataSource.mm: Remove special release handling because
+	data sources now retain themselves as long as they are loading.
+
+	* WebView.subproj/IFWebFrame.mm: Remove special release handling, because
+	data sources now retain the controller as long as they are loading, and the
+	controller retains the frame.
+
+	* WebView.subproj/IFWebDataSourcePrivate.h: Add a "loading" boolean.
+	* WebView.subproj/IFWebDataSourcePrivate.mm: (-[IFWebDataSource _setLoading:]):
+	Change the "loading" state, retaining or releasing this object and the controller
+	as necessary.
+	(-[IFWebDataSource _updateLoading]): Update the loading state; called when
+	some part of loading is done to see if it's all done.
+	(-[IFWebDataSource _setController:]): Retain the new controller and release the
+	old controller when loading.
+	(-[IFWebDataSource _setPrimaryLoadComplete:]): Call _updateLoading.
+	(-[IFWebDataSource _startLoading:]): Call _setLoading:YES.
+	(-[IFWebDataSource _addURLHandle:]): Call _setLoading:YES.
+	(-[IFWebDataSource _removeURLHandle:]): Call _updateLoading.
+
+	* WebView.subproj/IFWebFrame.h: Use the real type, IFWebView, for setView and view.
+	* WebView.subproj/IFWebFramePrivate.h: Formatting tweak.
+	* WebKit.pbproj/project.pbxproj: Version wars.
+
+2002-04-16  John Sullivan  <sullivan at apple.com>
 
 	* WebView.subproj/IFWebViewPrivate.mm: 
 	(-[IFWebView _setController:]): removed a mistaken
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 0d022da..ce58fab 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,4 +1,33 @@
-ret2002-04-16  John Sullivan  <sullivan at apple.com>
+2002-04-16  Darin Adler  <darin at apple.com>
+
+	* WebView.subproj/IFBaseWebController.mm: Remove special release handling because
+	data sources now retain the controller as long as they are loading.
+
+	* WebView.subproj/IFWebDataSource.mm: Remove special release handling because
+	data sources now retain themselves as long as they are loading.
+
+	* WebView.subproj/IFWebFrame.mm: Remove special release handling, because
+	data sources now retain the controller as long as they are loading, and the
+	controller retains the frame.
+
+	* WebView.subproj/IFWebDataSourcePrivate.h: Add a "loading" boolean.
+	* WebView.subproj/IFWebDataSourcePrivate.mm: (-[IFWebDataSource _setLoading:]):
+	Change the "loading" state, retaining or releasing this object and the controller
+	as necessary.
+	(-[IFWebDataSource _updateLoading]): Update the loading state; called when
+	some part of loading is done to see if it's all done.
+	(-[IFWebDataSource _setController:]): Retain the new controller and release the
+	old controller when loading.
+	(-[IFWebDataSource _setPrimaryLoadComplete:]): Call _updateLoading.
+	(-[IFWebDataSource _startLoading:]): Call _setLoading:YES.
+	(-[IFWebDataSource _addURLHandle:]): Call _setLoading:YES.
+	(-[IFWebDataSource _removeURLHandle:]): Call _updateLoading.
+
+	* WebView.subproj/IFWebFrame.h: Use the real type, IFWebView, for setView and view.
+	* WebView.subproj/IFWebFramePrivate.h: Formatting tweak.
+	* WebKit.pbproj/project.pbxproj: Version wars.
+
+2002-04-16  John Sullivan  <sullivan at apple.com>
 
 	* WebView.subproj/IFWebViewPrivate.mm: 
 	(-[IFWebView _setController:]): removed a mistaken
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index 8036071..9536633 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -1004,14 +1004,14 @@
 				39446071020F50ED0ECA1767,
 				39446072020F50ED0ECA1767,
 				39446073020F50ED0ECA1767,
-				39446074020F50ED0ECA1767,
 				39446076020F50ED0ECA1767,
 				39446077020F50ED0ECA1767,
 				39446078020F50ED0ECA1767,
 				39446079020F50ED0ECA1767,
+				39446074020F50ED0ECA1767,
+				F5143A370221DCCE01A80181,
 				9CF0E249021361B00ECA16EA,
 				9CF0E24A021361B00ECA16EA,
-				F5143A370221DCCE01A80181,
 				F5D538E802441F2601A80181,
 				F5D538EC02441FDD01A80181,
 				9CAE9D070252A4130ECA16EA,
diff --git a/WebKit/WebView.subproj/IFBaseWebController.mm b/WebKit/WebView.subproj/IFBaseWebController.mm
index 182ee69..bea2122 100644
--- a/WebKit/WebView.subproj/IFBaseWebController.mm
+++ b/WebKit/WebView.subproj/IFBaseWebController.mm
@@ -14,30 +14,6 @@
 
 #import <WebKit/WebKitDebug.h>
 
- at interface _IFControllerHolder : NSObject
-{
-    IFBaseWebController *controller;
-}
-- initWithController: (IFBaseWebController *)c;
-- (void)_checkReadyToDealloc: userInfo;
- at end
- at implementation _IFControllerHolder
-- initWithController: (IFBaseWebController *)c
-{
-    controller = c;	// Non-retained
-    return [super init];
-}
-
-- (void)_checkReadyToDealloc: userInfo
-{
-    if (![[[controller mainFrame] dataSource] isLoading] && ![[[controller mainFrame] provisionalDataSource] isLoading])
-        [controller dealloc];
-    else {
-        [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector: @selector(_checkReadyToDealloc:) userInfo: nil repeats:FALSE];
-    }
-}
- at end
-
 @implementation IFBaseWebController
 
 - init
@@ -52,7 +28,7 @@
     _private = [[IFBaseWebControllerPrivate alloc] init];
     _private->mainFrame = [[IFWebFrame alloc] initWithName: @"_top" view: view provisionalDataSource: dataSource controller: self];
 
-    return self;   
+    return self;
 }
 
 - (void)dealloc
@@ -61,30 +37,17 @@
     [super dealloc];
 }
 
-
-- (oneway void)release {
-    if ([self retainCount] == 1){
-        _IFControllerHolder *ch = [[[_IFControllerHolder alloc] initWithController: self] autorelease];
-        [[self mainFrame] stopLoading];
-        [NSTimer scheduledTimerWithTimeInterval:1.0 target:ch selector: @selector(_checkReadyToDealloc:) userInfo: nil repeats:FALSE];
-        return;
-    }
-    [super release];
-}
-
 - (void)setDirectsAllLinksToSystemBrowser: (BOOL)flag
 {
     [NSException raise:IFMethodNotYetImplemented format:@"IFBaseWebController::setDirectsAllLinksToSystemBrowser: is not implemented"];
 }
 
-
 - (BOOL)directsAllLinksToSystemBrowser
 {
     [NSException raise:IFMethodNotYetImplemented format:@"IFBaseWebController::directsAllLinksToSystemBrowser is not implemented"];
     return NO;
 }
 
-
 - (IFWebFrame *)createFrameNamed: (NSString *)fname for: (IFWebDataSource *)childDataSource inParent: (IFWebDataSource *)parentDataSource inScrollView: (BOOL)inScrollView
 {
     IFWebView *childView;
diff --git a/WebKit/WebView.subproj/IFWebDataSource.mm b/WebKit/WebView.subproj/IFWebDataSource.mm
index 395dc0e..5e2d7ee 100644
--- a/WebKit/WebView.subproj/IFWebDataSource.mm
+++ b/WebKit/WebView.subproj/IFWebDataSource.mm
@@ -14,30 +14,6 @@
 
 #import <WCWebDataSource.h>
 
- at interface _IFDataSourceHolder : NSObject
-{
-    IFWebDataSource *dataSource;
-}
-- initWithDataSource: (IFWebDataSource *)c;
-- (void)_checkReadyToDealloc: userInfo;
- at end
- at implementation _IFDataSourceHolder
-- initWithDataSource: (IFWebDataSource *)d
-{
-    dataSource = d;	// Non-retained
-    return [super init];
-}
-
-- (void)_checkReadyToDealloc: userInfo
-{
-    if (![dataSource isLoading])
-        [dataSource dealloc];
-    else {
-        [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector: @selector(_checkReadyToDealloc:) userInfo: nil repeats:FALSE];
-    }
-}
- at end
-
 @implementation IFWebDataSource
 
 static id IFWebDataSourceMake(void *url) 
@@ -45,7 +21,7 @@ static id IFWebDataSourceMake(void *url)
     return [[[IFWebDataSource alloc] initWithURL: (NSURL *)url] autorelease];
 }
 
-+(void) load
++ (void)load
 {
     WCSetIFWebDataSourceMakeFunc(IFWebDataSourceMake);
 }
@@ -64,16 +40,6 @@ static id IFWebDataSourceMake(void *url)
     return self;
 }
 
-- (oneway void)release {
-    if ([self retainCount] == 1){
-        _IFDataSourceHolder *ch = [[[_IFDataSourceHolder alloc] initWithDataSource: self] autorelease];
-        [self stopLoading];
-        [NSTimer scheduledTimerWithTimeInterval:1.0 target:ch selector: @selector(_checkReadyToDealloc:) userInfo: nil repeats:FALSE];
-        return;
-    }
-    [super release];
-}
-
 - (void)dealloc
 {
     [_private release];
diff --git a/WebKit/WebView.subproj/IFWebDataSourcePrivate.h b/WebKit/WebView.subproj/IFWebDataSourcePrivate.h
index a348618..7a559f9 100644
--- a/WebKit/WebView.subproj/IFWebDataSourcePrivate.h
+++ b/WebKit/WebView.subproj/IFWebDataSourcePrivate.h
@@ -46,14 +46,16 @@ class KHTMLPart;
     // The time when the data source was told to start loading.
     double loadingStartedTime;
     
-    bool primaryLoadComplete;
+    BOOL primaryLoadComplete;
     
-    bool stopping;
+    BOOL stopping;
     
     NSString *pageTitle;
     
     // The location change handler for this data source.
     id <IFLocationChangeHandler>locationChangeHandler;
+
+    BOOL loading; // self and controller are retained while loading
 }
 
 - init;
diff --git a/WebKit/WebView.subproj/IFWebDataSourcePrivate.mm b/WebKit/WebView.subproj/IFWebDataSourcePrivate.mm
index 17f8ae4..72806ca 100644
--- a/WebKit/WebView.subproj/IFWebDataSourcePrivate.mm
+++ b/WebKit/WebView.subproj/IFWebDataSourcePrivate.mm
@@ -34,16 +34,15 @@
 
 - (void)dealloc
 {
-    // controller is not retained!  IFWebControllers maintain
-    // a reference to the main frame, which in turn refers to it's
-    // view and data source.
+    // controller is only retained while loading, but this object is also
+    // retained while loading, so no need to release here
+    WEBKIT_ASSERT(!loading);
+    
     int i, count;
     NSArray *childFrames = [frames allValues];
     
-    controller = nil;
-    
     count = [childFrames count];
-    for (i = 0; i < count; i++){
+    for (i = 0; i < count; i++) {
         [(IFWebFrame *)[childFrames objectAtIndex: i] _setController: nil];
     }
     [frames release];
@@ -56,7 +55,6 @@
     [locationChangeHandler release];
     
     part->deref();
-    part = 0;
 
     [super dealloc];
 }
@@ -64,14 +62,40 @@
 @end
 
 @implementation IFWebDataSource (IFPrivate)
-- (void)_setController: (id <IFWebController>)controller
+
+- (void)_setLoading:(BOOL)loading
 {
-    WEBKIT_ASSERT (_private->part != nil);
+    WEBKIT_ASSERT_VALID_ARG("loading", loading == NO || loading == YES);
+    
+    if (_private->loading == loading)
+        return;
+    _private->loading = loading;
+    
+    if (loading) {
+        [self retain];
+        [_private->controller retain];
+    } else {
+        [_private->controller release];
+        [self release];
+    }
+}
 
-    _private->controller = controller;
-    _private->part->setDataSource (self);
+- (void)_updateLoading
+{
+    [self _setLoading: _private->mainHandle || [_private->urlHandles count]];
 }
 
+- (void)_setController: (id <IFWebController>)controller
+{
+    WEBKIT_ASSERT(_private->part != nil);
+    
+    if (_private->loading) {
+        [controller retain];
+        [_private->controller release];
+    }
+    _private->controller = controller;
+    _private->part->setDataSource(self);
+}
 
 - (KHTMLPart *)_part
 {
@@ -87,11 +111,12 @@
 - (void)_setPrimaryLoadComplete: (BOOL)flag
 {
     _private->primaryLoadComplete = flag;
-    if (flag == YES){
+    if (flag) {
         [_private->mainURLHandleClient release];
         _private->mainURLHandleClient = 0; 
         [_private->mainHandle autorelease];
-        _private->mainHandle = 0; 
+        _private->mainHandle = 0;
+        [self _updateLoading];
     }
 }
 
@@ -118,7 +143,7 @@
     }
     theURL = [NSURL URLWithString:urlString];
 
-    _private->mainURLHandleClient = [[IFMainURLHandleClient alloc] initWithDataSource: self part: [self _part]];
+    _private->mainURLHandleClient = [[IFMainURLHandleClient alloc] initWithDataSource: self part: _private->part];
     
     _private->mainHandle = [[IFURLHandle alloc] initWithURL:theURL];
     [_private->mainHandle addClient: _private->mainURLHandleClient];
@@ -131,22 +156,25 @@
 
     // FIXME [rjw]:  Do any work need in the kde engine.  This should be removed.
     // We should move any code needed out of KWQ.
-    [self _part]->openURL (url);
+    _private->part->openURL(url);
     
+    [self _setLoading:YES];
+
     [[self _locationChangeHandler] locationChangeStarted];
 }
 
-
 - (void)_addURLHandle: (IFURLHandle *)handle
 {
     if (_private->urlHandles == nil)
         _private->urlHandles = [[NSMutableArray alloc] init];
     [_private->urlHandles addObject: handle];
+    [self _setLoading:YES];
 }
 
 - (void)_removeURLHandle: (IFURLHandle *)handle
 {
     [_private->urlHandles removeObject: handle];
+    [self _updateLoading];
 }
 
 - (BOOL)_isStopping
@@ -171,10 +199,9 @@
         [[_private->urlHandles objectAtIndex: i] cancelLoadInBackground];
     }
 
-    [self _part]->closeURL ();
+    _private->part->closeURL();
 }
 
-
 - (void)_recursiveStopLoading
 {
     NSArray *frames;
diff --git a/WebKit/WebView.subproj/IFWebFrame.h b/WebKit/WebView.subproj/IFWebFrame.h
index e9cb4fe..0fc6b42 100644
--- a/WebKit/WebView.subproj/IFWebFrame.h
+++ b/WebKit/WebView.subproj/IFWebFrame.h
@@ -10,6 +10,7 @@
 
 @class IFError;
 @class IFWebDataSource;
+ at class IFWebView;
 @protocol IFWebController;
 
 @class IFWebFramePrivate;
@@ -26,8 +27,8 @@
 - (void)setController: (id <IFWebController>)controller;
 - (id <IFWebController>)controller;
 
-- (void)setView: view;
-- view;
+- (void)setView: (IFWebView *)view;
+- (IFWebView *)view;
 
 /*
     Sets the frame's data source.  Note that the data source will be
diff --git a/WebKit/WebView.subproj/IFWebFrame.mm b/WebKit/WebView.subproj/IFWebFrame.mm
index 929413a..ede9e1f 100644
--- a/WebKit/WebView.subproj/IFWebFrame.mm
+++ b/WebKit/WebView.subproj/IFWebFrame.mm
@@ -18,30 +18,6 @@
 #include <KWQKHTMLPart.h>
 #include <rendering/render_frames.h>
 
- at interface _IFFrameHolder : NSObject
-{
-    id object;
-}
-- initWithObject: o;
-- (void)_checkReadyToDealloc: userInfo;
- at end
- at implementation _IFFrameHolder
-- initWithObject: o
-{
-    object = o;	// Non-retained
-    return [super init];
-}
-
-- (void)_checkReadyToDealloc: userInfo
-{
-    if ([object dataSource] == nil || ![[object dataSource] isLoading])
-        [object dealloc];
-    else {
-        [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector: @selector(_checkReadyToDealloc:) userInfo: nil repeats:FALSE];
-    }
-}
- at end
-
 @implementation IFWebFrame
 
 - init
@@ -70,22 +46,9 @@
     if (v)
         [self setView: v];
     
-    return self; 
-}
-
-- (oneway void)release {
-#ifdef THIS_MAY_BE_BAD
-    if ([self retainCount] == 1){
-        _IFFrameHolder *ch = [[[_IFFrameHolder alloc] initWithObject: self] autorelease];
-        [self stopLoading];
-        [NSTimer scheduledTimerWithTimeInterval:1.0 target:ch selector: @selector(_checkReadyToDealloc:) userInfo: nil repeats:FALSE];
-        return;
-    }
-#endif
-    [super release];
+    return self;
 }
 
-
 - (void)dealloc
 {
     [_private release];
diff --git a/WebKit/WebView.subproj/IFWebFramePrivate.h b/WebKit/WebView.subproj/IFWebFramePrivate.h
index 5f4fd25..671bae7 100644
--- a/WebKit/WebView.subproj/IFWebFramePrivate.h
+++ b/WebKit/WebView.subproj/IFWebFramePrivate.h
@@ -41,7 +41,7 @@ typedef enum {
     IFWebFrameState state;
     NSMutableDictionary *errors;
     IFError *mainDocumentError;
-    bool scheduledLayoutPending;
+    BOOL scheduledLayoutPending;
 }
 
 - (void)setName: (NSString *)n;
diff --git a/WebKit/WebView.subproj/WebDataSource.m b/WebKit/WebView.subproj/WebDataSource.m
index 395dc0e..5e2d7ee 100644
--- a/WebKit/WebView.subproj/WebDataSource.m
+++ b/WebKit/WebView.subproj/WebDataSource.m
@@ -14,30 +14,6 @@
 
 #import <WCWebDataSource.h>
 
- at interface _IFDataSourceHolder : NSObject
-{
-    IFWebDataSource *dataSource;
-}
-- initWithDataSource: (IFWebDataSource *)c;
-- (void)_checkReadyToDealloc: userInfo;
- at end
- at implementation _IFDataSourceHolder
-- initWithDataSource: (IFWebDataSource *)d
-{
-    dataSource = d;	// Non-retained
-    return [super init];
-}
-
-- (void)_checkReadyToDealloc: userInfo
-{
-    if (![dataSource isLoading])
-        [dataSource dealloc];
-    else {
-        [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector: @selector(_checkReadyToDealloc:) userInfo: nil repeats:FALSE];
-    }
-}
- at end
-
 @implementation IFWebDataSource
 
 static id IFWebDataSourceMake(void *url) 
@@ -45,7 +21,7 @@ static id IFWebDataSourceMake(void *url)
     return [[[IFWebDataSource alloc] initWithURL: (NSURL *)url] autorelease];
 }
 
-+(void) load
++ (void)load
 {
     WCSetIFWebDataSourceMakeFunc(IFWebDataSourceMake);
 }
@@ -64,16 +40,6 @@ static id IFWebDataSourceMake(void *url)
     return self;
 }
 
-- (oneway void)release {
-    if ([self retainCount] == 1){
-        _IFDataSourceHolder *ch = [[[_IFDataSourceHolder alloc] initWithDataSource: self] autorelease];
-        [self stopLoading];
-        [NSTimer scheduledTimerWithTimeInterval:1.0 target:ch selector: @selector(_checkReadyToDealloc:) userInfo: nil repeats:FALSE];
-        return;
-    }
-    [super release];
-}
-
 - (void)dealloc
 {
     [_private release];
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.h b/WebKit/WebView.subproj/WebDataSourcePrivate.h
index a348618..7a559f9 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.h
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.h
@@ -46,14 +46,16 @@ class KHTMLPart;
     // The time when the data source was told to start loading.
     double loadingStartedTime;
     
-    bool primaryLoadComplete;
+    BOOL primaryLoadComplete;
     
-    bool stopping;
+    BOOL stopping;
     
     NSString *pageTitle;
     
     // The location change handler for this data source.
     id <IFLocationChangeHandler>locationChangeHandler;
+
+    BOOL loading; // self and controller are retained while loading
 }
 
 - init;
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index 17f8ae4..72806ca 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -34,16 +34,15 @@
 
 - (void)dealloc
 {
-    // controller is not retained!  IFWebControllers maintain
-    // a reference to the main frame, which in turn refers to it's
-    // view and data source.
+    // controller is only retained while loading, but this object is also
+    // retained while loading, so no need to release here
+    WEBKIT_ASSERT(!loading);
+    
     int i, count;
     NSArray *childFrames = [frames allValues];
     
-    controller = nil;
-    
     count = [childFrames count];
-    for (i = 0; i < count; i++){
+    for (i = 0; i < count; i++) {
         [(IFWebFrame *)[childFrames objectAtIndex: i] _setController: nil];
     }
     [frames release];
@@ -56,7 +55,6 @@
     [locationChangeHandler release];
     
     part->deref();
-    part = 0;
 
     [super dealloc];
 }
@@ -64,14 +62,40 @@
 @end
 
 @implementation IFWebDataSource (IFPrivate)
-- (void)_setController: (id <IFWebController>)controller
+
+- (void)_setLoading:(BOOL)loading
 {
-    WEBKIT_ASSERT (_private->part != nil);
+    WEBKIT_ASSERT_VALID_ARG("loading", loading == NO || loading == YES);
+    
+    if (_private->loading == loading)
+        return;
+    _private->loading = loading;
+    
+    if (loading) {
+        [self retain];
+        [_private->controller retain];
+    } else {
+        [_private->controller release];
+        [self release];
+    }
+}
 
-    _private->controller = controller;
-    _private->part->setDataSource (self);
+- (void)_updateLoading
+{
+    [self _setLoading: _private->mainHandle || [_private->urlHandles count]];
 }
 
+- (void)_setController: (id <IFWebController>)controller
+{
+    WEBKIT_ASSERT(_private->part != nil);
+    
+    if (_private->loading) {
+        [controller retain];
+        [_private->controller release];
+    }
+    _private->controller = controller;
+    _private->part->setDataSource(self);
+}
 
 - (KHTMLPart *)_part
 {
@@ -87,11 +111,12 @@
 - (void)_setPrimaryLoadComplete: (BOOL)flag
 {
     _private->primaryLoadComplete = flag;
-    if (flag == YES){
+    if (flag) {
         [_private->mainURLHandleClient release];
         _private->mainURLHandleClient = 0; 
         [_private->mainHandle autorelease];
-        _private->mainHandle = 0; 
+        _private->mainHandle = 0;
+        [self _updateLoading];
     }
 }
 
@@ -118,7 +143,7 @@
     }
     theURL = [NSURL URLWithString:urlString];
 
-    _private->mainURLHandleClient = [[IFMainURLHandleClient alloc] initWithDataSource: self part: [self _part]];
+    _private->mainURLHandleClient = [[IFMainURLHandleClient alloc] initWithDataSource: self part: _private->part];
     
     _private->mainHandle = [[IFURLHandle alloc] initWithURL:theURL];
     [_private->mainHandle addClient: _private->mainURLHandleClient];
@@ -131,22 +156,25 @@
 
     // FIXME [rjw]:  Do any work need in the kde engine.  This should be removed.
     // We should move any code needed out of KWQ.
-    [self _part]->openURL (url);
+    _private->part->openURL(url);
     
+    [self _setLoading:YES];
+
     [[self _locationChangeHandler] locationChangeStarted];
 }
 
-
 - (void)_addURLHandle: (IFURLHandle *)handle
 {
     if (_private->urlHandles == nil)
         _private->urlHandles = [[NSMutableArray alloc] init];
     [_private->urlHandles addObject: handle];
+    [self _setLoading:YES];
 }
 
 - (void)_removeURLHandle: (IFURLHandle *)handle
 {
     [_private->urlHandles removeObject: handle];
+    [self _updateLoading];
 }
 
 - (BOOL)_isStopping
@@ -171,10 +199,9 @@
         [[_private->urlHandles objectAtIndex: i] cancelLoadInBackground];
     }
 
-    [self _part]->closeURL ();
+    _private->part->closeURL();
 }
 
-
 - (void)_recursiveStopLoading
 {
     NSArray *frames;
diff --git a/WebKit/WebView.subproj/WebFrame.h b/WebKit/WebView.subproj/WebFrame.h
index e9cb4fe..0fc6b42 100644
--- a/WebKit/WebView.subproj/WebFrame.h
+++ b/WebKit/WebView.subproj/WebFrame.h
@@ -10,6 +10,7 @@
 
 @class IFError;
 @class IFWebDataSource;
+ at class IFWebView;
 @protocol IFWebController;
 
 @class IFWebFramePrivate;
@@ -26,8 +27,8 @@
 - (void)setController: (id <IFWebController>)controller;
 - (id <IFWebController>)controller;
 
-- (void)setView: view;
-- view;
+- (void)setView: (IFWebView *)view;
+- (IFWebView *)view;
 
 /*
     Sets the frame's data source.  Note that the data source will be
diff --git a/WebKit/WebView.subproj/WebFrame.m b/WebKit/WebView.subproj/WebFrame.m
index 929413a..ede9e1f 100644
--- a/WebKit/WebView.subproj/WebFrame.m
+++ b/WebKit/WebView.subproj/WebFrame.m
@@ -18,30 +18,6 @@
 #include <KWQKHTMLPart.h>
 #include <rendering/render_frames.h>
 
- at interface _IFFrameHolder : NSObject
-{
-    id object;
-}
-- initWithObject: o;
-- (void)_checkReadyToDealloc: userInfo;
- at end
- at implementation _IFFrameHolder
-- initWithObject: o
-{
-    object = o;	// Non-retained
-    return [super init];
-}
-
-- (void)_checkReadyToDealloc: userInfo
-{
-    if ([object dataSource] == nil || ![[object dataSource] isLoading])
-        [object dealloc];
-    else {
-        [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector: @selector(_checkReadyToDealloc:) userInfo: nil repeats:FALSE];
-    }
-}
- at end
-
 @implementation IFWebFrame
 
 - init
@@ -70,22 +46,9 @@
     if (v)
         [self setView: v];
     
-    return self; 
-}
-
-- (oneway void)release {
-#ifdef THIS_MAY_BE_BAD
-    if ([self retainCount] == 1){
-        _IFFrameHolder *ch = [[[_IFFrameHolder alloc] initWithObject: self] autorelease];
-        [self stopLoading];
-        [NSTimer scheduledTimerWithTimeInterval:1.0 target:ch selector: @selector(_checkReadyToDealloc:) userInfo: nil repeats:FALSE];
-        return;
-    }
-#endif
-    [super release];
+    return self;
 }
 
-
 - (void)dealloc
 {
     [_private release];
diff --git a/WebKit/WebView.subproj/WebFramePrivate.h b/WebKit/WebView.subproj/WebFramePrivate.h
index 5f4fd25..671bae7 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.h
+++ b/WebKit/WebView.subproj/WebFramePrivate.h
@@ -41,7 +41,7 @@ typedef enum {
     IFWebFrameState state;
     NSMutableDictionary *errors;
     IFError *mainDocumentError;
-    bool scheduledLayoutPending;
+    BOOL scheduledLayoutPending;
 }
 
 - (void)setName: (NSString *)n;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list