| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/workers/InProcessWorkerBase.h" | 5 #include "core/workers/InProcessWorkerBase.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
| 10 #include "core/events/MessageEvent.h" | 10 #include "core/events/MessageEvent.h" |
| 11 #include "core/frame/csp/ContentSecurityPolicy.h" | |
| 12 #include "core/inspector/InspectorInstrumentation.h" | 11 #include "core/inspector/InspectorInstrumentation.h" |
| 13 #include "core/workers/InProcessWorkerMessagingProxy.h" | 12 #include "core/workers/InProcessWorkerMessagingProxy.h" |
| 14 #include "core/workers/WorkerScriptLoader.h" | 13 #include "core/workers/WorkerScriptLoader.h" |
| 15 #include "platform/loader/fetch/ResourceFetcher.h" | 14 #include "platform/loader/fetch/ResourceFetcher.h" |
| 16 | 15 |
| 17 namespace blink { | 16 namespace blink { |
| 18 | 17 |
| 19 InProcessWorkerBase::InProcessWorkerBase(ExecutionContext* context) | 18 InProcessWorkerBase::InProcessWorkerBase(ExecutionContext* context) |
| 20 : AbstractWorker(context), | 19 : AbstractWorker(context), |
| 21 m_contextProxy(nullptr) {} | 20 m_contextProxy(nullptr) {} |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 92 |
| 94 void InProcessWorkerBase::onFinished() { | 93 void InProcessWorkerBase::onFinished() { |
| 95 if (m_scriptLoader->canceled()) { | 94 if (m_scriptLoader->canceled()) { |
| 96 // Do nothing. | 95 // Do nothing. |
| 97 } else if (m_scriptLoader->failed()) { | 96 } else if (m_scriptLoader->failed()) { |
| 98 dispatchEvent(Event::createCancelable(EventTypeNames::error)); | 97 dispatchEvent(Event::createCancelable(EventTypeNames::error)); |
| 99 } else { | 98 } else { |
| 100 m_contextProxy->startWorkerGlobalScope( | 99 m_contextProxy->startWorkerGlobalScope( |
| 101 m_scriptLoader->url(), getExecutionContext()->userAgent(), | 100 m_scriptLoader->url(), getExecutionContext()->userAgent(), |
| 102 m_scriptLoader->script(), | 101 m_scriptLoader->script(), |
| 103 m_scriptLoader->releaseContentSecurityPolicy(), | |
| 104 m_scriptLoader->getReferrerPolicy()); | 102 m_scriptLoader->getReferrerPolicy()); |
| 105 probe::scriptImported(getExecutionContext(), m_scriptLoader->identifier(), | 103 probe::scriptImported(getExecutionContext(), m_scriptLoader->identifier(), |
| 106 m_scriptLoader->script()); | 104 m_scriptLoader->script()); |
| 107 } | 105 } |
| 108 m_scriptLoader = nullptr; | 106 m_scriptLoader = nullptr; |
| 109 } | 107 } |
| 110 | 108 |
| 111 DEFINE_TRACE(InProcessWorkerBase) { | 109 DEFINE_TRACE(InProcessWorkerBase) { |
| 112 AbstractWorker::trace(visitor); | 110 AbstractWorker::trace(visitor); |
| 113 } | 111 } |
| 114 | 112 |
| 115 } // namespace blink | 113 } // namespace blink |
| OLD | NEW |