OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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/OwnPtr.h" | 37 #include "wtf/OwnPtr.h" |
38 #include "wtf/PassOwnPtr.h" | 38 #include "wtf/PassOwnPtr.h" |
39 #include "wtf/Vector.h" | 39 #include "wtf/Vector.h" |
40 | 40 |
41 namespace blink { | 41 namespace blink { |
42 | 42 |
43 class CustomElementSyncMicrotaskQueue; | 43 class CustomElementSyncMicrotaskQueue; |
44 class Document; | 44 class Document; |
45 class HTMLImportChild; | 45 class HTMLImportChild; |
46 class HTMLImportsController; | 46 class HTMLImportsController; |
| 47 class Module; |
47 | 48 |
48 class HTMLImportLoader final : public MojoFetcher::Client { | 49 class HTMLImportLoader final : public MojoFetcher::Client { |
49 public: | 50 public: |
50 enum State { | 51 enum State { |
51 StateLoading, | 52 StateLoading, |
52 StateWritten, | 53 StateWritten, |
53 StateParsed, | 54 StateParsed, |
54 StateLoaded, | 55 StateLoaded, |
55 StateError | 56 StateError |
56 }; | 57 }; |
57 | 58 |
58 static PassOwnPtr<HTMLImportLoader> create(HTMLImportsController* controller
) | 59 static PassOwnPtr<HTMLImportLoader> create(HTMLImportsController* controller
) |
59 { | 60 { |
60 return adoptPtr(new HTMLImportLoader(controller)); | 61 return adoptPtr(new HTMLImportLoader(controller)); |
61 } | 62 } |
62 | 63 |
63 virtual ~HTMLImportLoader(); | 64 virtual ~HTMLImportLoader(); |
64 | 65 |
65 Document* document() const { return m_document.get(); } | 66 Document* document() const { return m_document.get(); } |
| 67 Module* module() const { return m_module.get(); } |
| 68 |
66 void addImport(HTMLImportChild*); | 69 void addImport(HTMLImportChild*); |
67 #if !ENABLE(OILPAN) | 70 #if !ENABLE(OILPAN) |
68 void removeImport(HTMLImportChild*); | 71 void removeImport(HTMLImportChild*); |
69 #endif | 72 #endif |
70 void moveToFirst(HTMLImportChild*); | 73 void moveToFirst(HTMLImportChild*); |
71 HTMLImportChild* firstImport() const { return m_imports[0]; } | 74 HTMLImportChild* firstImport() const { return m_imports[0]; } |
72 bool isFirstImport(const HTMLImportChild* child) const { return m_imports.si
ze() ? firstImport() == child : false; } | 75 bool isFirstImport(const HTMLImportChild* child) const { return m_imports.si
ze() ? firstImport() == child : false; } |
73 | 76 |
74 bool isDone() const { return m_state == StateLoaded || m_state == StateError
; } | 77 bool isDone() const { return m_state == StateLoaded || m_state == StateError
; } |
75 bool hasError() const { return m_state == StateError; } | 78 bool hasError() const { return m_state == StateError; } |
(...skipping 29 matching lines...) Expand all Loading... |
105 | 108 |
106 void setState(State); | 109 void setState(State); |
107 void didFinishLoading(); | 110 void didFinishLoading(); |
108 #if !ENABLE(OILPAN) | 111 #if !ENABLE(OILPAN) |
109 void clear(); | 112 void clear(); |
110 #endif | 113 #endif |
111 | 114 |
112 RawPtr<HTMLImportsController> m_controller; | 115 RawPtr<HTMLImportsController> m_controller; |
113 Vector<RawPtr<HTMLImportChild> > m_imports; | 116 Vector<RawPtr<HTMLImportChild> > m_imports; |
114 State m_state; | 117 State m_state; |
| 118 RefPtr<Module> m_module; |
115 RefPtr<Document> m_document; | 119 RefPtr<Document> m_document; |
116 RefPtr<CustomElementSyncMicrotaskQueue> m_microtaskQueue; | 120 RefPtr<CustomElementSyncMicrotaskQueue> m_microtaskQueue; |
117 | 121 |
118 OwnPtr<MojoFetcher> m_fetcher; | 122 OwnPtr<MojoFetcher> m_fetcher; |
119 }; | 123 }; |
120 | 124 |
121 } // namespace blink | 125 } // namespace blink |
122 | 126 |
123 #endif // HTMLImportLoader_h | 127 #endif // HTMLImportLoader_h |
OLD | NEW |