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

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

Issue 535403002: introduce DocumentParserClient to receive parser stopped notification (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
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.
(...skipping 13 matching lines...) Expand all
24 #ifndef DocumentParser_h 24 #ifndef DocumentParser_h
25 #define DocumentParser_h 25 #define DocumentParser_h
26 26
27 #include "platform/heap/Handle.h" 27 #include "platform/heap/Handle.h"
28 #include "wtf/Forward.h" 28 #include "wtf/Forward.h"
29 #include "wtf/RefCounted.h" 29 #include "wtf/RefCounted.h"
30 30
31 namespace blink { 31 namespace blink {
32 32
33 class Document; 33 class Document;
34 class DocumentParserClient;
34 class SegmentedString; 35 class SegmentedString;
35 class ScriptableDocumentParser; 36 class ScriptableDocumentParser;
36 class TextResourceDecoder; 37 class TextResourceDecoder;
37 38
38 class DocumentParser : public RefCountedWillBeGarbageCollectedFinalized<Document Parser> { 39 class DocumentParser : public RefCountedWillBeGarbageCollectedFinalized<Document Parser> {
39 public: 40 public:
40 virtual ~DocumentParser(); 41 virtual ~DocumentParser();
41 virtual void trace(Visitor*); 42 virtual void trace(Visitor*);
42 43
43 virtual ScriptableDocumentParser* asScriptableDocumentParser() { return 0; } 44 virtual ScriptableDocumentParser* asScriptableDocumentParser() { return 0; }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // Oilpan: We don't need to call detach when a Document is destructed. 97 // Oilpan: We don't need to call detach when a Document is destructed.
97 virtual void detach(); 98 virtual void detach();
98 99
99 void setDocumentWasLoadedAsPartOfNavigation() { m_documentWasLoadedAsPartOfN avigation = true; } 100 void setDocumentWasLoadedAsPartOfNavigation() { m_documentWasLoadedAsPartOfN avigation = true; }
100 bool documentWasLoadedAsPartOfNavigation() const { return m_documentWasLoade dAsPartOfNavigation; } 101 bool documentWasLoadedAsPartOfNavigation() const { return m_documentWasLoade dAsPartOfNavigation; }
101 102
102 // FIXME: The names are not very accurate :( 103 // FIXME: The names are not very accurate :(
103 virtual void suspendScheduledTasks(); 104 virtual void suspendScheduledTasks();
104 virtual void resumeScheduledTasks(); 105 virtual void resumeScheduledTasks();
105 106
107 void addClient(DocumentParserClient*);
108 void removeClient(DocumentParserClient*);
109
106 protected: 110 protected:
107 explicit DocumentParser(Document*); 111 explicit DocumentParser(Document*);
108 112
109 virtual void flush() = 0; 113 virtual void flush() = 0;
110 114
111 private: 115 private:
112 enum ParserState { 116 enum ParserState {
113 ParsingState, 117 ParsingState,
114 StoppingState, 118 StoppingState,
115 StoppedState, 119 StoppedState,
116 DetachedState 120 DetachedState
117 }; 121 };
118 ParserState m_state; 122 ParserState m_state;
119 bool m_documentWasLoadedAsPartOfNavigation; 123 bool m_documentWasLoadedAsPartOfNavigation;
120 124
121 // Every DocumentParser needs a pointer back to the document. 125 // Every DocumentParser needs a pointer back to the document.
122 // m_document will be 0 after the parser is stopped. 126 // m_document will be 0 after the parser is stopped.
123 RawPtrWillBeMember<Document> m_document; 127 RawPtrWillBeMember<Document> m_document;
128
129 WillBeHeapHashSet<RawPtrWillBeMember<DocumentParserClient> > m_clients;
124 }; 130 };
125 131
126 } // namespace blink 132 } // namespace blink
127 133
128 #endif // DocumentParser_h 134 #endif // DocumentParser_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698