| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 // | 50 // |
| 51 class HTMLImportLoader FINAL : public RefCounted<HTMLImportLoader>, public Resou
rceOwner<RawResource> { | 51 class HTMLImportLoader FINAL : public RefCounted<HTMLImportLoader>, public Resou
rceOwner<RawResource> { |
| 52 public: | 52 public: |
| 53 enum State { | 53 enum State { |
| 54 StateLoading, | 54 StateLoading, |
| 55 StateWritten, | 55 StateWritten, |
| 56 StateError, | 56 StateError, |
| 57 StateReady | 57 StateReady |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 static PassRefPtr<HTMLImportLoader> create(HTMLImport*, ResourceFetcher*); | 60 static PassRefPtr<HTMLImportLoader> create(HTMLImport* import) |
| 61 { |
| 62 return adoptRef(new HTMLImportLoader(import)); |
| 63 } |
| 61 | 64 |
| 62 virtual ~HTMLImportLoader(); | 65 virtual ~HTMLImportLoader(); |
| 63 | 66 |
| 64 Document* document() const { return m_importedDocument.get(); } | 67 Document* document() const { return m_importedDocument.get(); } |
| 65 Document* importedDocument() const; | 68 Document* importedDocument() const; |
| 66 void addClient(HTMLImportLoaderClient*); | 69 void addClient(HTMLImportLoaderClient*); |
| 67 void removeClient(HTMLImportLoaderClient*); | 70 void removeClient(HTMLImportLoaderClient*); |
| 68 | 71 |
| 69 bool isDone() const { return m_state == StateReady || m_state == StateError;
} | 72 bool isDone() const { return m_state == StateReady || m_state == StateError;
} |
| 70 bool hasError() const { return m_state == StateError; } | 73 bool hasError() const { return m_state == StateError; } |
| 71 | 74 |
| 72 void startLoading(const ResourcePtr<RawResource>&); | 75 void startLoading(const ResourcePtr<RawResource>&); |
| 73 void didFinishParsing(); | 76 void didFinishParsing(); |
| 74 bool isOwnedBy(const HTMLImport* import) const { return m_import == import;
} | 77 bool isOwnedBy(const HTMLImport* import) const { return m_import == import;
} |
| 75 | 78 |
| 76 private: | 79 private: |
| 77 HTMLImportLoader(HTMLImport*, ResourceFetcher*); | 80 HTMLImportLoader(HTMLImport*); |
| 78 | 81 |
| 79 // RawResourceClient | 82 // RawResourceClient |
| 80 virtual void responseReceived(Resource*, const ResourceResponse&) OVERRIDE; | 83 virtual void responseReceived(Resource*, const ResourceResponse&) OVERRIDE; |
| 81 virtual void dataReceived(Resource*, const char* data, int length) OVERRIDE; | 84 virtual void dataReceived(Resource*, const char* data, int length) OVERRIDE; |
| 82 virtual void notifyFinished(Resource*) OVERRIDE; | 85 virtual void notifyFinished(Resource*) OVERRIDE; |
| 83 | 86 |
| 84 State startWritingAndParsing(const ResourceResponse&); | 87 State startWritingAndParsing(const ResourceResponse&); |
| 85 State finishWriting(); | 88 State finishWriting(); |
| 86 State finishParsing(); | 89 State finishParsing(); |
| 87 | 90 |
| 88 void setState(State); | 91 void setState(State); |
| 89 void didFinish(); | 92 void didFinish(); |
| 90 | 93 |
| 91 HTMLImport* m_import; | 94 HTMLImport* m_import; |
| 92 ResourceFetcher* m_fetcher; | |
| 93 Vector<HTMLImportLoaderClient*> m_clients; | 95 Vector<HTMLImportLoaderClient*> m_clients; |
| 94 State m_state; | 96 State m_state; |
| 95 RefPtr<Document> m_importedDocument; | 97 RefPtr<Document> m_importedDocument; |
| 96 RefPtr<DocumentWriter> m_writer; | 98 RefPtr<DocumentWriter> m_writer; |
| 97 }; | 99 }; |
| 98 | 100 |
| 99 } // namespace WebCore | 101 } // namespace WebCore |
| 100 | 102 |
| 101 #endif // HTMLImportLoader_h | 103 #endif // HTMLImportLoader_h |
| OLD | NEW |