| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "modules/worklet/Worklet.h" | 5 #include "modules/worklet/Worklet.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptPromiseResolver.h" | 7 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 8 #include "bindings/core/v8/ScriptSourceCode.h" | 8 #include "bindings/core/v8/ScriptSourceCode.h" |
| 9 #include "bindings/core/v8/V8Binding.h" | 9 #include "bindings/core/v8/V8Binding.h" |
| 10 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" | 10 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 ScriptPromise promise = resolver->promise(); | 44 ScriptPromise promise = resolver->promise(); |
| 45 | 45 |
| 46 // TODO(ikilpatrick): WorkerScriptLoader will need to be extended to allow | 46 // TODO(ikilpatrick): WorkerScriptLoader will need to be extended to allow |
| 47 // module loading support. For now just fetch a 'classic' script. | 47 // module loading support. For now just fetch a 'classic' script. |
| 48 | 48 |
| 49 // NOTE: WorkerScriptLoader may synchronously invoke its callbacks | 49 // NOTE: WorkerScriptLoader may synchronously invoke its callbacks |
| 50 // (resolving the promise) before we return it. | 50 // (resolving the promise) before we return it. |
| 51 m_scriptLoaders.append(WorkerScriptLoader::create()); | 51 m_scriptLoaders.append(WorkerScriptLoader::create()); |
| 52 m_scriptLoaders.last()->loadAsynchronously(*executionContext(), scriptURL, D
enyCrossOriginRequests, | 52 m_scriptLoaders.last()->loadAsynchronously(*executionContext(), scriptURL, D
enyCrossOriginRequests, |
| 53 executionContext()->securityContext().addressSpace(), |
| 53 bind(&Worklet::onResponse, this), | 54 bind(&Worklet::onResponse, this), |
| 54 bind(&Worklet::onFinished, this, m_scriptLoaders.last().get(), resolver)
); | 55 bind(&Worklet::onFinished, this, m_scriptLoaders.last().get(), resolver)
); |
| 55 | 56 |
| 56 return promise; | 57 return promise; |
| 57 } | 58 } |
| 58 | 59 |
| 59 void Worklet::onResponse() | 60 void Worklet::onResponse() |
| 60 { | 61 { |
| 61 // TODO(ikilpatrick): Add devtools instrumentation on worklet script | 62 // TODO(ikilpatrick): Add devtools instrumentation on worklet script |
| 62 // resource loading. | 63 // resource loading. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 93 } | 94 } |
| 94 | 95 |
| 95 DEFINE_TRACE(Worklet) | 96 DEFINE_TRACE(Worklet) |
| 96 { | 97 { |
| 97 visitor->trace(m_resolvers); | 98 visitor->trace(m_resolvers); |
| 98 visitor->trace(m_workletGlobalScope); | 99 visitor->trace(m_workletGlobalScope); |
| 99 ActiveDOMObject::trace(visitor); | 100 ActiveDOMObject::trace(visitor); |
| 100 } | 101 } |
| 101 | 102 |
| 102 } // namespace blink | 103 } // namespace blink |
| OLD | NEW |