Commit dc11b3fb authored by slewis@apple.com's avatar slewis@apple.com

2008-05-15 Stephanie Lewis <slewis@apple.com>

        Reviewed by Anders.

        Turn on fast teardown.  I added a preference for using full teardown because 
        the LEAKS output will be useless without a full teardown.  

        preference for fullteardown
        * WebView/WebPreferenceKeysPrivate.h:
        * WebView/WebPreferences.m:
        (-[WebPreferences setFullDocumentTeardownEnabled:]):
        (-[WebPreferences fullDocumentTeardownEnabled]):
        * WebView/WebPreferencesPrivate.h:
        
        on application quit dispatch unload events and destroy plugins then exit
        * WebView/WebView.mm:
        (-[WebView closeWithFastTeardown]):
        (-[WebView _close]):
        * WebView/WebViewPrivate.h:

       export a symbol needed for fast teardown

        * WebCore.base.exp:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33504 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 930e76d0
2008-05-15 Stephanie Lewis <slewis@apple.com>
Reviewed by Anders.
export a symbol needed for fast teardown
* WebCore.base.exp:
2008-05-15 Stephanie Lewis <slewis@apple.com>
Reviewed by Anders.
......@@ -17,6 +17,7 @@ __ZN7WebCore11FileChooserD1Ev
__ZN7WebCore11FrameLoader11completeURLERKNS_6StringE
__ZN7WebCore11FrameLoader11loadArchiveEN3WTF10PassRefPtrINS_7ArchiveEEE
__ZN7WebCore11FrameLoader11setEncodingERKNS_6StringEb
__ZN7WebCore11FrameLoader11stopLoadingEb
__ZN7WebCore11FrameLoader12canCachePageEv
__ZN7WebCore11FrameLoader12shouldReloadERKNS_4KURLES3_
__ZN7WebCore11FrameLoader13executeScriptERKNS_6StringEb
......
2008-05-15 Stephanie Lewis <slewis@apple.com>
Reviewed by Anders.
Turn on fast teardown. I added a preference for using full teardown because
the LEAKS output will be useless without a full teardown.
preference for fullteardown
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.m:
(-[WebPreferences setFullDocumentTeardownEnabled:]):
(-[WebPreferences fullDocumentTeardownEnabled]):
* WebView/WebPreferencesPrivate.h:
on application quit dispatch unload events and destroy plugins then exit
* WebView/WebView.mm:
(-[WebView closeWithFastTeardown]):
(-[WebView _close]):
* WebView/WebViewPrivate.h:
2008-05-15 Stephanie Lewis <slewis@apple.com>
Reviewed by Anders.
......
......@@ -66,6 +66,7 @@
#define WebKitAuthorAndUserStylesEnabledPreferenceKey @"WebKitAuthorAndUserStylesEnabledPreferenceKey"
#define WebKitWebArchiveDebugModeEnabledPreferenceKey @"WebKitWebArchiveDebugModeEnabledPreferenceKey"
#define WebKitLocalStorageDatabasePathPreferenceKey @"WebKitLocalStorageDatabasePathPreferenceKey"
#define WebKitEnableFullDocumentTeardownPreferenceKey @"WebKitEnableFullDocumentTeardown"
#define WebKitOfflineWebApplicationCacheEnabledPreferenceKey @"WebKitOfflineWebApplicationCacheEnabled"
// These are private both because callers should be using the cover methods and because the
......
......@@ -1014,6 +1014,15 @@ - (void)willAddToWebView
++_private->numWebViews;
}
- (void)setFullDocumentTeardownEnabled:(BOOL)fullDocumentTeardownEnabled
{
[self _setBoolValue:fullDocumentTeardownEnabled forKey:WebKitEnableFullDocumentTeardownPreferenceKey];
}
- (BOOL)fullDocumentTeardownEnabled
{
return [self _boolValueForKey:WebKitEnableFullDocumentTeardownPreferenceKey];
}
@end
@implementation WebPreferences (WebInternal)
......
......@@ -112,4 +112,7 @@ extern NSString *WebPreferencesRemovedNotification;
- (void)willAddToWebView;
- (void)didRemoveFromWebView;
// Force document tear down at application quit
- (void)setFullDocumentTeardownEnabled:(BOOL)fullDocumentTeardownEnabled;
- (BOOL)fullDocumentTeardownEnabled;
@end
......@@ -102,6 +102,7 @@
#import <WebCore/DragData.h>
#import <WebCore/Editor.h>
#import <WebCore/ExceptionHandlers.h>
#import <WebCore/EventHandler.h>
#import <WebCore/Frame.h>
#import <WebCore/FrameLoader.h>
#import <WebCore/FrameTree.h>
......@@ -696,10 +697,52 @@ static bool debugWidget = true;
return NO;
}
- (void) closeWithFastTeardown
{
Frame *mainFrame = core([self mainFrame]);
BOOL hasUnloadEvent = NO;
if (mainFrame && mainFrame->page())
hasUnloadEvent = mainFrame->page()->pendingUnloadEventCount();
if (hasUnloadEvent) {
RefPtr<Frame> protect(mainFrame);
// dispatch unload Events
mainFrame->loader()->stopLoading(true);
}
pluginDatabaseClientCount--;
// Make sure to close both sets of plug-ins databases because plug-ins need an opportunity to clean up files, etc.
// Unload the WebView local plug-in database.
if (_private->pluginDatabase) {
[_private->pluginDatabase destroyAllPluginInstances];
[_private->pluginDatabase close];
[_private->pluginDatabase release];
_private->pluginDatabase = nil;
}
// Keep the global plug-in database active until the app terminates to avoid having to reload plug-in bundles.
if (!pluginDatabaseClientCount && applicationIsTerminating)
[WebPluginDatabase closeSharedDatabase];
}
- (void)_close
{
if (!_private || _private->closed)
return;
WebPreferences *preferences = _private->preferences;
BOOL fullDocumentTeardown = [preferences fullDocumentTeardownEnabled];
// To quit the apps fast we skip document teardown. Two exceptions:
// 1) plugins need to be destroyed and unloaded
// 2) unload events need to be called
if (applicationIsTerminating && !fullDocumentTeardown) {
[self closeWithFastTeardown];
return;
}
if (Frame* mainFrame = core([self mainFrame]))
mainFrame->loader()->detachFromParent();
......@@ -739,7 +782,6 @@ static bool debugWidget = true;
[WebPreferences _removeReferenceForIdentifier:[self preferencesIdentifier]];
WebPreferences *preferences = _private->preferences;
_private->preferences = nil;
[preferences didRemoveFromWebView];
[preferences release];
......
......@@ -371,6 +371,8 @@ Could be worth adding to the API.
// SPI for DumpRenderTree
- (void)_executeCoreCommandByName:(NSString *)name value:(NSString *)value;
- (void)closeWithFastTeardown;
@end
@interface WebView (WebViewPrintingPrivate)
......
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