Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/ModuleScript.cpp |
| diff --git a/third_party/WebKit/Source/core/dom/ModuleScript.cpp b/third_party/WebKit/Source/core/dom/ModuleScript.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b918a50976d7e5a48a0e01e946c1509a263e76e8 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/dom/ModuleScript.cpp |
| @@ -0,0 +1,27 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "core/dom/ModuleScript.h" |
| + |
| +namespace blink { |
| + |
| +void ModuleScript::updateStateAfterInstantiation(ScriptValue maybeError) { |
|
domenic
2017/01/19 05:23:59
This method seems redundant. It is only used once
|
| + DCHECK_EQ(m_instantiationState, InstantiationState::Uninstantiated); |
| + m_instantiationState = maybeError.isEmpty() ? InstantiationState::Instantiated |
| + : InstantiationState::Errored; |
| + m_instantiationError = maybeError; |
| +} |
| + |
| +void ModuleScript::propagateUpstreamError(ScriptValue error) { |
|
domenic
2017/01/19 05:23:59
Ideally these would have unit tests. Not sure what
|
| + DCHECK_EQ(m_instantiationState, InstantiationState::Uninstantiated); |
| + m_instantiationState = InstantiationState::Errored; |
| + m_instantiationError = error; |
| +} |
| + |
| +void ModuleScript::propagateUpstreamSuccess() { |
| + DCHECK_EQ(m_instantiationState, InstantiationState::Uninstantiated); |
| + m_instantiationState = InstantiationState::Instantiated; |
| +} |
| + |
| +} // namespace blink |