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

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

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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: third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp
diff --git a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp
index a022af565ecae3dd8f73203a58855b00dbc2c437..d2e5924f5214a552e001bb7cab419b8e1ed9ae40 100644
--- a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp
+++ b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp
@@ -33,9 +33,7 @@
#include "platform/TraceEvent.h"
#include "public/platform/Platform.h"
#include "public/platform/WebTaskRunner.h"
-#include "wtf/PtrUtil.h"
#include "wtf/text/TextPosition.h"
-#include <memory>
namespace blink {
@@ -82,7 +80,7 @@ static void checkThatXSSInfosAreSafeToSendToAnotherThread(const XSSInfoStream& i
#endif
-void BackgroundHTMLParser::start(PassRefPtr<WeakReference<BackgroundHTMLParser>> reference, std::unique_ptr<Configuration> config, const KURL& documentURL, std::unique_ptr<CachedDocumentParameters> cachedDocumentParameters, const MediaValuesCached::MediaValuesCachedData& mediaValuesCachedData, std::unique_ptr<WebTaskRunner> loadingTaskRunner)
+void BackgroundHTMLParser::start(PassRefPtr<WeakReference<BackgroundHTMLParser>> reference, PassOwnPtr<Configuration> config, const KURL& documentURL, PassOwnPtr<CachedDocumentParameters> cachedDocumentParameters, const MediaValuesCached::MediaValuesCachedData& mediaValuesCachedData, PassOwnPtr<WebTaskRunner> loadingTaskRunner)
{
new BackgroundHTMLParser(reference, std::move(config), documentURL, std::move(cachedDocumentParameters), mediaValuesCachedData, std::move(loadingTaskRunner));
// Caller must free by calling stop().
@@ -94,18 +92,18 @@ BackgroundHTMLParser::Configuration::Configuration()
{
}
-BackgroundHTMLParser::BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHTMLParser>> reference, std::unique_ptr<Configuration> config, const KURL& documentURL, std::unique_ptr<CachedDocumentParameters> cachedDocumentParameters, const MediaValuesCached::MediaValuesCachedData& mediaValuesCachedData, std::unique_ptr<WebTaskRunner> loadingTaskRunner)
+BackgroundHTMLParser::BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHTMLParser>> reference, PassOwnPtr<Configuration> config, const KURL& documentURL, PassOwnPtr<CachedDocumentParameters> cachedDocumentParameters, const MediaValuesCached::MediaValuesCachedData& mediaValuesCachedData, PassOwnPtr<WebTaskRunner> loadingTaskRunner)
: m_weakFactory(reference, this)
- , m_token(wrapUnique(new HTMLToken))
+ , m_token(adoptPtr(new HTMLToken))
, m_tokenizer(HTMLTokenizer::create(config->options))
, m_treeBuilderSimulator(config->options)
, m_options(config->options)
, m_outstandingTokenLimit(config->outstandingTokenLimit)
, m_parser(config->parser)
- , m_pendingTokens(wrapUnique(new CompactHTMLTokenStream))
+ , m_pendingTokens(adoptPtr(new CompactHTMLTokenStream))
, m_pendingTokenLimit(config->pendingTokenLimit)
, m_xssAuditor(std::move(config->xssAuditor))
- , m_preloadScanner(wrapUnique(new TokenPreloadScanner(documentURL, std::move(cachedDocumentParameters), mediaValuesCachedData)))
+ , m_preloadScanner(adoptPtr(new TokenPreloadScanner(documentURL, std::move(cachedDocumentParameters), mediaValuesCachedData)))
, m_decoder(std::move(config->decoder))
, m_loadingTaskRunner(std::move(loadingTaskRunner))
, m_parsedChunkQueue(config->parsedChunkQueue.release())
@@ -126,7 +124,7 @@ void BackgroundHTMLParser::appendRawBytesFromParserThread(const char* data, int
updateDocument(m_decoder->decode(data, dataLength));
}
-void BackgroundHTMLParser::appendRawBytesFromMainThread(std::unique_ptr<Vector<char>> buffer)
+void BackgroundHTMLParser::appendRawBytesFromMainThread(PassOwnPtr<Vector<char>> buffer)
{
ASSERT(m_decoder);
updateDocument(m_decoder->decode(buffer->data(), buffer->size()));
@@ -139,7 +137,7 @@ void BackgroundHTMLParser::appendDecodedBytes(const String& input)
pumpTokenizer();
}
-void BackgroundHTMLParser::setDecoder(std::unique_ptr<TextResourceDecoder> decoder)
+void BackgroundHTMLParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder)
{
ASSERT(decoder);
m_decoder = std::move(decoder);
@@ -170,7 +168,7 @@ void BackgroundHTMLParser::updateDocument(const String& decodedData)
appendDecodedBytes(decodedData);
}
-void BackgroundHTMLParser::resumeFrom(std::unique_ptr<Checkpoint> checkpoint)
+void BackgroundHTMLParser::resumeFrom(PassOwnPtr<Checkpoint> checkpoint)
{
m_parser = checkpoint->parser;
m_token = std::move(checkpoint->token);
@@ -242,7 +240,7 @@ void BackgroundHTMLParser::pumpTokenizer()
{
TextPosition position = TextPosition(m_input.current().currentLine(), m_input.current().currentColumn());
- if (std::unique_ptr<XSSInfo> xssInfo = m_xssAuditor->filterToken(FilterTokenRequest(*m_token, m_sourceTracker, m_tokenizer->shouldAllowCDATA()))) {
+ if (OwnPtr<XSSInfo> xssInfo = m_xssAuditor->filterToken(FilterTokenRequest(*m_token, m_sourceTracker, m_tokenizer->shouldAllowCDATA()))) {
xssInfo->m_textPosition = position;
m_pendingXSSInfos.append(std::move(xssInfo));
}
@@ -289,7 +287,7 @@ void BackgroundHTMLParser::sendTokensToMainThread()
checkThatXSSInfosAreSafeToSendToAnotherThread(m_pendingXSSInfos);
#endif
- std::unique_ptr<HTMLDocumentParser::ParsedChunk> chunk = wrapUnique(new HTMLDocumentParser::ParsedChunk);
+ OwnPtr<HTMLDocumentParser::ParsedChunk> chunk = adoptPtr(new HTMLDocumentParser::ParsedChunk);
TRACE_EVENT_WITH_FLOW0("blink,loading", "BackgroundHTMLParser::sendTokensToMainThread", chunk.get(), TRACE_EVENT_FLAG_FLOW_OUT);
chunk->preloads.swap(m_pendingPreloads);
if (m_viewportDescription.set)
@@ -311,7 +309,7 @@ void BackgroundHTMLParser::sendTokensToMainThread()
threadSafeBind(&HTMLDocumentParser::notifyPendingParsedChunks, m_parser));
}
- m_pendingTokens = wrapUnique(new CompactHTMLTokenStream);
+ m_pendingTokens = adoptPtr(new CompactHTMLTokenStream);
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698