Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef ScriptModule_h | |
| 6 #define ScriptModule_h | |
| 7 | |
| 8 #include "bindings/core/v8/ScriptState.h" | |
| 9 #include "bindings/core/v8/SharedPersistent.h" | |
| 10 #include "core/CoreExport.h" | |
| 11 #include "wtf/Allocator.h" | |
| 12 #include "wtf/text/WTFString.h" | |
| 13 #include <v8.h> | |
| 14 | |
| 15 namespace blink { | |
| 16 | |
| 17 class CORE_EXPORT ScriptModule final { | |
|
dominicc (has gone to gerrit)
2016/12/13 07:45:29
Comments would be nice, so we don't have to dig th
| |
| 18 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | |
| 19 | |
| 20 public: | |
| 21 static ScriptModule compile(v8::Isolate*, | |
|
dominicc (has gone to gerrit)
2016/12/13 07:45:29
I've gotten feedback from the bindings team in the
| |
| 22 const String& source, | |
| 23 const String& fileName); | |
|
dominicc (has gone to gerrit)
2016/12/13 07:45:29
It may make sense to use a parameter object instea
| |
| 24 | |
| 25 ScriptModule() {} | |
| 26 ScriptModule(const ScriptModule& module) : m_module(module.m_module) {} | |
| 27 ~ScriptModule(); | |
| 28 | |
| 29 bool instantiate(ScriptState*); | |
| 30 void evaluate(ScriptState*); | |
| 31 | |
| 32 bool isNull() const { return m_module->isEmpty(); } | |
| 33 | |
| 34 private: | |
| 35 ScriptModule(v8::Isolate*, v8::Local<v8::Module>); | |
| 36 | |
| 37 RefPtr<SharedPersistent<v8::Module>> m_module; | |
|
dominicc (has gone to gerrit)
2016/12/13 07:45:29
Hmm, I guess this doesn't cause cycles because the
| |
| 38 }; | |
| 39 | |
| 40 } // namespace blink | |
| 41 | |
| 42 #endif // ScriptModule_h | |
| OLD | NEW |