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 18 matching lines...) Expand all Loading... |
29 */ | 29 */ |
30 | 30 |
31 #ifndef HTMLImportsController_h | 31 #ifndef HTMLImportsController_h |
32 #define HTMLImportsController_h | 32 #define HTMLImportsController_h |
33 | 33 |
34 #include "core/html/HTMLImport.h" | 34 #include "core/html/HTMLImport.h" |
35 #include "core/html/LinkResource.h" | 35 #include "core/html/LinkResource.h" |
36 #include "core/loader/cache/CachedRawResource.h" | 36 #include "core/loader/cache/CachedRawResource.h" |
37 #include "core/loader/cache/ResourcePtr.h" | 37 #include "core/loader/cache/ResourcePtr.h" |
38 #include "core/platform/Supplementable.h" | 38 #include "core/platform/Supplementable.h" |
| 39 #include "core/platform/Timer.h" |
39 #include "wtf/FastAllocBase.h" | 40 #include "wtf/FastAllocBase.h" |
40 #include "wtf/PassOwnPtr.h" | 41 #include "wtf/PassOwnPtr.h" |
41 #include "wtf/Vector.h" | 42 #include "wtf/Vector.h" |
42 | 43 |
43 namespace WebCore { | 44 namespace WebCore { |
44 | 45 |
45 class ScriptExecutionContext; | 46 class ScriptExecutionContext; |
46 class ResourceFetcher; | 47 class ResourceFetcher; |
47 class HTMLImportLoader; | 48 class HTMLImportLoader; |
48 class HTMLImportsController; | 49 class HTMLImportsController; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 virtual ~HTMLImportLoader(); | 85 virtual ~HTMLImportLoader(); |
85 | 86 |
86 Document* importedDocument() const; | 87 Document* importedDocument() const; |
87 const KURL& url() const { return m_url; } | 88 const KURL& url() const { return m_url; } |
88 | 89 |
89 void importDestroyed(); | 90 void importDestroyed(); |
90 bool isDone() const { return m_state == StateReady || m_state == StateError;
} | 91 bool isDone() const { return m_state == StateReady || m_state == StateError;
} |
91 | 92 |
92 // HTMLImport | 93 // HTMLImport |
93 virtual HTMLImportsController* controller() OVERRIDE; | 94 virtual HTMLImportsController* controller() OVERRIDE; |
94 virtual HTMLImport* parent() OVERRIDE; | 95 virtual HTMLImport* parent() const OVERRIDE; |
95 virtual Document* document() OVERRIDE; | 96 virtual Document* document() const OVERRIDE; |
96 virtual void wasDetachedFromDocument() OVERRIDE; | 97 virtual void wasDetachedFromDocument() OVERRIDE; |
97 virtual void didFinishParsing() OVERRIDE; | 98 virtual void didFinishParsing() OVERRIDE; |
| 99 virtual bool isProcessing() const OVERRIDE; |
98 | 100 |
99 private: | 101 private: |
100 HTMLImportLoader(HTMLImport*, const KURL&, const ResourcePtr<CachedScript>&)
; | 102 HTMLImportLoader(HTMLImport*, const KURL&, const ResourcePtr<CachedScript>&)
; |
101 | 103 |
102 // CachedRawResourceClient | 104 // CachedRawResourceClient |
103 virtual void responseReceived(Resource*, const ResourceResponse&) OVERRIDE; | 105 virtual void responseReceived(Resource*, const ResourceResponse&) OVERRIDE; |
104 virtual void dataReceived(Resource*, const char* data, int length) OVERRIDE; | 106 virtual void dataReceived(Resource*, const char* data, int length) OVERRIDE; |
105 virtual void notifyFinished(Resource*) OVERRIDE; | 107 virtual void notifyFinished(Resource*) OVERRIDE; |
106 | 108 |
107 State startWritingAndParsing(const ResourceResponse&); | 109 State startWritingAndParsing(const ResourceResponse&); |
(...skipping 14 matching lines...) Expand all Loading... |
122 class HTMLImportsController : public HTMLImport, public Supplement<ScriptExecuti
onContext> { | 124 class HTMLImportsController : public HTMLImport, public Supplement<ScriptExecuti
onContext> { |
123 WTF_MAKE_FAST_ALLOCATED; | 125 WTF_MAKE_FAST_ALLOCATED; |
124 public: | 126 public: |
125 static void provideTo(Document*); | 127 static void provideTo(Document*); |
126 | 128 |
127 explicit HTMLImportsController(Document*); | 129 explicit HTMLImportsController(Document*); |
128 virtual ~HTMLImportsController(); | 130 virtual ~HTMLImportsController(); |
129 | 131 |
130 // HTMLImport | 132 // HTMLImport |
131 virtual HTMLImportsController* controller() OVERRIDE; | 133 virtual HTMLImportsController* controller() OVERRIDE; |
132 virtual HTMLImport* parent() OVERRIDE; | 134 virtual HTMLImport* parent() const OVERRIDE; |
133 virtual Document* document() OVERRIDE; | 135 virtual Document* document() const OVERRIDE; |
134 virtual void wasDetachedFromDocument() OVERRIDE; | 136 virtual void wasDetachedFromDocument() OVERRIDE; |
135 virtual void didFinishParsing() OVERRIDE; | 137 virtual void didFinishParsing() OVERRIDE; |
| 138 virtual bool isProcessing() const OVERRIDE; |
136 | 139 |
137 void addImport(PassRefPtr<HTMLImportLoader>); | 140 void addImport(PassRefPtr<HTMLImportLoader>); |
138 void showSecurityErrorMessage(const String&); | 141 void showSecurityErrorMessage(const String&); |
139 PassRefPtr<HTMLImportLoader> findLinkFor(const KURL&) const; | 142 PassRefPtr<HTMLImportLoader> findLinkFor(const KURL&) const; |
140 SecurityOrigin* securityOrigin() const; | 143 SecurityOrigin* securityOrigin() const; |
141 ResourceFetcher* fetcher() const; | 144 ResourceFetcher* fetcher() const; |
142 bool haveChildrenLoaded(HTMLImport* parent) const; | 145 |
143 void didLoad(HTMLImportLoader*); | 146 void scheduleUnblock(); |
| 147 void unblockTimerFired(Timer<HTMLImportsController>*); |
144 | 148 |
145 private: | 149 private: |
146 void clear(); | 150 void clear(); |
147 | 151 |
148 Document* m_master; | 152 Document* m_master; |
| 153 Timer<HTMLImportsController> m_unblockTimer; |
149 | 154 |
150 // List of import which has been loaded or being loaded. | 155 // List of import which has been loaded or being loaded. |
151 typedef Vector<RefPtr<HTMLImportLoader> > ImportList; | 156 typedef Vector<RefPtr<HTMLImportLoader> > ImportList; |
152 ImportList m_imports; | 157 ImportList m_imports; |
153 }; | 158 }; |
154 | 159 |
155 } // namespace WebCore | 160 } // namespace WebCore |
156 | 161 |
157 #endif // HTMLImportsController_h | 162 #endif // HTMLImportsController_h |
OLD | NEW |