Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1724)

Unified Diff: Source/web/WebSharedWorkerImpl.cpp

Issue 23506013: Make the embedder responsible for creating the WebFrame (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add WebViewHelper for unittests. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/web/WebSharedWorkerImpl.cpp
diff --git a/Source/web/WebSharedWorkerImpl.cpp b/Source/web/WebSharedWorkerImpl.cpp
index 7ebf42246e834898236cad95c032fc3aaf10ab29..abc2447e1ec2ddcc6d31becfe2f4255e7af6f64b 100644
--- a/Source/web/WebSharedWorkerImpl.cpp
+++ b/Source/web/WebSharedWorkerImpl.cpp
@@ -92,6 +92,7 @@ static void initializeWebKitStaticValues()
WebSharedWorkerImpl::WebSharedWorkerImpl(WebSharedWorkerClient* client)
: m_webView(0)
+ , m_mainFrame(0)
, m_askedToTerminate(false)
, m_client(client)
, m_pauseWorkerContextOnStart(false)
@@ -102,10 +103,11 @@ WebSharedWorkerImpl::WebSharedWorkerImpl(WebSharedWorkerClient* client)
WebSharedWorkerImpl::~WebSharedWorkerImpl()
{
ASSERT(m_webView);
- WebFrameImpl* webFrame = toWebFrameImpl(m_webView->mainFrame());
- if (webFrame)
- webFrame->setClient(0);
+ // Detach the client before closing the view to avoid getting called back.
+ toWebFrameImpl(m_mainFrame)->setClient(0);
+
m_webView->close();
+ m_mainFrame->close();
}
void WebSharedWorkerImpl::stopWorkerThread()
@@ -127,7 +129,8 @@ void WebSharedWorkerImpl::initializeLoader(const WebURL& url)
m_webView->settings()->setOfflineWebApplicationCacheEnabled(WebRuntimeFeatures::isApplicationCacheEnabled());
// FIXME: Settings information should be passed to the Worker process from Browser process when the worker
// is created (similar to RenderThread::OnCreateNewView).
- m_webView->initializeMainFrame(this);
+ m_mainFrame = WebFrame::create(this);
+ m_webView->initializeMainFrame(m_mainFrame);
WebFrameImpl* webFrame = toWebFrameImpl(m_webView->mainFrame());

Powered by Google App Engine
This is Rietveld 408576698