OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 26 matching lines...) Expand all Loading... | |
37 #include "wtf/Forward.h" | 37 #include "wtf/Forward.h" |
38 #include "wtf/HashMap.h" | 38 #include "wtf/HashMap.h" |
39 #include "wtf/RefCounted.h" | 39 #include "wtf/RefCounted.h" |
40 #include "wtf/Vector.h" | 40 #include "wtf/Vector.h" |
41 #include "wtf/text/TextPosition.h" | 41 #include "wtf/text/TextPosition.h" |
42 #include <v8.h> | 42 #include <v8.h> |
43 | 43 |
44 namespace blink { | 44 namespace blink { |
45 | 45 |
46 class DOMWrapperWorld; | 46 class DOMWrapperWorld; |
47 class Document; | |
48 class ExecutionContext; | 47 class ExecutionContext; |
49 class Event; | 48 class Event; |
50 class HTMLDocument; | 49 class HTMLDocument; |
51 class KURL; | 50 class KURL; |
52 class LocalFrame; | 51 class LocalFrame; |
52 class AbstractModule; | |
53 class ScriptState; | 53 class ScriptState; |
54 class ScriptSourceCode; | 54 class ScriptSourceCode; |
55 class WindowProxy; | 55 class WindowProxy; |
56 class Widget; | 56 class Widget; |
57 | 57 |
58 typedef WTF::Vector<v8::Extension*> V8Extensions; | 58 typedef WTF::Vector<v8::Extension*> V8Extensions; |
59 | 59 |
60 class ScriptController { | 60 class ScriptController { |
61 public: | 61 public: |
62 ScriptController(LocalFrame*); | 62 ScriptController(LocalFrame*); |
63 ~ScriptController(); | 63 ~ScriptController(); |
64 | 64 |
65 bool initializeMainWorld(); | 65 bool initializeMainWorld(); |
66 WindowProxy* windowProxy(DOMWrapperWorld&); | 66 WindowProxy* windowProxy(DOMWrapperWorld&); |
67 WindowProxy* existingWindowProxy(DOMWrapperWorld&); | 67 WindowProxy* existingWindowProxy(DOMWrapperWorld&); |
68 | 68 |
69 // Evaluate JavaScript in the main world. | 69 // Evaluate JavaScript in the main world. |
70 void executeScriptInMainWorld(const String&); | 70 void executeScriptInMainWorld(const String&); |
71 void executeScriptInMainWorld(const ScriptSourceCode&); | 71 void executeScriptInMainWorld(const ScriptSourceCode&); |
72 v8::Local<v8::Value> executeScriptInMainWorldAndReturnValue(const ScriptSour ceCode&); | 72 v8::Local<v8::Value> executeScriptInMainWorldAndReturnValue(const ScriptSour ceCode&); |
73 v8::Local<v8::Value> executeScriptAndReturnValue(v8::Handle<v8::Context>, co nst ScriptSourceCode&); | 73 v8::Local<v8::Value> executeScriptAndReturnValue(v8::Handle<v8::Context>, co nst ScriptSourceCode&); |
74 | 74 |
75 void executeModuleScript(Document& document, const String& source, const Tex tPosition& textPosition); | 75 void executeModuleScript(AbstractModule*, const String& source, const TextPo sition& textPosition); |
eseidel
2014/11/10 23:30:19
I would use & based on our in-person discussion.
| |
76 | 76 |
77 // Executes JavaScript in an isolated world. The script gets its own global scope, | 77 // Executes JavaScript in an isolated world. The script gets its own global scope, |
78 // its own prototypes for intrinsic JavaScript objects (String, Array, and s o-on), | 78 // its own prototypes for intrinsic JavaScript objects (String, Array, and s o-on), |
79 // and its own wrappers for all DOM nodes and DOM constructors. | 79 // and its own wrappers for all DOM nodes and DOM constructors. |
80 // | 80 // |
81 // If an isolated world with the specified ID already exists, it is reused. | 81 // If an isolated world with the specified ID already exists, it is reused. |
82 // Otherwise, a new world is created. | 82 // Otherwise, a new world is created. |
83 // | 83 // |
84 // FIXME: Get rid of extensionGroup here. | 84 // FIXME: Get rid of extensionGroup here. |
85 void executeScriptInIsolatedWorld(int worldID, const Vector<ScriptSourceCode >& sources, int extensionGroup, Vector<v8::Local<v8::Value> >* results); | 85 void executeScriptInIsolatedWorld(int worldID, const Vector<ScriptSourceCode >& sources, int extensionGroup, Vector<v8::Local<v8::Value> >* results); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 const String* m_sourceURL; | 117 const String* m_sourceURL; |
118 v8::Isolate* m_isolate; | 118 v8::Isolate* m_isolate; |
119 | 119 |
120 OwnPtr<WindowProxy> m_windowProxy; | 120 OwnPtr<WindowProxy> m_windowProxy; |
121 IsolatedWorldMap m_isolatedWorlds; | 121 IsolatedWorldMap m_isolatedWorlds; |
122 }; | 122 }; |
123 | 123 |
124 } // namespace blink | 124 } // namespace blink |
125 | 125 |
126 #endif // ScriptController_h | 126 #endif // ScriptController_h |
OLD | NEW |