Chromium Code Reviews| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 | 99 |
| 100 Document* document(); | 100 Document* document(); |
| 101 Document* originDocument() const { return m_originDocument; } | 101 Document* originDocument() const { return m_originDocument; } |
| 102 PassRefPtr<DartScriptInfo> scriptInfo() const { return m_scriptInfo; } | 102 PassRefPtr<DartScriptInfo> scriptInfo() const { return m_scriptInfo; } |
| 103 | 103 |
| 104 private: | 104 private: |
| 105 Document* m_originDocument; | 105 Document* m_originDocument; |
| 106 RefPtr<DartScriptInfo> m_scriptInfo; | 106 RefPtr<DartScriptInfo> m_scriptInfo; |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 static String resolveUrl(String mainLibraryURL, const String& url, const Str ing& packageRootOverride); | |
| 110 | |
| 109 static PassRefPtr<DartApplicationLoader> create(Document* document, bool dom Enabled) | 111 static PassRefPtr<DartApplicationLoader> create(Document* document, bool dom Enabled) |
| 110 { | 112 { |
| 111 return adoptRef(new DartApplicationLoader(document, domEnabled)); | 113 return adoptRef(new DartApplicationLoader(document, domEnabled)); |
| 112 } | 114 } |
| 113 | 115 |
| 114 void load(PassRefPtr<DartErrorEventDispatcher>); | 116 void load(PassRefPtr<DartErrorEventDispatcher>); |
| 115 | 117 |
| 116 Document* document() { return m_originDocument; } | 118 Document* document() { return m_originDocument; } |
| 117 | 119 |
| 118 void callEntryPoint(); | 120 void callEntryPoint(); |
| 119 | 121 |
| 120 void logObservatoryInformation(); | 122 void logObservatoryInformation(); |
| 121 | 123 |
| 122 void validateUrlLoaded(const String& url); | 124 void validateUrlLoaded(const String& url); |
| 123 | 125 |
| 124 // Registers a request to be fetched later. | 126 // Registers a request to be fetched later. |
| 125 void addRequest(PassRefPtr<DartScriptInfo>); | 127 void addRequest(PassRefPtr<DartScriptInfo>); |
| 126 | 128 |
| 127 // Fetches all pending requests and invokes callback when done. | 129 // Fetches all pending requests and invokes callback when done. |
| 128 void processRequests(Dart_Isolate, const ScriptSourceCode&, PassRefPtr<Callb ack>); | 130 void processRequests(Dart_Isolate, const ScriptSourceCode&, PassRefPtr<Callb ack>); |
| 129 void processSingleRequest(Dart_Isolate, const String& url, PassRefPtr<Callba ck>); | 131 void processSingleRequest(Dart_Isolate, const String& url, PassRefPtr<Callba ck>); |
| 130 | 132 |
| 131 bool running() const { return m_state >= Running; } | 133 bool running() const { return m_state >= Running; } |
| 132 bool error() const { return m_state == Error; } | 134 bool error() const { return m_state == Error; } |
| 133 bool uninitialized() const { return m_state == Uninitialized; } | 135 bool uninitialized() const { return m_state == Uninitialized; } |
| 134 | 136 |
| 135 const KURL& scriptUrl() { return m_scriptUrl; } | 137 const KURL& scriptUrl() { return m_scriptUrl; } |
| 138 const String packageRoot() { return m_packageRoot; } | |
|
siva
2017/01/06 21:39:33
const String packageRoot() const { return m_packag
terry
2017/01/09 21:06:02
Done.
| |
| 136 | 139 |
| 137 static void initializePlaceholderInteropClasses(); | 140 static void initializePlaceholderInteropClasses(); |
| 138 | 141 |
| 139 private: | 142 private: |
| 140 enum State { | 143 enum State { |
| 141 // The application failed to load. | 144 // The application failed to load. |
| 142 Error = -1, | 145 Error = -1, |
| 143 | 146 |
| 144 // The isolate is not set. | 147 // The isolate is not set. |
| 145 Uninitialized = 0, | 148 Uninitialized = 0, |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 170 typedef Vector<Dart_PersistentHandle> HandleSet; | 173 typedef Vector<Dart_PersistentHandle> HandleSet; |
| 171 typedef HashMap<String, HandleSet*> UrlHandleMap; | 174 typedef HashMap<String, HandleSet*> UrlHandleMap; |
| 172 typedef Deque<RefPtr<DartScriptInfo> > ScriptList; | 175 typedef Deque<RefPtr<DartScriptInfo> > ScriptList; |
| 173 typedef HashMap<String, DartAggregate*> AggregateMap; | 176 typedef HashMap<String, DartAggregate*> AggregateMap; |
| 174 | 177 |
| 175 DartApplicationLoader(Document*, bool domEnabled = true); | 178 DartApplicationLoader(Document*, bool domEnabled = true); |
| 176 | 179 |
| 177 void loadScriptFromSnapshot(const String& url, const uint8_t* snapshot, intp tr_t snapshotSize); | 180 void loadScriptFromSnapshot(const String& url, const uint8_t* snapshot, intp tr_t snapshotSize); |
| 178 | 181 |
| 179 Dart_Handle topLevelLibrary(); | 182 Dart_Handle topLevelLibrary(); |
| 183 void setupVMLibraryHooks(); | |
| 180 | 184 |
| 181 // FIXME(vsm): Do we need all of these? | 185 // FIXME(vsm): Do we need all of these? |
| 182 void scriptLoadError(String failedUrl); | 186 void scriptLoadError(String failedUrl); |
| 183 void reportDartError(Dart_Handle); | 187 void reportDartError(Dart_Handle); |
| 184 void reportError(Dart_Handle error, const String& url); | 188 void reportError(Dart_Handle error, const String& url); |
| 185 void reportError(const String& error, const String& url); | 189 void reportError(const String& error, const String& url); |
| 186 | 190 |
| 187 void initialize(Dart_Isolate, const String& scriptUrl, PassRefPtr<Callback>) ; | 191 void initialize(Dart_Isolate, const String& scriptUrl, PassRefPtr<Callback>) ; |
| 188 | 192 |
| 189 void process(const String& url, const String& source, intptr_t lineNumber); | 193 void process(const String& url, const String& source, intptr_t lineNumber); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 219 | 223 |
| 220 State m_state; | 224 State m_state; |
| 221 | 225 |
| 222 friend class DartService; | 226 friend class DartService; |
| 223 friend class ScriptLoadedCallback; | 227 friend class ScriptLoadedCallback; |
| 224 }; | 228 }; |
| 225 | 229 |
| 226 } | 230 } |
| 227 | 231 |
| 228 #endif // DartApplicationLoader_h | 232 #endif // DartApplicationLoader_h |
| OLD | NEW |