Chromium Code Reviews| Index: third_party/WebKit/Source/bindings/core/v8/ScriptModule.h |
| diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptModule.h b/third_party/WebKit/Source/bindings/core/v8/ScriptModule.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a9562b87f9a6a66d6b9172bcb07df32430831259 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptModule.h |
| @@ -0,0 +1,42 @@ |
| +// Copyright 2016 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. |
| + |
| +#ifndef ScriptModule_h |
| +#define ScriptModule_h |
| + |
| +#include "bindings/core/v8/ScriptState.h" |
| +#include "bindings/core/v8/SharedPersistent.h" |
| +#include "core/CoreExport.h" |
| +#include "wtf/Allocator.h" |
| +#include "wtf/text/WTFString.h" |
| +#include <v8.h> |
| + |
| +namespace blink { |
| + |
| +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
|
| + DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| + |
| + public: |
| + 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
|
| + const String& source, |
| + const String& fileName); |
|
dominicc (has gone to gerrit)
2016/12/13 07:45:29
It may make sense to use a parameter object instea
|
| + |
| + ScriptModule() {} |
| + ScriptModule(const ScriptModule& module) : m_module(module.m_module) {} |
| + ~ScriptModule(); |
| + |
| + bool instantiate(ScriptState*); |
| + void evaluate(ScriptState*); |
| + |
| + bool isNull() const { return m_module->isEmpty(); } |
| + |
| + private: |
| + ScriptModule(v8::Isolate*, v8::Local<v8::Module>); |
| + |
| + 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
|
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // ScriptModule_h |