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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/CompiledScript.h

Issue 2564903002: ScriptController: Expose methods to compile a script and execute a compiled script. (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
OLDNEW
(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 CompiledScript_h
6 #define CompiledScript_h
7
8 #include "bindings/core/v8/ScriptSourceCode.h"
9 #include "platform/heap/GarbageCollected.h"
10 #include "wtf/Assertions.h"
11 #include "wtf/text/TextPosition.h"
12
13 #include <v8.h>
14
15 namespace blink {
16
17 // This wraps a global handle on a V8 object (the compiled script).
18 // Because that script may contain further references to other objects, do not
19 // keep long-lasting references to this object, as they may induce cycles
20 // between V8 and Oilpan.
21 class CompiledScript : public GarbageCollectedFinalized<CompiledScript> {
22 public:
23 CompiledScript(v8::Isolate* isolate,
24 v8::Local<v8::Script> script,
25 const ScriptSourceCode& sourceCode)
26 : m_sourceCode(sourceCode), m_script(isolate, script) {
27 DCHECK(!script.IsEmpty());
28 }
29
30 v8::Local<v8::Script> script(v8::Isolate* isolate) const {
31 return m_script.Get(isolate);
32 }
33
34 const ScriptSourceCode& sourceCode() const { return m_sourceCode; }
35 const KURL& url() const { return m_sourceCode.url(); }
36 const TextPosition& startPosition() const {
37 return m_sourceCode.startPosition();
38 }
39
40 DEFINE_INLINE_TRACE() { visitor->trace(m_sourceCode); }
41
42 private:
43 ScriptSourceCode m_sourceCode;
44 v8::Global<v8::Script> m_script;
45 };
46
47 } // namespace blink
48
49 #endif // CompiledScript_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698