| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 #include "platform/weborigin/KURL.h" | 56 #include "platform/weborigin/KURL.h" |
| 57 #include "platform/weborigin/SecurityOrigin.h" | 57 #include "platform/weborigin/SecurityOrigin.h" |
| 58 #include "public/platform/Platform.h" | 58 #include "public/platform/Platform.h" |
| 59 #include "public/platform/WebFileError.h" | 59 #include "public/platform/WebFileError.h" |
| 60 #include "public/platform/WebMessagePortChannel.h" | 60 #include "public/platform/WebMessagePortChannel.h" |
| 61 #include "public/platform/WebString.h" | 61 #include "public/platform/WebString.h" |
| 62 #include "public/platform/WebURL.h" | 62 #include "public/platform/WebURL.h" |
| 63 #include "public/platform/WebURLRequest.h" | 63 #include "public/platform/WebURLRequest.h" |
| 64 #include "public/web/WebDevToolsAgent.h" | 64 #include "public/web/WebDevToolsAgent.h" |
| 65 #include "public/web/WebFrame.h" | 65 #include "public/web/WebFrame.h" |
| 66 #include "public/web/WebFrameWidget.h" |
| 66 #include "public/web/WebSettings.h" | 67 #include "public/web/WebSettings.h" |
| 67 #include "public/web/WebView.h" | 68 #include "public/web/WebView.h" |
| 68 #include "public/web/WebWorkerContentSettingsClientProxy.h" | 69 #include "public/web/WebWorkerContentSettingsClientProxy.h" |
| 69 #include "public/web/modules/serviceworker/WebServiceWorkerNetworkProvider.h" | 70 #include "public/web/modules/serviceworker/WebServiceWorkerNetworkProvider.h" |
| 70 #include "web/IndexedDBClientImpl.h" | 71 #include "web/IndexedDBClientImpl.h" |
| 71 #include "web/LocalFileSystemClient.h" | 72 #include "web/LocalFileSystemClient.h" |
| 72 #include "web/WebDataSourceImpl.h" | 73 #include "web/WebDataSourceImpl.h" |
| 73 #include "web/WebLocalFrameImpl.h" | 74 #include "web/WebLocalFrameImpl.h" |
| 74 #include "web/WorkerContentSettingsClient.h" | 75 #include "web/WorkerContentSettingsClient.h" |
| 75 #include "wtf/Functional.h" | 76 #include "wtf/Functional.h" |
| 76 #include "wtf/PtrUtil.h" | 77 #include "wtf/PtrUtil.h" |
| 77 #include <memory> | 78 #include <memory> |
| 78 | 79 |
| 79 namespace blink { | 80 namespace blink { |
| 80 | 81 |
| 81 // TODO(toyoshim): Share implementation with WebEmbeddedWorkerImpl as much as | 82 // TODO(toyoshim): Share implementation with WebEmbeddedWorkerImpl as much as |
| 82 // possible. | 83 // possible. |
| 83 | 84 |
| 84 WebSharedWorkerImpl::WebSharedWorkerImpl(WebSharedWorkerClient* client) | 85 WebSharedWorkerImpl::WebSharedWorkerImpl(WebSharedWorkerClient* client) |
| 85 : m_webView(nullptr) | 86 : m_webView(nullptr) |
| 87 , m_webFrameWidget(nullptr) |
| 86 , m_mainFrame(nullptr) | 88 , m_mainFrame(nullptr) |
| 87 , m_askedToTerminate(false) | 89 , m_askedToTerminate(false) |
| 88 , m_workerInspectorProxy(WorkerInspectorProxy::create()) | 90 , m_workerInspectorProxy(WorkerInspectorProxy::create()) |
| 89 , m_client(client) | 91 , m_client(client) |
| 90 , m_pauseWorkerContextOnStart(false) | 92 , m_pauseWorkerContextOnStart(false) |
| 91 , m_isPausedOnStart(false) | 93 , m_isPausedOnStart(false) |
| 92 , m_creationAddressSpace(WebAddressSpacePublic) | 94 , m_creationAddressSpace(WebAddressSpacePublic) |
| 93 { | 95 { |
| 94 } | 96 } |
| 95 | 97 |
| 96 WebSharedWorkerImpl::~WebSharedWorkerImpl() | 98 WebSharedWorkerImpl::~WebSharedWorkerImpl() |
| 97 { | 99 { |
| 98 DCHECK(m_webView); | 100 DCHECK(m_webView); |
| 99 // Detach the client before closing the view to avoid getting called back. | 101 // Detach the client before closing the view to avoid getting called back. |
| 100 m_mainFrame->setClient(0); | 102 m_mainFrame->setClient(0); |
| 101 | 103 |
| 104 m_webFrameWidget->close(); |
| 102 m_webView->close(); | 105 m_webView->close(); |
| 103 m_mainFrame->close(); | 106 m_mainFrame->close(); |
| 104 if (m_loaderProxy) | 107 if (m_loaderProxy) |
| 105 m_loaderProxy->detachProvider(this); | 108 m_loaderProxy->detachProvider(this); |
| 106 } | 109 } |
| 107 | 110 |
| 108 void WebSharedWorkerImpl::terminateWorkerThread() | 111 void WebSharedWorkerImpl::terminateWorkerThread() |
| 109 { | 112 { |
| 110 if (m_askedToTerminate) | 113 if (m_askedToTerminate) |
| 111 return; | 114 return; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 130 DCHECK(!m_webView); | 133 DCHECK(!m_webView); |
| 131 m_webView = WebView::create(nullptr, WebPageVisibilityStateVisible); | 134 m_webView = WebView::create(nullptr, WebPageVisibilityStateVisible); |
| 132 // FIXME: http://crbug.com/363843. This needs to find a better way to | 135 // FIXME: http://crbug.com/363843. This needs to find a better way to |
| 133 // not create graphics layers. | 136 // not create graphics layers. |
| 134 m_webView->settings()->setAcceleratedCompositingEnabled(false); | 137 m_webView->settings()->setAcceleratedCompositingEnabled(false); |
| 135 // FIXME: Settings information should be passed to the Worker process from B
rowser process when the worker | 138 // FIXME: Settings information should be passed to the Worker process from B
rowser process when the worker |
| 136 // is created (similar to RenderThread::OnCreateNewView). | 139 // is created (similar to RenderThread::OnCreateNewView). |
| 137 m_mainFrame = toWebLocalFrameImpl(WebLocalFrame::create(WebTreeScopeType::Do
cument, this)); | 140 m_mainFrame = toWebLocalFrameImpl(WebLocalFrame::create(WebTreeScopeType::Do
cument, this)); |
| 138 m_webView->setMainFrame(m_mainFrame.get()); | 141 m_webView->setMainFrame(m_mainFrame.get()); |
| 139 m_mainFrame->setDevToolsAgentClient(this); | 142 m_mainFrame->setDevToolsAgentClient(this); |
| 143 m_webFrameWidget = WebFrameWidget::create(this, m_webView, m_mainFrame); |
| 140 | 144 |
| 141 // If we were asked to pause worker context on start and wait for debugger t
hen it is the good time to do that. | 145 // If we were asked to pause worker context on start and wait for debugger t
hen it is the good time to do that. |
| 142 m_client->workerReadyForInspection(); | 146 m_client->workerReadyForInspection(); |
| 143 if (m_pauseWorkerContextOnStart) { | 147 if (m_pauseWorkerContextOnStart) { |
| 144 m_isPausedOnStart = true; | 148 m_isPausedOnStart = true; |
| 145 return; | 149 return; |
| 146 } | 150 } |
| 147 loadShadowPage(); | 151 loadShadowPage(); |
| 148 } | 152 } |
| 149 | 153 |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 if (devtoolsAgent) | 415 if (devtoolsAgent) |
| 412 devtoolsAgent->dispatchOnInspectorBackend(sessionId, callId, method, mes
sage); | 416 devtoolsAgent->dispatchOnInspectorBackend(sessionId, callId, method, mes
sage); |
| 413 } | 417 } |
| 414 | 418 |
| 415 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) | 419 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) |
| 416 { | 420 { |
| 417 return new WebSharedWorkerImpl(client); | 421 return new WebSharedWorkerImpl(client); |
| 418 } | 422 } |
| 419 | 423 |
| 420 } // namespace blink | 424 } // namespace blink |
| OLD | NEW |