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

Unified Diff: third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.h

Issue 2683653004: Put the BackgroundHTMLParser on oilpan heap (Closed)
Patch Set: Save ASSERT->DCHECK for another patch Created 3 years, 10 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: third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.h
diff --git a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.h b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.h
index b2016554e2df5a4eaa1875b75265a45797cc6d8c..4ccbbab8adb7700c2e3000ab6f8f493cdcdb1906 100644
--- a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.h
+++ b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.h
@@ -26,6 +26,7 @@
#ifndef BackgroundHTMLParser_h
#define BackgroundHTMLParser_h
+#include <memory>
#include "core/dom/DocumentEncodingData.h"
#include "core/html/parser/BackgroundHTMLInputStream.h"
#include "core/html/parser/CompactHTMLToken.h"
@@ -36,8 +37,8 @@
#include "core/html/parser/TextResourceDecoder.h"
#include "core/html/parser/TokenizedChunkQueue.h"
#include "core/html/parser/XSSAuditorDelegate.h"
+#include "platform/heap/GarbageCollected.h"
#include "wtf/WeakPtr.h"
-#include <memory>
namespace blink {
@@ -45,8 +46,8 @@ class HTMLDocumentParser;
class XSSAuditor;
class WebTaskRunner;
-class BackgroundHTMLParser {
- USING_FAST_MALLOC(BackgroundHTMLParser);
+class BackgroundHTMLParser
+ : public GarbageCollectedFinalized<BackgroundHTMLParser> {
Yoav Weiss 2017/02/09 10:39:00 I don't think this needs to be Finalized, as it ha
Charlie Harrison 2017/02/13 22:55:32 It does need to be finalized, because a bunch of f
Yoav Weiss 2017/02/14 06:45:47 ok
WTF_MAKE_NONCOPYABLE(BackgroundHTMLParser);
public:
@@ -56,7 +57,6 @@ class BackgroundHTMLParser {
public:
Configuration();
HTMLParserOptions options;
- WeakPtr<HTMLDocumentParser> parser;
std::unique_ptr<XSSAuditor> xssAuditor;
std::unique_ptr<TextResourceDecoder> decoder;
RefPtr<TokenizedChunkQueue> tokenizedChunkQueue;
@@ -67,14 +67,12 @@ class BackgroundHTMLParser {
bool shouldCoalesceChunks;
};
- // The returned BackgroundHTMLParser should only be used on the parser
- // thread: it must first be initialized by calling init(), and free by
- // calling stop().
- static WeakPtr<BackgroundHTMLParser> create(std::unique_ptr<Configuration>,
- RefPtr<WebTaskRunner>);
- void init(const KURL& documentURL,
- std::unique_ptr<CachedDocumentParameters>,
- const MediaValuesCached::MediaValuesCachedData&);
+ static BackgroundHTMLParser* create(HTMLDocumentParser*,
+ Document&,
+ std::unique_ptr<Configuration>);
+ ~BackgroundHTMLParser();
+
+ DECLARE_TRACE();
struct Checkpoint {
USING_FAST_MALLOC(Checkpoint);
@@ -96,28 +94,27 @@ class BackgroundHTMLParser {
void resumeFrom(std::unique_ptr<Checkpoint>);
void startedChunkWithCheckpoint(HTMLInputCheckpoint);
void finish();
- void stop();
void forcePlaintextForTextDocument();
-
private:
- BackgroundHTMLParser(std::unique_ptr<Configuration>, RefPtr<WebTaskRunner>);
- ~BackgroundHTMLParser();
+ BackgroundHTMLParser(HTMLDocumentParser*,
+ std::unique_ptr<Configuration>,
+ RefPtr<WebTaskRunner>,
+ std::unique_ptr<TokenPreloadScanner>);
void appendDecodedBytes(const String&);
void markEndOfFile();
void pumpTokenizer();
+ void onResumeFrom(std::unique_ptr<Checkpoint>);
+ void onFinish();
+
// Returns whether or not the HTMLDocumentParser should be notified of
// pending chunks.
bool queueChunkForMainThread();
void notifyMainThreadOfNewChunks();
void updateDocument(const String& decodedData);
- template <typename FunctionType, typename... Ps>
- void runOnMainThread(FunctionType, Ps&&...);
-
- WeakPtrFactory<BackgroundHTMLParser> m_weakFactory;
BackgroundHTMLInputStream m_input;
HTMLSourceTracker m_sourceTracker;
std::unique_ptr<HTMLToken> m_token;
@@ -125,7 +122,7 @@ class BackgroundHTMLParser {
HTMLTreeBuilderSimulator m_treeBuilderSimulator;
HTMLParserOptions m_options;
const size_t m_outstandingTokenLimit;
- WeakPtr<HTMLDocumentParser> m_parser;
+ Member<HTMLDocumentParser> m_parser;
std::unique_ptr<CompactHTMLTokenStream> m_pendingTokens;
const size_t m_pendingTokenLimit;

Powered by Google App Engine
This is Rietveld 408576698