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

Side by Side Diff: sky/engine/core/html/imports/HTMLImportLoader.h

Issue 678683004: HTMLImportLoader should talk directly to mojo::NetworkService (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 2 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
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 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
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 "platform/fetcher/DataPipeDrainer.h"
35 #include "core/fetch/ResourceOwner.h" 35 #include "platform/fetcher/MojoFetcher.h"
36 #include "platform/heap/Handle.h" 36 #include "platform/heap/Handle.h"
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 DocumentWriter; 45 class DocumentWriter;
46 class HTMLImportChild; 46 class HTMLImportChild;
47 class HTMLImportsController; 47 class HTMLImportsController;
48 48
49 49
50 // 50 //
51 // Owning imported Document lifetime. It also implements ResourceClient through ResourceOwner 51 // Owning imported Document lifetime. It also implements ResourceClient through ResourceOwner
52 // to feed fetched bytes to the DocumentWriter of the imported document. 52 // to feed fetched bytes to the DocumentWriter of the imported document.
53 // HTMLImportLoader is owned by HTMLImportsController. 53 // HTMLImportLoader is owned by HTMLImportsController.
54 // 54 //
55 // 55 //
56 class HTMLImportLoader FINAL : public NoBaseWillBeGarbageCollectedFinalized<HTML ImportLoader>, public ResourceOwner<RawResource> { 56 class HTMLImportLoader FINAL : public NoBaseWillBeGarbageCollectedFinalized<HTML ImportLoader>,
57 public MojoFetcher::Client,
58 public DataPipeDrainer::Client {
57 public: 59 public:
58 enum State { 60 enum State {
59 StateLoading, 61 StateLoading,
60 StateWritten, 62 StateWritten,
61 StateParsed, 63 StateParsed,
62 StateLoaded, 64 StateLoaded,
63 StateError 65 StateError
64 }; 66 };
65 67
66 static PassOwnPtrWillBeRawPtr<HTMLImportLoader> create(HTMLImportsController * controller) 68 static PassOwnPtrWillBeRawPtr<HTMLImportLoader> create(HTMLImportsController * controller)
(...skipping 12 matching lines...) Expand all
79 HTMLImportChild* firstImport() const { return m_imports[0]; } 81 HTMLImportChild* firstImport() const { return m_imports[0]; }
80 bool isFirstImport(const HTMLImportChild* child) const { return m_imports.si ze() ? firstImport() == child : false; } 82 bool isFirstImport(const HTMLImportChild* child) const { return m_imports.si ze() ? firstImport() == child : false; }
81 83
82 bool isDone() const { return m_state == StateLoaded || m_state == StateError ; } 84 bool isDone() const { return m_state == StateLoaded || m_state == StateError ; }
83 bool hasError() const { return m_state == StateError; } 85 bool hasError() const { return m_state == StateError; }
84 bool shouldBlockScriptExecution() const; 86 bool shouldBlockScriptExecution() const;
85 87
86 #if !ENABLE(OILPAN) 88 #if !ENABLE(OILPAN)
87 void importDestroyed(); 89 void importDestroyed();
88 #endif 90 #endif
89 void startLoading(const ResourcePtr<RawResource>&); 91 void startLoading(const KURL&);
90 92
91 // Tells the loader that the parser is done with this import. 93 // Tells the loader that the parser is done with this import.
92 // Called by Document::finishedParsing, after DOMContentLoaded was dispatche d. 94 // Called by Document::finishedParsing, after DOMContentLoaded was dispatche d.
93 void didFinishParsing(); 95 void didFinishParsing();
94 // Tells the loader that all of the import's stylesheets finished 96 // Tells the loader that all of the import's stylesheets finished
95 // loading. 97 // loading.
96 // Called by Document::didRemoveAllPendingStylesheet. 98 // Called by Document::didRemoveAllPendingStylesheet.
97 void didRemoveAllPendingStylesheet(); 99 void didRemoveAllPendingStylesheet();
98 100
99 PassRefPtrWillBeRawPtr<CustomElementSyncMicrotaskQueue> microtaskQueue() con st; 101 PassRefPtrWillBeRawPtr<CustomElementSyncMicrotaskQueue> microtaskQueue() con st;
100 102
101 virtual void trace(Visitor*); 103 virtual void trace(Visitor*);
102 104
103 private: 105 private:
104 HTMLImportLoader(HTMLImportsController*); 106 HTMLImportLoader(HTMLImportsController*);
105 107
106 // RawResourceClient 108 // MojoFetcher::Client
107 virtual void responseReceived(Resource*, const ResourceResponse&) OVERRIDE; 109 void OnReceivedResponse(mojo::URLResponsePtr response) override;
eseidel 2014/10/24 21:50:05 redundant
108 virtual void dataReceived(Resource*, const char* data, int length) OVERRIDE;
109 virtual void notifyFinished(Resource*) OVERRIDE;
110 110
111 State startWritingAndParsing(const ResourceResponse&); 111 // DataPipeDrainer::Client
112 void OnDataAvailable(const void* data, size_t num_bytes) override;
113 void OnDataComplete() override;
114
115 State startWritingAndParsing(mojo::URLResponsePtr response);
eseidel 2014/10/24 21:50:05 redundant
112 State finishWriting(); 116 State finishWriting();
113 State finishParsing(); 117 State finishParsing();
114 State finishLoading(); 118 State finishLoading();
115 119
116 void setState(State); 120 void setState(State);
117 void didFinishLoading(); 121 void didFinishLoading();
118 #if !ENABLE(OILPAN) 122 #if !ENABLE(OILPAN)
119 void clear(); 123 void clear();
120 #endif 124 #endif
121 125
122 RawPtrWillBeMember<HTMLImportsController> m_controller; 126 RawPtrWillBeMember<HTMLImportsController> m_controller;
123 WillBeHeapVector<RawPtrWillBeMember<HTMLImportChild> > m_imports; 127 WillBeHeapVector<RawPtrWillBeMember<HTMLImportChild> > m_imports;
124 State m_state; 128 State m_state;
125 RefPtrWillBeMember<Document> m_document; 129 RefPtrWillBeMember<Document> m_document;
126 RefPtrWillBeMember<DocumentWriter> m_writer; 130 RefPtrWillBeMember<DocumentWriter> m_writer;
127 RefPtrWillBeMember<CustomElementSyncMicrotaskQueue> m_microtaskQueue; 131 RefPtrWillBeMember<CustomElementSyncMicrotaskQueue> m_microtaskQueue;
132
133 OwnPtr<MojoFetcher> m_fetcher;
134 OwnPtr<DataPipeDrainer> m_drainer;
128 }; 135 };
129 136
130 } // namespace blink 137 } // namespace blink
131 138
132 #endif // HTMLImportLoader_h 139 #endif // HTMLImportLoader_h
OLDNEW
« no previous file with comments | « no previous file | sky/engine/core/html/imports/HTMLImportLoader.cpp » ('j') | sky/engine/core/html/imports/HTMLImportLoader.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698