Commit 5a1914ba authored by cfleizach@apple.com's avatar cfleizach@apple.com
Browse files

WK2 leaks when a page is closed

https://bugs.webkit.org/show_bug.cgi?id=53100

Reviewed by Darin Adler.

Allow the WKView a chance to clean up on a page close. In this case,
cleaning up means removing the references the accessibility token has
to the window.

* UIProcess/API/mac/PageClientImpl.h:
* UIProcess/API/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::pageClosed):
* UIProcess/API/mac/WKView.mm:
(-[WKView _setRemoteAccessibilityWindow:]):
(-[WKView _setAccessibilityChildToken:]):
(-[WKView _processDidCrash]):
(-[WKView _pageClosed]):
* UIProcess/API/mac/WKViewInternal.h:
* UIProcess/API/qt/qwkpage_p.h:
(QWKPagePrivate::pageClosed):
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::close):
* UIProcess/win/WebView.cpp:
(WebKit::WebView::pageClosed):
* UIProcess/win/WebView.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76657 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1bbdce1b
2011-01-25 Chris Fleizach <cfleizach@apple.com>
Reviewed by Darin Adler.
WK2 leaks when a page is closed
https://bugs.webkit.org/show_bug.cgi?id=53100
Allow the WKView a chance to clean up on a page close. In this case,
cleaning up means removing the references the accessibility token has
to the window.
* UIProcess/API/mac/PageClientImpl.h:
* UIProcess/API/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::pageClosed):
* UIProcess/API/mac/WKView.mm:
(-[WKView _setRemoteAccessibilityWindow:]):
(-[WKView _setAccessibilityChildToken:]):
(-[WKView _processDidCrash]):
(-[WKView _pageClosed]):
* UIProcess/API/mac/WKViewInternal.h:
* UIProcess/API/qt/qwkpage_p.h:
(QWKPagePrivate::pageClosed):
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::close):
* UIProcess/win/WebView.cpp:
(WebKit::WebView::pageClosed):
* UIProcess/win/WebView.h:
2011-01-25 Chris Marrin <cmarrin@apple.com>
 
Reviewed by Adam Roben.
......@@ -60,6 +60,7 @@ private:
virtual bool isViewInWindow();
virtual void processDidCrash();
virtual void pageClosed();
virtual void didRelaunchProcess();
virtual void takeFocus(bool direction);
virtual void toolTipChanged(const String& oldToolTip, const String& newToolTip);
......
......@@ -181,6 +181,11 @@ void PageClientImpl::processDidCrash()
{
[m_wkView _processDidCrash];
}
void PageClientImpl::pageClosed()
{
[m_wkView _pageClosed];
}
void PageClientImpl::didRelaunchProcess()
{
......
......@@ -277,6 +277,13 @@ static bool useNewDrawingArea()
return YES;
}
- (void)_setRemoteAccessibilityWindow:(id)window
{
#if !defined(BUILDING_ON_SNOW_LEOPARD)
WKAXInitializeRemoteElementWithWindow(_data->_remoteAccessibilityChild.get(), window);
#endif
}
- (void)setFrameSize:(NSSize)size
{
[super setFrameSize:size];
......@@ -1193,6 +1200,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
_data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive | WebPageProxy::ViewIsInWindow);
}
[self _setRemoteAccessibilityWindow:[self window]];
}
- (void)_windowDidBecomeKey:(NSNotification *)notification
......@@ -1300,7 +1308,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
{
#if !defined(BUILDING_ON_SNOW_LEOPARD)
_data->_remoteAccessibilityChild = WKAXRemoteElementForToken((CFDataRef)data);
WKAXInitializeRemoteElementWithWindow(_data->_remoteAccessibilityChild.get(), [self window]);
[self _setRemoteAccessibilityWindow:[self window]];
#endif
}
......@@ -1395,6 +1403,14 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
- (void)_processDidCrash
{
[self setNeedsDisplay:YES];
[self _setRemoteAccessibilityWindow:nil];
}
- (void)_pageClosed
{
// When the page closes, the references the accessibility child has to the window
// need to be removed, otherwise it can leak.
[self _setRemoteAccessibilityWindow:nil];
}
- (void)_didRelaunchProcess
......
......@@ -36,6 +36,7 @@ namespace WebKit {
- (PassOwnPtr<WebKit::DrawingAreaProxy>)_createDrawingAreaProxy;
- (BOOL)_isFocused;
- (void)_processDidCrash;
- (void)_pageClosed;
- (void)_didRelaunchProcess;
- (void)_takeFocus:(BOOL)direction;
- (void)_toolTipChangedFrom:(NSString *)oldToolTip to:(NSString *)newToolTip;
......
......@@ -62,6 +62,7 @@ public:
#endif // USE(ACCELERATED_COMPOSITING)
virtual void pageDidRequestScroll(const WebCore::IntSize&);
virtual void processDidCrash();
virtual void pageClosed() { }
virtual void didRelaunchProcess();
virtual void didChangeContentsSize(const WebCore::IntSize&);
virtual void didFindZoomableArea(const WebCore::IntRect&);
......
......@@ -79,6 +79,7 @@ public:
virtual void processDidCrash() = 0;
virtual void didRelaunchProcess() = 0;
virtual void pageClosed() = 0;
virtual void takeFocus(bool direction) = 0;
virtual void toolTipChanged(const String&, const String&) = 0;
......
......@@ -254,6 +254,7 @@ void WebPageProxy::close()
m_isClosed = true;
m_backForwardList->pageClosed();
m_pageClient->pageClosed();
process()->disconnectFramesFromPage(this);
m_mainFrame = 0;
......
......@@ -626,6 +626,10 @@ bool WebView::isViewInWindow()
return m_isInWindow;
}
void WebView::pageClosed()
{
}
void WebView::processDidCrash()
{
updateNativeCursor();
......
......@@ -116,6 +116,7 @@ private:
virtual bool isViewInWindow();
virtual void processDidCrash();
virtual void didRelaunchProcess();
virtual void pageClosed();
virtual void takeFocus(bool direction);
virtual void toolTipChanged(const WTF::String&, const WTF::String&);
virtual void setCursor(const WebCore::Cursor&);
......
Supports Markdown
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