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

Unified Diff: third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp

Issue 2318883002: Revert of Implement WTF::WeakPtr in terms of base::WeakPtr (Closed)
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
index 0a9187b1cb9175fb0a4352f7eaaea695aa665815..3002ac9ad7bfc93d64a921b431914a13f54c6383 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
@@ -761,6 +761,9 @@
if (document()->loader())
document()->ensureStyleResolver();
+ RefPtr<WeakReference<BackgroundHTMLParser>> reference = WeakReference<BackgroundHTMLParser>::createUnbound();
+ m_backgroundParser = WeakPtr<BackgroundHTMLParser>(reference);
+
std::unique_ptr<BackgroundHTMLParser::Configuration> config = wrapUnique(new BackgroundHTMLParser::Configuration);
config->options = m_options;
config->parser = m_weakFactory.createWeakPtr();
@@ -778,15 +781,15 @@
}
ASSERT(config->xssAuditor->isSafeToSendToAnotherThread());
-
- // The background parser is created on the main thread, but may otherwise
- // only be used from the parser thread.
- m_backgroundParser = BackgroundHTMLParser::create(
- std::move(config),
- m_loadingTaskRunner->clone());
- // TODO(csharrison): This is a hack to initialize MediaValuesCached on the
- // correct thread. We should get rid of it.
- postTaskToLookaheadParser(Synchronous, &BackgroundHTMLParser::init, m_backgroundParser, document()->url(), passed(CachedDocumentParameters::create(document())), MediaValuesCached::MediaValuesCachedData(*document()));
+ postTaskToLookaheadParser(
+ Synchronous,
+ &BackgroundHTMLParser::start,
+ reference.release(),
+ passed(std::move(config)),
+ document()->url(),
+ passed(CachedDocumentParameters::create(document())),
+ MediaValuesCached::MediaValuesCachedData(*document()),
+ passed(m_loadingTaskRunner->clone()));
}
void HTMLDocumentParser::stopBackgroundParser()

Powered by Google App Engine
This is Rietveld 408576698