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

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: Fix lifetime on frame detach 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
« no previous file with comments | « Source/web/WebSharedWorkerImpl.h ('k') | Source/web/WebViewImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebSharedWorkerImpl.cpp
diff --git a/Source/web/WebSharedWorkerImpl.cpp b/Source/web/WebSharedWorkerImpl.cpp
index be97906b1cf54de646abbf776bdcbadfc0292b39..4fe8d24f82ebaac53eb132eeb5a508a859806600 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->setMainFrame(m_mainFrame);
WebFrameImpl* webFrame = toWebFrameImpl(m_webView->mainFrame());
« no previous file with comments | « Source/web/WebSharedWorkerImpl.h ('k') | Source/web/WebViewImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698