| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 14 matching lines...) Expand all Loading... |
| 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 MHTMLParser_h | 31 #ifndef MHTMLParser_h |
| 32 #define MHTMLParser_h | 32 #define MHTMLParser_h |
| 33 | 33 |
| 34 #include "platform/SharedBufferChunkReader.h" | 34 #include "platform/SharedBufferChunkReader.h" |
| 35 #include "platform/heap/Handle.h" |
| 35 #include "wtf/RefPtr.h" | 36 #include "wtf/RefPtr.h" |
| 36 #include "wtf/Vector.h" | 37 #include "wtf/Vector.h" |
| 37 | 38 |
| 38 namespace WTF { | 39 namespace WTF { |
| 39 class String; | 40 class String; |
| 40 } | 41 } |
| 41 | 42 |
| 42 namespace WebCore { | 43 namespace WebCore { |
| 43 | 44 |
| 44 class ArchiveResource; | 45 class ArchiveResource; |
| 45 class MHTMLArchive; | 46 class MHTMLArchive; |
| 46 class MIMEHeader; | 47 class MIMEHeader; |
| 47 class SharedBuffer; | 48 class SharedBuffer; |
| 48 | 49 |
| 49 class PLATFORM_EXPORT MHTMLParser { | 50 class PLATFORM_EXPORT MHTMLParser FINAL { |
| 51 STACK_ALLOCATED(); |
| 50 public: | 52 public: |
| 51 explicit MHTMLParser(SharedBuffer*); | 53 explicit MHTMLParser(SharedBuffer*); |
| 52 | 54 |
| 53 PassRefPtr<MHTMLArchive> parseArchive(); | 55 PassRefPtrWillBeRawPtr<MHTMLArchive> parseArchive(); |
| 54 | 56 |
| 55 size_t frameCount() const; | 57 size_t frameCount() const; |
| 56 MHTMLArchive* frameAt(size_t) const; | 58 MHTMLArchive* frameAt(size_t) const; |
| 57 | 59 |
| 58 size_t subResourceCount() const; | 60 size_t subResourceCount() const; |
| 59 ArchiveResource* subResourceAt(size_t) const; | 61 ArchiveResource* subResourceAt(size_t) const; |
| 60 | 62 |
| 61 private: | 63 private: |
| 62 PassRefPtr<MHTMLArchive> parseArchiveWithHeader(MIMEHeader*); | 64 PassRefPtrWillBeRawPtr<MHTMLArchive> parseArchiveWithHeader(MIMEHeader*); |
| 63 PassRefPtr<ArchiveResource> parseNextPart(const MIMEHeader&, const String& e
ndOfPartBoundary, const String& endOfDocumentBoundary, bool& endOfArchiveReached
); | 65 PassRefPtrWillBeRawPtr<ArchiveResource> parseNextPart(const MIMEHeader&, con
st String& endOfPartBoundary, const String& endOfDocumentBoundary, bool& endOfAr
chiveReached); |
| 64 | 66 |
| 65 void addResourceToArchive(ArchiveResource*, MHTMLArchive*); | 67 void addResourceToArchive(ArchiveResource*, MHTMLArchive*); |
| 66 | 68 |
| 67 SharedBufferChunkReader m_lineReader; | 69 SharedBufferChunkReader m_lineReader; |
| 68 Vector<RefPtr<ArchiveResource> > m_resources; | 70 WillBeHeapVector<RefPtrWillBeMember<ArchiveResource> > m_resources; |
| 69 Vector<RefPtr<MHTMLArchive> > m_frames; | 71 WillBeHeapVector<RefPtrWillBeMember<MHTMLArchive> > m_frames; |
| 70 }; | 72 }; |
| 71 | 73 |
| 72 } | 74 } |
| 73 | 75 |
| 74 #endif | 76 #endif |
| 75 | |
| OLD | NEW |