| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 #include "public/web/WebWorkerContentSettingsClientProxy.h" | 70 #include "public/web/WebWorkerContentSettingsClientProxy.h" |
| 71 #include "web/LocalFileSystemClient.h" | 71 #include "web/LocalFileSystemClient.h" |
| 72 #include "web/WebDataSourceImpl.h" | 72 #include "web/WebDataSourceImpl.h" |
| 73 #include "web/WebLocalFrameImpl.h" | 73 #include "web/WebLocalFrameImpl.h" |
| 74 #include "web/WorkerContentSettingsClient.h" | 74 #include "web/WorkerContentSettingsClient.h" |
| 75 #include "wtf/Functional.h" | 75 #include "wtf/Functional.h" |
| 76 #include "wtf/MainThread.h" | 76 #include "wtf/MainThread.h" |
| 77 | 77 |
| 78 namespace blink { | 78 namespace blink { |
| 79 | 79 |
| 80 // TODO(toyoshim): Share implementation with WebEmbeddedWorkerImpl as much as |
| 81 // possible. |
| 80 // A thin wrapper for one-off script loading. | 82 // A thin wrapper for one-off script loading. |
| 81 class WebSharedWorkerImpl::Loader : public WorkerScriptLoaderClient { | 83 class WebSharedWorkerImpl::Loader : public WorkerScriptLoaderClient { |
| 82 public: | 84 public: |
| 83 static PassOwnPtr<Loader> create() | 85 static PassOwnPtr<Loader> create() |
| 84 { | 86 { |
| 85 return adoptPtr(new Loader()); | 87 return adoptPtr(new Loader()); |
| 86 } | 88 } |
| 87 | 89 |
| 88 virtual ~Loader() | 90 virtual ~Loader() |
| 89 { | 91 { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 ASSERT(m_webView); | 178 ASSERT(m_webView); |
| 177 // Detach the client before closing the view to avoid getting called back. | 179 // Detach the client before closing the view to avoid getting called back. |
| 178 m_mainFrame->setClient(0); | 180 m_mainFrame->setClient(0); |
| 179 | 181 |
| 180 m_webView->close(); | 182 m_webView->close(); |
| 181 m_mainFrame->close(); | 183 m_mainFrame->close(); |
| 182 if (m_loaderProxy) | 184 if (m_loaderProxy) |
| 183 m_loaderProxy->detachProvider(this); | 185 m_loaderProxy->detachProvider(this); |
| 184 } | 186 } |
| 185 | 187 |
| 188 // TODO(toyoshim): Rename to terminateWorkerThread(). |
| 186 void WebSharedWorkerImpl::stopWorkerThread() | 189 void WebSharedWorkerImpl::stopWorkerThread() |
| 187 { | 190 { |
| 188 if (m_askedToTerminate) | 191 if (m_askedToTerminate) |
| 189 return; | 192 return; |
| 190 m_askedToTerminate = true; | 193 m_askedToTerminate = true; |
| 191 if (m_mainScriptLoader) { | 194 if (m_mainScriptLoader) { |
| 192 m_mainScriptLoader->cancel(); | 195 m_mainScriptLoader->cancel(); |
| 193 m_mainScriptLoader.clear(); | 196 m_mainScriptLoader.clear(); |
| 194 if (client()) | 197 if (client()) |
| 195 client()->workerScriptLoadFailed(); | 198 client()->workerScriptLoadFailed(); |
| 196 delete this; | 199 delete this; |
| 197 return; | 200 return; |
| 198 } | 201 } |
| 199 if (m_workerThread) | 202 if (m_workerThread) |
| 200 m_workerThread->stop(); | 203 m_workerThread->terminate(); |
| 201 m_workerInspectorProxy->workerThreadTerminated(); | 204 m_workerInspectorProxy->workerThreadTerminated(); |
| 202 } | 205 } |
| 203 | 206 |
| 204 void WebSharedWorkerImpl::initializeLoader() | 207 void WebSharedWorkerImpl::initializeLoader() |
| 205 { | 208 { |
| 206 // Create 'shadow page'. This page is never displayed, it is used to proxy t
he | 209 // Create 'shadow page'. This page is never displayed, it is used to proxy t
he |
| 207 // loading requests from the worker context to the rest of WebKit and Chromi
um | 210 // loading requests from the worker context to the rest of WebKit and Chromi
um |
| 208 // infrastructure. | 211 // infrastructure. |
| 209 ASSERT(!m_webView); | 212 ASSERT(!m_webView); |
| 210 m_webView = WebView::create(0); | 213 m_webView = WebView::create(0); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 if (devtoolsAgent) | 477 if (devtoolsAgent) |
| 475 devtoolsAgent->dispatchOnInspectorBackend(message); | 478 devtoolsAgent->dispatchOnInspectorBackend(message); |
| 476 } | 479 } |
| 477 | 480 |
| 478 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) | 481 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) |
| 479 { | 482 { |
| 480 return new WebSharedWorkerImpl(client); | 483 return new WebSharedWorkerImpl(client); |
| 481 } | 484 } |
| 482 | 485 |
| 483 } // namespace blink | 486 } // namespace blink |
| OLD | NEW |