[Webkit-unassigned] [Bug 49069] WebViewHost::reset() uses placement new.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Nov 5 07:30:56 PDT 2010


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





--- Comment #1 from John Knottenbelt <jknotten at chromium.org>  2010-11-05 07:30:56 PST ---
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. 

The use of placement new makes it difficult to add new mocks such as
DeviceOrientationClientMock (see bug ...)  to the WebViewHost, because the
WebView's page controllers maintain pointers to their respective clients, which
indirectly point back to the mocks. For this reason, the mock clients must
keep their addresses across calls to WebViewHost::reset(). 

If we keep the placement new dance, we will have to add code such as:
PassOwnPtr deviceOrientationClientMock = m_deviceOrientationClientMock.release();
...
this->WebViewHost();
new (this) WebViewHost(shell)
...
m_deviceOrientationClientMock = deviceOrientationClientMock;

This seems quite cumbersome, so I propose resetting the member variables that
need it instead (patch attached). Alternatively, we could completely destroy
both the WebView and the WebViewHost and create fresh ones for each
test. However, doing that might slow down the test suite, as well as change the
way that tests can interfere with each other, possibly reducing the number of
bugs that we can discover.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list