Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(589)

Unified Diff: third_party/WebKit/Source/core/dom/Modulator.cpp

Issue 2826803004: [ES6 modules] Introduce ModulatorImpl (Closed)
Patch Set: no double private Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/dom/BUILD.gn ('k') | third_party/WebKit/Source/core/dom/ModulatorImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Modulator.cpp
diff --git a/third_party/WebKit/Source/core/dom/Modulator.cpp b/third_party/WebKit/Source/core/dom/Modulator.cpp
index c48775ff2481038bef93b02e86053b5c34bb2afb..56abb8278fdaacf415a93effbf7a01f2dc43b483 100644
--- a/third_party/WebKit/Source/core/dom/Modulator.cpp
+++ b/third_party/WebKit/Source/core/dom/Modulator.cpp
@@ -6,6 +6,10 @@
#include "bindings/core/v8/ScriptState.h"
#include "bindings/core/v8/V8Binding.h"
+#include "bindings/core/v8/V8PerContextData.h"
+#include "core/dom/Document.h"
+#include "core/dom/ModulatorImpl.h"
+#include "core/frame/LocalFrame.h"
namespace blink {
@@ -16,10 +20,20 @@ const char kPerContextDataKey[] = "Modulator";
Modulator* Modulator::From(ScriptState* script_state) {
if (!script_state)
return nullptr;
+
V8PerContextData* per_context_data = script_state->PerContextData();
if (!per_context_data)
return nullptr;
- return static_cast<Modulator*>(per_context_data->GetData(kPerContextDataKey));
+
+ Modulator* modulator =
+ static_cast<Modulator*>(per_context_data->GetData(kPerContextDataKey));
+ if (!modulator) {
+ if (Document* document = ToDocument(ExecutionContext::From(script_state))) {
+ modulator = ModulatorImpl::Create(script_state, *document);
+ Modulator::SetModulator(script_state, modulator);
+ }
+ }
+ return modulator;
}
Modulator::~Modulator() {}
« no previous file with comments | « third_party/WebKit/Source/core/dom/BUILD.gn ('k') | third_party/WebKit/Source/core/dom/ModulatorImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698