OLD | NEW |
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "core/workers/WorkerLoaderProxy.h" | 44 #include "core/workers/WorkerLoaderProxy.h" |
45 #include "core/workers/WorkerScriptLoader.h" | 45 #include "core/workers/WorkerScriptLoader.h" |
46 #include "core/workers/WorkerScriptLoaderClient.h" | 46 #include "core/workers/WorkerScriptLoaderClient.h" |
47 #include "core/workers/WorkerThreadStartupData.h" | 47 #include "core/workers/WorkerThreadStartupData.h" |
48 #include "modules/serviceworkers/ServiceWorkerThread.h" | 48 #include "modules/serviceworkers/ServiceWorkerThread.h" |
49 #include "platform/SharedBuffer.h" | 49 #include "platform/SharedBuffer.h" |
50 #include "platform/heap/Handle.h" | 50 #include "platform/heap/Handle.h" |
51 #include "platform/network/ContentSecurityPolicyParsers.h" | 51 #include "platform/network/ContentSecurityPolicyParsers.h" |
52 #include "public/platform/Platform.h" | 52 #include "public/platform/Platform.h" |
53 #include "public/platform/WebURLRequest.h" | 53 #include "public/platform/WebURLRequest.h" |
| 54 #include "public/platform/WebWaitableEvent.h" |
54 #include "public/web/WebDevToolsAgent.h" | 55 #include "public/web/WebDevToolsAgent.h" |
55 #include "public/web/WebServiceWorkerContextClient.h" | 56 #include "public/web/WebServiceWorkerContextClient.h" |
56 #include "public/web/WebServiceWorkerNetworkProvider.h" | 57 #include "public/web/WebServiceWorkerNetworkProvider.h" |
57 #include "public/web/WebSettings.h" | 58 #include "public/web/WebSettings.h" |
58 #include "public/web/WebView.h" | 59 #include "public/web/WebView.h" |
59 #include "public/web/WebWorkerPermissionClientProxy.h" | 60 #include "public/web/WebWorkerPermissionClientProxy.h" |
60 #include "web/ServiceWorkerGlobalScopeClientImpl.h" | 61 #include "web/ServiceWorkerGlobalScopeClientImpl.h" |
61 #include "web/ServiceWorkerGlobalScopeProxy.h" | 62 #include "web/ServiceWorkerGlobalScopeProxy.h" |
62 #include "web/WebDataSourceImpl.h" | 63 #include "web/WebDataSourceImpl.h" |
63 #include "web/WebLocalFrameImpl.h" | 64 #include "web/WebLocalFrameImpl.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 , m_mainFrame(0) | 165 , m_mainFrame(0) |
165 , m_askedToTerminate(false) | 166 , m_askedToTerminate(false) |
166 , m_pauseAfterDownloadState(DontPauseAfterDownload) | 167 , m_pauseAfterDownloadState(DontPauseAfterDownload) |
167 , m_waitingForDebuggerState(NotWaitingForDebugger) | 168 , m_waitingForDebuggerState(NotWaitingForDebugger) |
168 { | 169 { |
169 runningWorkerInstances().add(this); | 170 runningWorkerInstances().add(this); |
170 } | 171 } |
171 | 172 |
172 WebEmbeddedWorkerImpl::~WebEmbeddedWorkerImpl() | 173 WebEmbeddedWorkerImpl::~WebEmbeddedWorkerImpl() |
173 { | 174 { |
| 175 if (m_workerThread) { |
| 176 ASSERT(m_workerThread->terminated()); |
| 177 m_workerThread->terminationEvent()->wait(); |
| 178 } |
| 179 |
174 ASSERT(runningWorkerInstances().contains(this)); | 180 ASSERT(runningWorkerInstances().contains(this)); |
175 runningWorkerInstances().remove(this); | 181 runningWorkerInstances().remove(this); |
176 ASSERT(m_webView); | 182 ASSERT(m_webView); |
177 | 183 |
178 // Detach the client before closing the view to avoid getting called back. | 184 // Detach the client before closing the view to avoid getting called back. |
179 toWebLocalFrameImpl(m_mainFrame)->setClient(0); | 185 toWebLocalFrameImpl(m_mainFrame)->setClient(0); |
180 | 186 |
181 m_webView->close(); | 187 m_webView->close(); |
182 m_mainFrame->close(); | 188 m_mainFrame->close(); |
183 } | 189 } |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 m_mainScriptLoader.clear(); | 426 m_mainScriptLoader.clear(); |
421 | 427 |
422 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc
ument, *m_workerContextClient); | 428 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc
ument, *m_workerContextClient); |
423 m_loaderProxy = LoaderProxy::create(*this); | 429 m_loaderProxy = LoaderProxy::create(*this); |
424 m_workerThread = ServiceWorkerThread::create(*m_loaderProxy, *m_workerGlobal
ScopeProxy, startupData.release()); | 430 m_workerThread = ServiceWorkerThread::create(*m_loaderProxy, *m_workerGlobal
ScopeProxy, startupData.release()); |
425 m_workerThread->start(); | 431 m_workerThread->start(); |
426 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(),
scriptURL); | 432 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(),
scriptURL); |
427 } | 433 } |
428 | 434 |
429 } // namespace blink | 435 } // namespace blink |
OLD | NEW |