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

Side by Side Diff: Source/web/WebEmbeddedWorkerImpl.cpp

Issue 684223004: ServiceWorker: Fix data race in shutdown sequence (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 , m_mainFrame(0) 164 , m_mainFrame(0)
165 , m_askedToTerminate(false) 165 , m_askedToTerminate(false)
166 , m_pauseAfterDownloadState(DontPauseAfterDownload) 166 , m_pauseAfterDownloadState(DontPauseAfterDownload)
167 , m_waitingForDebuggerState(NotWaitingForDebugger) 167 , m_waitingForDebuggerState(NotWaitingForDebugger)
168 { 168 {
169 runningWorkerInstances().add(this); 169 runningWorkerInstances().add(this);
170 } 170 }
171 171
172 WebEmbeddedWorkerImpl::~WebEmbeddedWorkerImpl() 172 WebEmbeddedWorkerImpl::~WebEmbeddedWorkerImpl()
173 { 173 {
174 if (m_workerThread)
175 m_workerThread->terminateAndWait();
176
174 ASSERT(runningWorkerInstances().contains(this)); 177 ASSERT(runningWorkerInstances().contains(this));
175 runningWorkerInstances().remove(this); 178 runningWorkerInstances().remove(this);
176 ASSERT(m_webView); 179 ASSERT(m_webView);
177 180
178 // Detach the client before closing the view to avoid getting called back. 181 // Detach the client before closing the view to avoid getting called back.
179 toWebLocalFrameImpl(m_mainFrame)->setClient(0); 182 toWebLocalFrameImpl(m_mainFrame)->setClient(0);
180 183
181 m_webView->close(); 184 m_webView->close();
182 m_mainFrame->close(); 185 m_mainFrame->close();
183 } 186 }
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 m_mainScriptLoader.clear(); 423 m_mainScriptLoader.clear();
421 424
422 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc ument, *m_workerContextClient); 425 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc ument, *m_workerContextClient);
423 m_loaderProxy = LoaderProxy::create(*this); 426 m_loaderProxy = LoaderProxy::create(*this);
424 m_workerThread = ServiceWorkerThread::create(*m_loaderProxy, *m_workerGlobal ScopeProxy, startupData.release()); 427 m_workerThread = ServiceWorkerThread::create(*m_loaderProxy, *m_workerGlobal ScopeProxy, startupData.release());
425 m_workerThread->start(); 428 m_workerThread->start();
426 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(), scriptURL); 429 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(), scriptURL);
427 } 430 }
428 431
429 } // namespace blink 432 } // namespace blink
OLDNEW
« Source/core/workers/WorkerThread.cpp ('K') | « Source/core/workers/WorkerThread.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698