| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/dom/Modulator.h" | 5 #include "core/dom/Modulator.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptState.h" | 7 #include "bindings/core/v8/ScriptState.h" |
| 8 #include "bindings/core/v8/V8Binding.h" |
| 8 | 9 |
| 9 namespace blink { | 10 namespace blink { |
| 10 | 11 |
| 11 Modulator* Modulator::from(LocalFrame* frame) { | 12 Modulator* Modulator::from(LocalFrame* frame) { |
| 12 ScriptState* scriptState = ScriptState::forMainWorld(frame); | 13 ScriptState* scriptState = toScriptStateForMainWorld(frame); |
| 13 if (!scriptState) | 14 if (!scriptState) |
| 14 return nullptr; | 15 return nullptr; |
| 15 // TODO(kouhei): setModulator in V8PerContextData when we land ModulatorImpl. | 16 // TODO(kouhei): setModulator in V8PerContextData when we land ModulatorImpl. |
| 16 return scriptState->perContextData()->modulator(); | 17 return scriptState->perContextData()->modulator(); |
| 17 } | 18 } |
| 18 | 19 |
| 19 Modulator::~Modulator() {} | 20 Modulator::~Modulator() {} |
| 20 | 21 |
| 21 KURL Modulator::resolveModuleSpecifier(const String& moduleRequest, | 22 KURL Modulator::resolveModuleSpecifier(const String& moduleRequest, |
| 22 const KURL& baseURL) { | 23 const KURL& baseURL) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 38 // script's base URL as the base URL. | 39 // script's base URL as the base URL. |
| 39 DCHECK(baseURL.isValid()); | 40 DCHECK(baseURL.isValid()); |
| 40 KURL absoluteURL(baseURL, moduleRequest); | 41 KURL absoluteURL(baseURL, moduleRequest); |
| 41 if (absoluteURL.isValid()) | 42 if (absoluteURL.isValid()) |
| 42 return absoluteURL; | 43 return absoluteURL; |
| 43 | 44 |
| 44 return KURL(); | 45 return KURL(); |
| 45 } | 46 } |
| 46 | 47 |
| 47 } // namespace blink | 48 } // namespace blink |
| OLD | NEW |