| 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 24 matching lines...) Expand all Loading... |
| 35 #include "platform/fetcher/MojoFetcher.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; | |
| 46 class HTMLImportChild; | 45 class HTMLImportChild; |
| 47 class HTMLImportsController; | 46 class HTMLImportsController; |
| 48 | 47 |
| 49 | |
| 50 // | |
| 51 // Owning imported Document lifetime. It also implements ResourceClient through
ResourceOwner | |
| 52 // to feed fetched bytes to the DocumentWriter of the imported document. | |
| 53 // HTMLImportLoader is owned by HTMLImportsController. | |
| 54 // | |
| 55 // | |
| 56 class HTMLImportLoader final : public NoBaseWillBeGarbageCollectedFinalized<HTML
ImportLoader>, | 48 class HTMLImportLoader final : public NoBaseWillBeGarbageCollectedFinalized<HTML
ImportLoader>, |
| 57 public MojoFetcher::Client, | 49 public MojoFetcher::Client { |
| 58 public DataPipeDrainer::Client { | |
| 59 public: | 50 public: |
| 60 enum State { | 51 enum State { |
| 61 StateLoading, | 52 StateLoading, |
| 62 StateWritten, | 53 StateWritten, |
| 63 StateParsed, | 54 StateParsed, |
| 64 StateLoaded, | 55 StateLoaded, |
| 65 StateError | 56 StateError |
| 66 }; | 57 }; |
| 67 | 58 |
| 68 static PassOwnPtrWillBeRawPtr<HTMLImportLoader> create(HTMLImportsController
* controller) | 59 static PassOwnPtrWillBeRawPtr<HTMLImportLoader> create(HTMLImportsController
* controller) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 PassRefPtrWillBeRawPtr<CustomElementSyncMicrotaskQueue> microtaskQueue() con
st; | 92 PassRefPtrWillBeRawPtr<CustomElementSyncMicrotaskQueue> microtaskQueue() con
st; |
| 102 | 93 |
| 103 virtual void trace(Visitor*); | 94 virtual void trace(Visitor*); |
| 104 | 95 |
| 105 private: | 96 private: |
| 106 HTMLImportLoader(HTMLImportsController*); | 97 HTMLImportLoader(HTMLImportsController*); |
| 107 | 98 |
| 108 // MojoFetcher::Client | 99 // MojoFetcher::Client |
| 109 void OnReceivedResponse(mojo::URLResponsePtr) override; | 100 void OnReceivedResponse(mojo::URLResponsePtr) override; |
| 110 | 101 |
| 111 // DataPipeDrainer::Client | |
| 112 void OnDataAvailable(const void* data, size_t num_bytes) override; | |
| 113 void OnDataComplete() override; | |
| 114 | |
| 115 State startWritingAndParsing(mojo::URLResponsePtr); | 102 State startWritingAndParsing(mojo::URLResponsePtr); |
| 116 State finishWriting(); | 103 State finishWriting(); |
| 117 State finishParsing(); | 104 State finishParsing(); |
| 118 State finishLoading(); | 105 State finishLoading(); |
| 119 | 106 |
| 120 void setState(State); | 107 void setState(State); |
| 121 void didFinishLoading(); | 108 void didFinishLoading(); |
| 122 #if !ENABLE(OILPAN) | 109 #if !ENABLE(OILPAN) |
| 123 void clear(); | 110 void clear(); |
| 124 #endif | 111 #endif |
| 125 | 112 |
| 126 RawPtrWillBeMember<HTMLImportsController> m_controller; | 113 RawPtrWillBeMember<HTMLImportsController> m_controller; |
| 127 WillBeHeapVector<RawPtrWillBeMember<HTMLImportChild> > m_imports; | 114 WillBeHeapVector<RawPtrWillBeMember<HTMLImportChild> > m_imports; |
| 128 State m_state; | 115 State m_state; |
| 129 RefPtrWillBeMember<Document> m_document; | 116 RefPtrWillBeMember<Document> m_document; |
| 130 RefPtrWillBeMember<DocumentWriter> m_writer; | |
| 131 RefPtrWillBeMember<CustomElementSyncMicrotaskQueue> m_microtaskQueue; | 117 RefPtrWillBeMember<CustomElementSyncMicrotaskQueue> m_microtaskQueue; |
| 132 | 118 |
| 133 OwnPtr<MojoFetcher> m_fetcher; | 119 OwnPtr<MojoFetcher> m_fetcher; |
| 134 OwnPtr<DataPipeDrainer> m_drainer; | |
| 135 }; | 120 }; |
| 136 | 121 |
| 137 } // namespace blink | 122 } // namespace blink |
| 138 | 123 |
| 139 #endif // HTMLImportLoader_h | 124 #endif // HTMLImportLoader_h |
| OLD | NEW |