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

Unified Diff: Source/core/loader/DocumentWriter.h

Issue 17640007: Refactoring: Simplify DocumentWriter by reorganizing its lifetime. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed a build breakage Created 7 years, 6 months 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/loader/DocumentWriter.h
diff --git a/Source/core/loader/DocumentWriter.h b/Source/core/loader/DocumentWriter.h
index 56c8aabd74ebe92c5c721b87e4a9ea6a80a6aa30..b7927ef780e1eeda87f192e2db4e0d5893105e3a 100644
--- a/Source/core/loader/DocumentWriter.h
+++ b/Source/core/loader/DocumentWriter.h
@@ -44,46 +44,38 @@ class TextResourceDecoder;
class DocumentWriter {
WTF_MAKE_NONCOPYABLE(DocumentWriter);
public:
- explicit DocumentWriter(Frame*);
+ static PassOwnPtr<DocumentWriter> create(Document*, const String& mimeType = "", const String& encoding = "", bool encodingUserChoosen = false);
+
+ ~DocumentWriter();
+
+ void end();
// This is only called by ScriptController::executeScriptIfJavaScriptURL
// and always contains the result of evaluating a javascript: url.
void replaceDocument(const String&, Document* ownerDocument);
- void begin();
- void begin(const KURL&, bool dispatchWindowObjectAvailable = true, Document* ownerDocument = 0);
void addData(const char* bytes, size_t length);
- void end();
- void setFrame(Frame* frame) { m_frame = frame; }
-
const String& mimeType() const { return m_decoderBuilder.mimeType(); }
- void setMIMEType(const String& type) { m_decoderBuilder.setMIMEType(type); }
- void setEncoding(const String& encoding, bool userChosen) { m_decoderBuilder.setEncoding(encoding, userChosen); }
// Exposed for DocumentParser::appendBytes.
void reportDataReceived();
+ // Exposed for DocumentLoader::replaceDocument.
+ void appendReplacingData(const String&);
void setDocumentWasLoadedAsPartOfNavigation();
private:
- PassRefPtr<Document> createDocument(const KURL&);
- void clear();
+ DocumentWriter(Document*, const String& mimeType, const String& encoding, bool encodingUserChoosen);
- Frame* m_frame;
+ PassRefPtr<Document> createDocument(const KURL&);
+ Document* m_document;
bool m_hasReceivedSomeData;
TextResourceDecoderBuilder m_decoderBuilder;
RefPtr<TextResourceDecoder> m_decoder;
RefPtr<DocumentParser> m_parser;
-
- enum WriterState {
- NotStartedWritingState,
- StartedWritingState,
- FinishedWritingState,
- };
- WriterState m_state;
};
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698