Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(542)

Side by Side Diff: Source/core/dom/DocumentParser.h

Issue 69823002: Move ownership of the TextResourceDecoder to DecodedDataDocumentParser (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Review fixes Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/dom/DocumentEncodingData.h ('k') | Source/core/dom/DocumentParser.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.
11 * 11 *
12 * This library is distributed in the hope that it will be useful, 12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details. 15 * Library General Public License for more details.
16 * 16 *
17 * You should have received a copy of the GNU Library General Public License 17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to 18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA. 20 * Boston, MA 02110-1301, USA.
21 * 21 *
22 */ 22 */
23 23
24 #ifndef DocumentParser_h 24 #ifndef DocumentParser_h
25 #define DocumentParser_h 25 #define DocumentParser_h
26 26
27 #include "wtf/Forward.h" 27 #include "wtf/Forward.h"
28 #include "wtf/RefCounted.h" 28 #include "wtf/RefCounted.h"
29 #include "wtf/RefPtr.h"
29 30
30 namespace WebCore { 31 namespace WebCore {
31 32
32 class Document; 33 class Document;
33 class DocumentWriter; 34 class DocumentWriter;
34 class SegmentedString; 35 class SegmentedString;
35 class ScriptableDocumentParser; 36 class ScriptableDocumentParser;
37 class TextResourceDecoder;
36 38
37 class DocumentParser : public RefCounted<DocumentParser> { 39 class DocumentParser : public RefCounted<DocumentParser> {
38 public: 40 public:
39 virtual ~DocumentParser(); 41 virtual ~DocumentParser();
40 42
41 virtual ScriptableDocumentParser* asScriptableDocumentParser() { return 0; } 43 virtual ScriptableDocumentParser* asScriptableDocumentParser() { return 0; }
42 44
43 // http://www.whatwg.org/specs/web-apps/current-work/#insertion-point 45 // http://www.whatwg.org/specs/web-apps/current-work/#insertion-point
44 virtual bool hasInsertionPoint() { return true; } 46 virtual bool hasInsertionPoint() { return true; }
45 47
46 // insert is used by document.write. 48 // insert is used by document.write.
47 virtual void insert(const SegmentedString&) = 0; 49 virtual void insert(const SegmentedString&) = 0;
48 50
49 // appendBytes and flush are used by DocumentWriter (the loader). 51 // The below functions are used by DocumentWriter (the loader).
50 virtual size_t appendBytes(const char* bytes, size_t length) = 0; 52 virtual size_t appendBytes(const char* bytes, size_t length) = 0;
51 virtual size_t flush() = 0; 53 virtual size_t flush() = 0;
52 virtual bool needsDecoder() const { return false; } 54 virtual bool needsDecoder() const { return false; }
55 virtual void setDecoder(PassRefPtr<TextResourceDecoder>);
56 virtual PassRefPtr<TextResourceDecoder> decoder();
53 57
54 // pinToMainThread also makes append() not yield before completion of that c hunk. 58 // pinToMainThread also makes append() not yield before completion of that c hunk.
55 virtual void pinToMainThread() { } 59 virtual void pinToMainThread() { }
56 60
57 // FIXME: append() should be private, but DocumentWriter::replaceDocument us es it for now. 61 // FIXME: append() should be private, but DocumentWriter::replaceDocument us es it for now.
58 // FIXME: This really should take a PassOwnPtr to signify that it expects to take 62 // FIXME: This really should take a PassOwnPtr to signify that it expects to take
59 // ownership of the buffer. The parser expects the PassRefPtr to hold the on ly ref of the StringImpl. 63 // ownership of the buffer. The parser expects the PassRefPtr to hold the on ly ref of the StringImpl.
60 virtual void append(PassRefPtr<StringImpl>) = 0; 64 virtual void append(PassRefPtr<StringImpl>) = 0;
61 65
62 virtual void finish() = 0; 66 virtual void finish() = 0;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 bool m_documentWasLoadedAsPartOfNavigation; 119 bool m_documentWasLoadedAsPartOfNavigation;
116 120
117 // Every DocumentParser needs a pointer back to the document. 121 // Every DocumentParser needs a pointer back to the document.
118 // m_document will be 0 after the parser is stopped. 122 // m_document will be 0 after the parser is stopped.
119 Document* m_document; 123 Document* m_document;
120 }; 124 };
121 125
122 } // namespace WebCore 126 } // namespace WebCore
123 127
124 #endif // DocumentParser_h 128 #endif // DocumentParser_h
OLDNEW
« no previous file with comments | « Source/core/dom/DocumentEncodingData.h ('k') | Source/core/dom/DocumentParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698