Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: Source/core/html/imports/HTMLImportLoader.h

Issue 238923009: HTML Imports: No more BlockingDocumentCreation. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed the build breakage Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef HTMLImportLoader_h 31 #ifndef HTMLImportLoader_h
32 #define HTMLImportLoader_h 32 #define HTMLImportLoader_h
33 33
34 #include "core/fetch/RawResource.h" 34 #include "core/fetch/RawResource.h"
35 #include "core/fetch/ResourceOwner.h" 35 #include "core/fetch/ResourceOwner.h"
36 #include "wtf/OwnPtr.h"
37 #include "wtf/PassOwnPtr.h"
36 #include "wtf/Vector.h" 38 #include "wtf/Vector.h"
37 39
38 namespace WebCore { 40 namespace WebCore {
39 41
40 class Document; 42 class Document;
41 class DocumentWriter; 43 class DocumentWriter;
42 class HTMLImportChild; 44 class HTMLImportChild;
43 class HTMLImportsController; 45 class HTMLImportsController;
46 class RefCountedCustomElementMicrotaskQueue;
44 47
45 // 48 //
46 // Owning imported Document lifetime. It also implements ResourceClient through ResourceOwner 49 // Owning imported Document lifetime. It also implements ResourceClient through ResourceOwner
47 // to feed fetched bytes to the DocumentWriter of the imported document. 50 // to feed fetched bytes to the DocumentWriter of the imported document.
48 // HTMLImportLoader is owned by and shared between HTMLImportChild. 51 // HTMLImportLoader is owned by and shared between HTMLImportChild.
49 // 52 //
50 // 53 //
51 class HTMLImportLoader FINAL : public RefCounted<HTMLImportLoader>, public Resou rceOwner<RawResource> { 54 class HTMLImportLoader FINAL : public RefCounted<HTMLImportLoader>, public Resou rceOwner<RawResource> {
52 public: 55 public:
53 enum State { 56 enum State {
(...skipping 12 matching lines...) Expand all
66 virtual ~HTMLImportLoader(); 69 virtual ~HTMLImportLoader();
67 70
68 Document* document() const { return m_importedDocument.get(); } 71 Document* document() const { return m_importedDocument.get(); }
69 Document* importedDocument() const; 72 Document* importedDocument() const;
70 void addImport(HTMLImportChild*); 73 void addImport(HTMLImportChild*);
71 void removeImport(HTMLImportChild*); 74 void removeImport(HTMLImportChild*);
72 HTMLImportChild* firstImport() const { return m_imports[0]; } 75 HTMLImportChild* firstImport() const { return m_imports[0]; }
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; }
79 bool shouldBlockScriptExecution() const;
76 80
77 void importDestroyed(); 81 void importDestroyed();
78 void startLoading(const ResourcePtr<RawResource>&); 82 void startLoading(const ResourcePtr<RawResource>&);
79 void didFinishParsing(); 83 void didFinishParsing();
80 void didRemoveAllPendingStylesheet(); 84 void didRemoveAllPendingStylesheet();
81 bool isOwnedBy(const HTMLImportChild* import) const { return m_imports[0] == import; } 85
86 PassRefPtr<RefCountedCustomElementMicrotaskQueue> microtaskQueue() const;
82 87
83 private: 88 private:
84 HTMLImportLoader(HTMLImportsController*); 89 HTMLImportLoader(HTMLImportsController*);
85 90
86 // RawResourceClient 91 // RawResourceClient
87 virtual void responseReceived(Resource*, const ResourceResponse&) OVERRIDE; 92 virtual void responseReceived(Resource*, const ResourceResponse&) OVERRIDE;
88 virtual void dataReceived(Resource*, const char* data, int length) OVERRIDE; 93 virtual void dataReceived(Resource*, const char* data, int length) OVERRIDE;
89 virtual void notifyFinished(Resource*) OVERRIDE; 94 virtual void notifyFinished(Resource*) OVERRIDE;
90 95
91 State startWritingAndParsing(const ResourceResponse&); 96 State startWritingAndParsing(const ResourceResponse&);
92 State finishWriting(); 97 State finishWriting();
93 State finishParsing(); 98 State finishParsing();
94 State finishLoading(); 99 State finishLoading();
95 100
96 void setState(State); 101 void setState(State);
97 void didFinishLoading(); 102 void didFinishLoading();
98 bool hasPendingResources() const; 103 bool hasPendingResources() const;
99 void clear(); 104 void clear();
100 105
101 HTMLImportsController* m_controller; 106 HTMLImportsController* m_controller;
102 Vector<HTMLImportChild*> m_imports; 107 Vector<HTMLImportChild*> m_imports;
103 State m_state; 108 State m_state;
104 RefPtr<Document> m_importedDocument; 109 RefPtr<Document> m_importedDocument;
105 RefPtr<DocumentWriter> m_writer; 110 RefPtr<DocumentWriter> m_writer;
111 RefPtr<RefCountedCustomElementMicrotaskQueue> m_microtaskQueue;
106 }; 112 };
107 113
108 } // namespace WebCore 114 } // namespace WebCore
109 115
110 #endif // HTMLImportLoader_h 116 #endif // HTMLImportLoader_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698