2010-11-08 John Knottenbelt <jknotten@chromium.org>

        Reviewed by Kent Tamura.

        WebViewHost::reset() uses placement new.
        https://bugs.webkit.org/show_bug.cgi?id=49069

        WebViewHost is using placement destruction / new to simulate a fresh
        WebViewHost object at the same address. This is because the WebView remains
        open across tests and maintains a pointer to the WebViewHost.
        This change resets member variables explictly instead of the placement new dance.

        * DumpRenderTree/chromium/WebViewHost.cpp:
        (WebViewHost::WebViewHost):
        (WebViewHost::reset):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71597 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ce484f7d
2010-11-08 John Knottenbelt <jknotten@chromium.org>
Reviewed by Kent Tamura.
WebViewHost::reset() uses placement new.
https://bugs.webkit.org/show_bug.cgi?id=49069
WebViewHost is using placement destruction / new to simulate a fresh
WebViewHost object at the same address. This is because the WebView remains
open across tests and maintains a pointer to the WebViewHost.
This change resets member variables explictly instead of the placement new dance.
* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::WebViewHost):
(WebViewHost::reset):
2010-11-08 Dirk Pranke <dpranke@chromium.org>
Reviewed by Eric Seidel.
......
......@@ -1066,27 +1066,10 @@ void WebViewHost::openFileSystem(WebFrame* frame, WebFileSystem::Type type, long
// Public functions -----------------------------------------------------------
WebViewHost::WebViewHost(TestShell* shell)
: m_policyDelegateEnabled(false)
, m_policyDelegateIsPermissive(false)
, m_policyDelegateShouldNotifyDone(false)
, m_shell(shell)
: m_shell(shell)
, m_webWidget(0)
, m_topLoadingFrame(0)
, m_pageId(-1)
, m_lastPageIdUpdated(-1)
, m_hasWindow(false)
, m_inModalLoop(false)
, m_smartInsertDeleteEnabled(true)
#if OS(WINDOWS)
, m_selectTrailingWhitespaceEnabled(true)
#else
, m_selectTrailingWhitespaceEnabled(false)
#endif
, m_blocksRedirects(false)
, m_requestReturnNull(false)
, m_isPainting(false)
{
m_navigationController.set(new TestNavigationController(this));
reset();
}
WebViewHost::~WebViewHost()
......@@ -1108,13 +1091,43 @@ WebWidget* WebViewHost::webWidget() const
void WebViewHost::reset()
{
// Do a little placement new dance...
TestShell* shell = m_shell;
WebWidget* widget = m_webWidget;
this->~WebViewHost();
new (this) WebViewHost(shell);
setWebWidget(widget);
webView()->mainFrame()->setName(WebString());
m_policyDelegateEnabled = false;
m_policyDelegateIsPermissive = false;
m_policyDelegateShouldNotifyDone = false;
m_topLoadingFrame = 0;
m_pageId = -1;
m_lastPageIdUpdated = -1;
m_hasWindow = false;
m_inModalLoop = false;
m_smartInsertDeleteEnabled = true;
#if OS(WINDOWS)
m_selectTrailingWhitespaceEnabled = true;
#else
m_selectTrailingWhitespaceEnabled = false;
#endif
m_blocksRedirects = false;
m_requestReturnNull = false;
m_isPainting = false;
m_canvas.clear();
m_navigationController.set(new TestNavigationController(this));
m_pendingExtraData.clear();
m_resourceIdentifierMap.clear();
m_clearHeaders.clear();
m_editCommandName.clear();
m_editCommandValue.clear();
#if !ENABLE(CLIENT_BASED_GEOLOCATION)
m_geolocationServiceMock.clear();
#endif
m_currentCursor = WebCursorInfo();
m_windowRect = WebRect();
m_paintRect = WebRect();
if (m_webWidget)
webView()->mainFrame()->setName(WebString());
}
void WebViewHost::setSelectTrailingWhitespaceEnabled(bool enabled)
......
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