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

Unified Diff: Source/modules/serviceworkers/ServiceWorkerContainer.cpp

Issue 328663010: Simplify ServiceWorkerContainer's access to its window. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Bring patch to head. Created 6 years, 6 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/modules/serviceworkers/ServiceWorkerContainer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/serviceworkers/ServiceWorkerContainer.cpp
diff --git a/Source/modules/serviceworkers/ServiceWorkerContainer.cpp b/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
index 18c70a8ec0ec9b0261d954757091aa55cd99d39f..4f267bb9f662050552d3e7724c5fdfe9d89295a0 100644
--- a/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
+++ b/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
@@ -64,6 +64,7 @@ PassRefPtr<ServiceWorkerContainer> ServiceWorkerContainer::create(ExecutionConte
ServiceWorkerContainer::~ServiceWorkerContainer()
{
+ ASSERT(!m_provider);
}
void ServiceWorkerContainer::detachClient()
@@ -189,17 +190,16 @@ void ServiceWorkerContainer::setController(blink::WebServiceWorker* serviceWorke
void ServiceWorkerContainer::dispatchMessageEvent(const blink::WebString& message, const blink::WebMessagePortChannelArray& webChannels)
{
- if (!executionContext() || !window())
+ if (!executionContext() || !executionContext()->executingWindow())
return;
OwnPtr<MessagePortArray> ports = MessagePort::toMessagePortArray(executionContext(), webChannels);
RefPtr<SerializedScriptValue> value = SerializedScriptValue::createFromWire(message);
- window()->dispatchEvent(MessageEvent::create(ports.release(), value));
+ executionContext()->executingWindow()->dispatchEvent(MessageEvent::create(ports.release(), value));
}
ServiceWorkerContainer::ServiceWorkerContainer(ExecutionContext* executionContext)
: ContextLifecycleObserver(executionContext)
- , DOMWindowLifecycleObserver(executionContext->isDocument() ? toDocument(executionContext)->domWindow() : 0)
, m_provider(0)
{
ScriptWrappable::init(this);
« no previous file with comments | « Source/modules/serviceworkers/ServiceWorkerContainer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698