OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010. Adam Barth. All rights reserved. | 2 * Copyright (C) 2010. Adam Barth. 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 13 matching lines...) Expand all Loading... |
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 */ | 27 */ |
28 | 28 |
29 #include "config.h" | 29 #include "config.h" |
30 #include "core/loader/DocumentWriter.h" | 30 #include "core/loader/DocumentWriter.h" |
31 | 31 |
32 #include "core/dom/Document.h" | 32 #include "core/dom/Document.h" |
33 #include "core/dom/ScriptableDocumentParser.h" | 33 #include "core/dom/ScriptableDocumentParser.h" |
| 34 #include "core/frame/FrameView.h" |
| 35 #include "core/frame/LocalDOMWindow.h" |
| 36 #include "core/frame/LocalFrame.h" |
| 37 #include "core/frame/Settings.h" |
34 #include "core/html/parser/TextResourceDecoder.h" | 38 #include "core/html/parser/TextResourceDecoder.h" |
35 #include "core/loader/FrameLoader.h" | 39 #include "core/loader/FrameLoader.h" |
36 #include "core/loader/FrameLoaderStateMachine.h" | 40 #include "core/loader/FrameLoaderStateMachine.h" |
37 #include "core/frame/LocalDOMWindow.h" | |
38 #include "core/frame/FrameView.h" | |
39 #include "core/frame/LocalFrame.h" | |
40 #include "core/frame/Settings.h" | |
41 #include "platform/weborigin/KURL.h" | 41 #include "platform/weborigin/KURL.h" |
42 #include "platform/weborigin/SecurityOrigin.h" | 42 #include "platform/weborigin/SecurityOrigin.h" |
43 #include "wtf/PassOwnPtr.h" | 43 #include "wtf/PassOwnPtr.h" |
44 | 44 |
45 namespace blink { | 45 namespace blink { |
46 | 46 |
47 PassRefPtrWillBeRawPtr<DocumentWriter> DocumentWriter::create(Document* document
, const AtomicString& mimeType, const AtomicString& encoding) | 47 PassRefPtrWillBeRawPtr<DocumentWriter> DocumentWriter::create(Document* document
, const AtomicString& mimeType, const AtomicString& encoding) |
48 { | 48 { |
49 return adoptRefWillBeNoop(new DocumentWriter(document, mimeType, encoding)); | 49 return adoptRefWillBeNoop(new DocumentWriter(document, mimeType, encoding)); |
50 } | 50 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 m_parser->appendBytes(bytes, length); | 99 m_parser->appendBytes(bytes, length); |
100 } | 100 } |
101 | 101 |
102 void DocumentWriter::end() | 102 void DocumentWriter::end() |
103 { | 103 { |
104 ASSERT(m_document); | 104 ASSERT(m_document); |
105 | 105 |
106 // http://bugs.webkit.org/show_bug.cgi?id=10854 | 106 // http://bugs.webkit.org/show_bug.cgi?id=10854 |
107 // The frame's last ref may be removed and it can be deleted by checkComplet
ed(), | 107 // The frame's last ref may be removed and it can be deleted by checkComplet
ed(), |
108 // so we'll add a protective refcount | 108 // so we'll add a protective refcount |
109 RefPtr<LocalFrame> protector(m_document->frame()); | 109 RefPtrWillBeRawPtr<LocalFrame> protect(m_document->frame()); |
110 | 110 |
111 if (!m_parser) | 111 if (!m_parser) |
112 return; | 112 return; |
113 | 113 |
114 if (m_parser->needsDecoder()) { | 114 if (m_parser->needsDecoder()) { |
115 OwnPtr<TextResourceDecoder> decoder = m_decoderBuilder.buildFor(m_docume
nt); | 115 OwnPtr<TextResourceDecoder> decoder = m_decoderBuilder.buildFor(m_docume
nt); |
116 m_parser->setDecoder(decoder.release()); | 116 m_parser->setDecoder(decoder.release()); |
117 } | 117 } |
118 | 118 |
119 // finish() can result replacing DocumentLoader::m_writer. | 119 // finish() can result replacing DocumentLoader::m_writer. |
(...skipping 10 matching lines...) Expand all Loading... |
130 decoder->setEncoding(charset, TextResourceDecoder::UserChosenEncoding); | 130 decoder->setEncoding(charset, TextResourceDecoder::UserChosenEncoding); |
131 } | 131 } |
132 | 132 |
133 void DocumentWriter::setDocumentWasLoadedAsPartOfNavigation() | 133 void DocumentWriter::setDocumentWasLoadedAsPartOfNavigation() |
134 { | 134 { |
135 ASSERT(m_parser && !m_parser->isStopped()); | 135 ASSERT(m_parser && !m_parser->isStopped()); |
136 m_parser->setDocumentWasLoadedAsPartOfNavigation(); | 136 m_parser->setDocumentWasLoadedAsPartOfNavigation(); |
137 } | 137 } |
138 | 138 |
139 } // namespace blink | 139 } // namespace blink |
OLD | NEW |