OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SKY_ENGINE_CORE_APP_ABSTRACT_MODULE_H_ | 5 #ifndef SKY_ENGINE_CORE_APP_ABSTRACT_MODULE_H_ |
6 #define SKY_ENGINE_CORE_APP_ABSTRACT_MODULE_H_ | 6 #define SKY_ENGINE_CORE_APP_ABSTRACT_MODULE_H_ |
7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 9 #include "core/app/ModuleLoader.h" |
8 #include "core/dom/ContextLifecycleObserver.h" | 10 #include "core/dom/ContextLifecycleObserver.h" |
9 #include "core/dom/Document.h" | 11 #include "core/dom/Document.h" |
10 #include "core/events/EventTarget.h" | 12 #include "core/events/EventTarget.h" |
11 #include "wtf/RefCounted.h" | 13 #include "wtf/RefCounted.h" |
12 | 14 |
13 namespace blink { | 15 namespace blink { |
| 16 class Application; |
14 | 17 |
15 class AbstractModule : public RefCounted<AbstractModule>, | 18 class AbstractModule : public RefCounted<AbstractModule>, |
16 public EventTargetWithInlineData, | 19 public EventTargetWithInlineData, |
17 public ContextLifecycleObserver { | 20 public ContextLifecycleObserver, |
| 21 public ModuleLoader::Client { |
18 DEFINE_WRAPPERTYPEINFO(); | 22 DEFINE_WRAPPERTYPEINFO(); |
19 REFCOUNTED_EVENT_TARGET(AbstractModule); | 23 REFCOUNTED_EVENT_TARGET(AbstractModule); |
20 public: | 24 public: |
21 virtual ~AbstractModule(); | 25 virtual ~AbstractModule(); |
22 | 26 |
23 Document* document() const { return document_.get(); } | 27 Document* document() const { return document_.get(); } |
24 const String& url() const { return url_; } | 28 const String& url() const { return url_; } |
25 | 29 |
| 30 ScriptPromise import(ScriptState*, const String& url); |
| 31 |
26 protected: | 32 protected: |
27 AbstractModule(ExecutionContext*, PassRefPtr<Document>, const String& url); | 33 AbstractModule(ExecutionContext*, PassRefPtr<Document>, const String& url); |
28 | 34 |
| 35 virtual Application* GetApplication() = 0; |
| 36 |
29 private: | 37 private: |
30 ExecutionContext* executionContext() const override; | 38 ExecutionContext* executionContext() const override; |
31 | 39 |
| 40 void OnModuleLoadComplete(ModuleLoader*, Module*) override; |
| 41 |
32 RefPtr<Document> document_; | 42 RefPtr<Document> document_; |
33 String url_; | 43 String url_; |
| 44 |
| 45 HashMap<OwnPtr<ModuleLoader>, RefPtr<ScriptPromiseResolver>> loaders_; |
34 }; | 46 }; |
35 | 47 |
36 } // namespace blink | 48 } // namespace blink |
37 | 49 |
38 #endif // SKY_ENGINE_CORE_APP_ABSTRACT_MODULE_H_ | 50 #endif // SKY_ENGINE_CORE_APP_ABSTRACT_MODULE_H_ |
OLD | NEW |