| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2000 Peter Kelly (pmk@post.com) | 2 * Copyright (C) 2000 Peter Kelly (pmk@post.com) |
| 3 * Copyright (C) 2005, 2006 Apple Computer, Inc. | 3 * Copyright (C) 2005, 2006 Apple Computer, Inc. |
| 4 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) | 4 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) |
| 5 * Copyright (C) 2010 Google, Inc. | 5 * Copyright (C) 2010 Google, Inc. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // insert is used by document.write. | 51 // insert is used by document.write. |
| 52 virtual void insert(const SegmentedString&) = 0; | 52 virtual void insert(const SegmentedString&) = 0; |
| 53 | 53 |
| 54 // The below functions are used by DocumentWriter (the loader). | 54 // The below functions are used by DocumentWriter (the loader). |
| 55 virtual void appendBytes(const char* bytes, size_t length) = 0; | 55 virtual void appendBytes(const char* bytes, size_t length) = 0; |
| 56 virtual bool needsDecoder() const { return false; } | 56 virtual bool needsDecoder() const { return false; } |
| 57 virtual void setDecoder(std::unique_ptr<TextResourceDecoder>); | 57 virtual void setDecoder(std::unique_ptr<TextResourceDecoder>); |
| 58 virtual TextResourceDecoder* decoder(); | 58 virtual TextResourceDecoder* decoder(); |
| 59 virtual void setHasAppendedData() {} | 59 virtual void setHasAppendedData() {} |
| 60 | 60 |
| 61 // FIXME: append() should be private, but DocumentLoader and DOMPatchSupport u
ses it for now. | 61 // FIXME: append() should be private, but DocumentLoader and DOMPatchSupport |
| 62 // uses it for now. |
| 62 virtual void append(const String&) = 0; | 63 virtual void append(const String&) = 0; |
| 63 | 64 |
| 64 virtual void finish() = 0; | 65 virtual void finish() = 0; |
| 65 | 66 |
| 66 // document() will return 0 after detach() is called. | 67 // document() will return 0 after detach() is called. |
| 67 Document* document() const { | 68 Document* document() const { |
| 68 DCHECK(m_document); | 69 DCHECK(m_document); |
| 69 return m_document; | 70 return m_document; |
| 70 } | 71 } |
| 71 | 72 |
| 72 bool isParsing() const { return m_state == ParsingState; } | 73 bool isParsing() const { return m_state == ParsingState; } |
| 73 bool isStopping() const { return m_state == StoppingState; } | 74 bool isStopping() const { return m_state == StoppingState; } |
| 74 bool isStopped() const { return m_state >= StoppedState; } | 75 bool isStopped() const { return m_state >= StoppedState; } |
| 75 bool isDetached() const { return m_state == DetachedState; } | 76 bool isDetached() const { return m_state == DetachedState; } |
| 76 | 77 |
| 77 // prepareToStop() is used when the EOF token is encountered and parsing is to
be | 78 // prepareToStop() is used when the EOF token is encountered and parsing is to |
| 78 // stopped normally. | 79 // be stopped normally. |
| 79 virtual void prepareToStopParsing(); | 80 virtual void prepareToStopParsing(); |
| 80 | 81 |
| 81 // stopParsing() is used when a load is canceled/stopped. | 82 // stopParsing() is used when a load is canceled/stopped. |
| 82 // stopParsing() is currently different from detach(), but shouldn't be. | 83 // stopParsing() is currently different from detach(), but shouldn't be. |
| 83 // It should NOT be ok to call any methods on DocumentParser after either | 84 // It should NOT be ok to call any methods on DocumentParser after either |
| 84 // detach() or stopParsing() but right now only detach() will ASSERT. | 85 // detach() or stopParsing() but right now only detach() will ASSERT. |
| 85 virtual void stopParsing(); | 86 virtual void stopParsing(); |
| 86 | 87 |
| 87 // Document is expected to detach the parser before releasing its ref. | 88 // Document is expected to detach the parser before releasing its ref. |
| 88 // After detach, m_document is cleared. The parser will unwind its | 89 // After detach, m_document is cleared. The parser will unwind its |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // Every DocumentParser needs a pointer back to the document. | 122 // Every DocumentParser needs a pointer back to the document. |
| 122 // m_document will be 0 after the parser is stopped. | 123 // m_document will be 0 after the parser is stopped. |
| 123 Member<Document> m_document; | 124 Member<Document> m_document; |
| 124 | 125 |
| 125 HeapHashSet<WeakMember<DocumentParserClient>> m_clients; | 126 HeapHashSet<WeakMember<DocumentParserClient>> m_clients; |
| 126 }; | 127 }; |
| 127 | 128 |
| 128 } // namespace blink | 129 } // namespace blink |
| 129 | 130 |
| 130 #endif // DocumentParser_h | 131 #endif // DocumentParser_h |
| OLD | NEW |