+2006-08-22 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Brady.
+
+ - remove "loading" flag from WebDataSource and code that manages it; it is redundat.
+
+ * Loader/WebFrameLoader.m:
+ (-[WebFrameLoader addPlugInStreamLoader:]):
+ (-[WebFrameLoader removePlugInStreamLoader:]):
+ (-[WebFrameLoader addSubresourceLoader:]):
+ (-[WebFrameLoader removeSubresourceLoader:]):
+ * WebView/WebDataSource.m:
+ (-[WebDataSourcePrivate dealloc]):
+ (-[WebDataSource _setPrimaryLoadComplete:]):
+ (-[WebDataSource _stopLoading]):
+ (-[WebDataSource _prepareForLoadStart]):
+ (-[WebDataSource _startLoading]):
+ (-[WebDataSource isLoading]):
+ * WebView/WebDataSourceInternal.h:
+
2006-08-22 Maciej Stachowiak <mjs@apple.com>
Reviewed by Eric.
if (!plugInStreamLoaders)
plugInStreamLoaders = [[NSMutableArray alloc] init];
[plugInStreamLoaders addObject:loader];
- [[self activeDataSource] _setLoading:YES];
}
- (void)removePlugInStreamLoader:(WebLoader *)loader
{
[plugInStreamLoaders removeObject:loader];
- [[self activeDataSource] _updateLoading];
}
- (void)setDefersCallbacks:(BOOL)defers
if (subresourceLoaders == nil)
subresourceLoaders = [[NSMutableArray alloc] init];
[subresourceLoaders addObject:loader];
- [[self activeDataSource] _setLoading:YES];
}
- (void)removeSubresourceLoader:(WebLoader *)loader
{
[subresourceLoaders removeObject:loader];
- [[self activeDataSource] _updateLoading];
}
- (NSData *)mainResourceData
// Error associated with main document.
NSError *mainDocumentError;
- BOOL loading; // self and webView are retained while loading
-
BOOL gotFirstByte; // got first byte
BOOL committed; // This data source has been committed
BOOL representationFinishedLoading;
- (void)dealloc
{
- ASSERT(!loading);
+ ASSERT(![[webFrame _frameLoader] isLoading]);
[resourceData release];
[representation release];
_private->representationFinishedLoading = NO;
}
-- (void)_setLoading:(BOOL)loading
-{
- _private->loading = loading;
-}
-
-- (void)_updateLoading
-{
- WebFrameLoader *frameLoader = [_private->webFrame _frameLoader];
- ASSERT(self == [frameLoader activeDataSource]);
-
- [self _setLoading:[frameLoader isLoading]];
-}
-
- (void)_setData:(NSData *)data
{
[data retain];
[[_private->webFrame _frameLoader] releaseMainResourceLoader];
}
- [self _updateLoading];
-
if ([WebScriptDebugServer listenerCount])
[[WebScriptDebugServer sharedScriptDebugServer] webView:[[self webFrame] webView] didLoadMainResourceForDataSource:self];
}
if (_private->committed)
[[self _bridge] stopLoading];
- if (!_private->loading)
+ if (![[_private->webFrame _frameLoader] isLoading])
return;
[self retain];
// Mark the start loading time.
_private->loadingStartedTime = CFAbsoluteTimeGetCurrent();
- [self _setLoading:YES];
[[self _webView] _progressStarted:[self webFrame]];
[[self _webView] _didStartProvisionalLoadForFrame:[self webFrame]];
[[[self _webView] _frameLoadDelegateForwarder] webView:[self _webView]
else
identifier = [[WebDefaultResourceLoadDelegate sharedResourceLoadDelegate] webView:[self _webView] identifierForInitialRequest:_private->originalRequest fromDataSource:self];
- if (![[_private->webFrame _frameLoader] startLoadingMainResourceWithRequest:_private->request identifier:identifier])
- [self _updateLoading];
+ [[_private->webFrame _frameLoader] startLoadingMainResourceWithRequest:_private->request identifier:identifier];
}
- (BOOL)_isStopping
// Once a frame has loaded, we no longer need to consider subresources,
// but we still need to consider subframes.
if ([[[self webFrame] _frameLoader] state] != WebFrameStateComplete) {
- if (!_private->primaryLoadComplete && _private->loading)
+ if (!_private->primaryLoadComplete && [[_private->webFrame _frameLoader] isLoading])
return YES;
if ([[_private->webFrame _frameLoader] isLoadingSubresources])
return YES;