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 25 matching lines...) Expand all Loading... |
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 DartApplicationLoader; | 45 class DartApplicationLoader; |
| 46 class DartAsyncLoader; |
46 class DartDOMData; | 47 class DartDOMData; |
47 class DartScriptState; | 48 class DartScriptState; |
48 class DOMWindow; | 49 class DOMWindow; |
49 class Frame; | 50 class Frame; |
| 51 class ScriptElementProxy; |
50 class ScriptExecutionContext; | 52 class ScriptExecutionContext; |
51 class ScriptState; | 53 class ScriptState; |
52 | 54 |
53 // This class provides the linkage between a Frame and its attached | 55 // This class provides the linkage between a Frame and its attached |
54 // Dart isolates. It is similar to ScriptController for JavaScript. | 56 // Dart isolates. It is similar to ScriptController for JavaScript. |
55 // The DartController is owned by its Frame. | 57 // The DartController is owned by its Frame. |
56 class DartController { | 58 class DartController { |
57 public: | 59 public: |
58 DartController(Frame*); | 60 DartController(Frame*); |
59 virtual ~DartController(); | 61 virtual ~DartController(); |
(...skipping 14 matching lines...) Expand all Loading... |
74 Frame* frame() const { return m_frame; } | 76 Frame* frame() const { return m_frame; } |
75 void collectScriptStates(ScriptState* v8ScriptState, Vector<ScriptState*>& r
esult); | 77 void collectScriptStates(ScriptState* v8ScriptState, Vector<ScriptState*>& r
esult); |
76 void collectScriptStatesForIsolate(Dart_Isolate, v8::Handle<v8::Context> v8C
ontext, Vector<ScriptState*>& result); | 78 void collectScriptStatesForIsolate(Dart_Isolate, v8::Handle<v8::Context> v8C
ontext, Vector<ScriptState*>& result); |
77 | 79 |
78 void spawnDomIsolateFromSelf(const String& libraryUrl, const String& entryPo
int, DartDOMData* parentDOMData, Dart_Port replyTo); | 80 void spawnDomIsolateFromSelf(const String& libraryUrl, const String& entryPo
int, DartDOMData* parentDOMData, Dart_Port replyTo); |
79 void spawnDomIsolateFromUrl(const String& url, Dart_Port replyTo); | 81 void spawnDomIsolateFromUrl(const String& url, Dart_Port replyTo); |
80 | 82 |
81 static DartController* retrieve(Frame*); | 83 static DartController* retrieve(Frame*); |
82 static DartController* retrieve(ScriptExecutionContext*); | 84 static DartController* retrieve(ScriptExecutionContext*); |
83 | 85 |
| 86 // FIXME: Move. |
| 87 void loadAndRunScript(const String&, PassRefPtr<DartAsyncLoader>, PassRefPtr
<ScriptElementProxy>); |
84 private: | 88 private: |
85 static void initVMIfNeeded(); | 89 static void initVMIfNeeded(); |
86 | 90 |
87 static Dart_Isolate createIsolate(const char* scriptURL, const char* entryPo
int, Document*, bool isDOMEnabled, char** errorMessage); | 91 static Dart_Isolate createIsolate(const char* scriptURL, const char* entryPo
int, Document*, bool isDOMEnabled, char** errorMessage); |
88 static void shutdownIsolate(Dart_Isolate); | 92 static void shutdownIsolate(Dart_Isolate); |
89 | 93 |
90 void createDOMEnabledIsolate(const String& scriptURL, const String& entryPoi
nt, Document*); | 94 void createDOMEnabledIsolate(const String& scriptURL, const String& entryPoi
nt, Document*); |
91 | 95 |
92 static Dart_Isolate createPureIsolateCallback(const char* prefix, const char
* main, void* callbackData, char** errorMsg); | 96 static Dart_Isolate createPureIsolateCallback(const char* prefix, const char
* main, void* callbackData, char** errorMsg); |
93 void installDartExtensions(v8::Handle<v8::Context>); | 97 void installDartExtensions(v8::Handle<v8::Context>); |
(...skipping 12 matching lines...) Expand all Loading... |
106 Vector<Dart_Isolate> m_isolates; | 110 Vector<Dart_Isolate> m_isolates; |
107 | 111 |
108 typedef HashMap<intptr_t, DartScriptState*> LibraryIdMap; | 112 typedef HashMap<intptr_t, DartScriptState*> LibraryIdMap; |
109 typedef HashMap<Dart_Isolate, LibraryIdMap*> ScriptStatesMap; | 113 typedef HashMap<Dart_Isolate, LibraryIdMap*> ScriptStatesMap; |
110 ScriptStatesMap m_scriptStates; | 114 ScriptStatesMap m_scriptStates; |
111 | 115 |
112 typedef HashMap<String, NPObject*> NPObjectMap; | 116 typedef HashMap<String, NPObject*> NPObjectMap; |
113 NPObjectMap m_npObjectMap; | 117 NPObjectMap m_npObjectMap; |
114 | 118 |
115 friend class DartScriptRunner; | 119 friend class DartScriptRunner; |
| 120 friend class DartDomCallback; |
116 }; | 121 }; |
117 | 122 |
118 } | 123 } |
119 | 124 |
120 #endif // DartController_h | 125 #endif // DartController_h |
OLD | NEW |