OLD | NEW |
---|---|
1 // Copyright 2011, Google Inc. | 1 // Copyright 2011, Google Inc. |
2 // All rights reserved. | 2 // 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 24 matching lines...) Expand all Loading... | |
35 #include <dart_api.h> | 35 #include <dart_api.h> |
36 #include <v8.h> | 36 #include <v8.h> |
37 #include <wtf/HashMap.h> | 37 #include <wtf/HashMap.h> |
38 #include <wtf/Vector.h> | 38 #include <wtf/Vector.h> |
39 #include <wtf/text/WTFString.h> | 39 #include <wtf/text/WTFString.h> |
40 | 40 |
41 struct NPObject; | 41 struct NPObject; |
42 | 42 |
43 namespace WebCore { | 43 namespace WebCore { |
44 | 44 |
45 class DartScriptState; | |
vsm
2013/09/30 22:08:03
nit: alpha
Jacob
2013/10/01 00:07:05
Done.
| |
45 class DartApplicationLoader; | 46 class DartApplicationLoader; |
46 class DartDOMData; | 47 class DartDOMData; |
47 class DOMWindow; | 48 class DOMWindow; |
48 class Frame; | 49 class Frame; |
49 class ScriptExecutionContext; | 50 class ScriptExecutionContext; |
51 class ScriptState; | |
50 | 52 |
51 // This class provides the linkage between a Frame and its attached | 53 // This class provides the linkage between a Frame and its attached |
52 // Dart isolates. It is similar to ScriptController for JavaScript. | 54 // Dart isolates. It is similar to ScriptController for JavaScript. |
53 // The DartController is owned by its Frame. | 55 // The DartController is owned by its Frame. |
54 class DartController { | 56 class DartController { |
55 public: | 57 public: |
56 DartController(Frame*); | 58 DartController(Frame*); |
57 virtual ~DartController(); | 59 virtual ~DartController(); |
58 | 60 |
59 void evaluate(const ScriptSourceCode&); | 61 void evaluate(const ScriptSourceCode&); |
60 void isolatedWorldCreated(v8::Handle<v8::Context>); | 62 void isolatedWorldCreated(v8::Handle<v8::Context>); |
61 | 63 |
62 // Exposes NPObject instance to Dart environment. | 64 // Exposes NPObject instance to Dart environment. |
63 void bindToWindowObject(Frame*, const String& key, NPObject*); | 65 void bindToWindowObject(Frame*, const String& key, NPObject*); |
64 NPObject* npObject(const String& key); | 66 NPObject* npObject(const String& key); |
65 | 67 |
66 void clearWindowShell(); | 68 void clearWindowShell(); |
67 | 69 |
68 Dart_Handle callFunction(Dart_Handle function, int argc, Dart_Handle* argv); | 70 Dart_Handle callFunction(Dart_Handle function, int argc, Dart_Handle* argv); |
69 | 71 |
70 void startDart(); | 72 void startDart(); |
71 | 73 |
72 Frame* frame() const { return m_frame; } | 74 Frame* frame() const { return m_frame; } |
75 void collectScriptStates(ScriptState* v8ScriptState, Vector<ScriptState*>& r esult); | |
76 void collectScriptStatesForIsolate(Dart_Isolate, v8::Handle<v8::Context> v8C ontext, Vector<ScriptState*>& result); | |
73 | 77 |
74 void spawnDomIsolateFromSelf(const String& libraryUrl, const String& entryPo int, DartDOMData* parentDOMData, Dart_Port replyTo); | 78 void spawnDomIsolateFromSelf(const String& libraryUrl, const String& entryPo int, DartDOMData* parentDOMData, Dart_Port replyTo); |
75 void spawnDomIsolateFromUrl(const String& url, Dart_Port replyTo); | 79 void spawnDomIsolateFromUrl(const String& url, Dart_Port replyTo); |
76 | 80 |
77 static DartController* retrieve(Frame*); | 81 static DartController* retrieve(Frame*); |
78 static DartController* retrieve(ScriptExecutionContext*); | 82 static DartController* retrieve(ScriptExecutionContext*); |
79 | 83 |
80 private: | 84 private: |
81 static void initVMIfNeeded(); | 85 static void initVMIfNeeded(); |
82 | 86 |
(...skipping 11 matching lines...) Expand all Loading... | |
94 void didLeaveScriptContext(int recursion); | 98 void didLeaveScriptContext(int recursion); |
95 | 99 |
96 // The frame that owns this controller. | 100 // The frame that owns this controller. |
97 Frame* m_frame; | 101 Frame* m_frame; |
98 | 102 |
99 bool m_scriptsLoaded; | 103 bool m_scriptsLoaded; |
100 | 104 |
101 // Isolates associated with scripts in this document. | 105 // Isolates associated with scripts in this document. |
102 Vector<Dart_Isolate> m_isolates; | 106 Vector<Dart_Isolate> m_isolates; |
103 | 107 |
108 typedef HashMap<intptr_t, DartScriptState*> LibraryIdMap; | |
109 typedef HashMap<Dart_Isolate, LibraryIdMap*> ScriptStatesMap; | |
110 ScriptStatesMap m_scriptStates; | |
111 | |
104 typedef HashMap<String, NPObject*> NPObjectMap; | 112 typedef HashMap<String, NPObject*> NPObjectMap; |
105 NPObjectMap m_npObjectMap; | 113 NPObjectMap m_npObjectMap; |
106 | 114 |
107 friend class DartScriptRunner; | 115 friend class DartScriptRunner; |
108 }; | 116 }; |
109 | 117 |
110 } | 118 } |
111 | 119 |
112 #endif // DartController_h | 120 #endif // DartController_h |
OLD | NEW |