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

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

Issue 2181943002: Rename ParsedChunk to TokenizedChunk in core/html/parser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/ParsedChunkQueue.cpp
diff --git a/third_party/WebKit/Source/core/html/parser/ParsedChunkQueue.cpp b/third_party/WebKit/Source/core/html/parser/ParsedChunkQueue.cpp
deleted file mode 100644
index 77ac1d906a8710e3459074b6167e387535ea5d00..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/core/html/parser/ParsedChunkQueue.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "core/html/parser/ParsedChunkQueue.h"
-
-#include "platform/RuntimeEnabledFeatures.h"
-#include <algorithm>
-#include <memory>
-
-namespace blink {
-
-namespace {
-
-// TODO(csharrison): Remove this temporary class when the ParseHTMLOnMainThread
-// experiment ends.
-class MaybeLocker {
-public:
- MaybeLocker(Mutex* mutex)
- : m_mutex(mutex)
- {
- if (m_mutex)
- m_mutex->lock();
- }
- ~MaybeLocker()
- {
- if (m_mutex)
- m_mutex->unlock();
- }
-
-private:
- Mutex* m_mutex;
-};
-
-} // namespace
-
-ParsedChunkQueue::ParsedChunkQueue()
- : m_mutex(RuntimeEnabledFeatures::parseHTMLOnMainThreadEnabled() ? nullptr : new Mutex)
-{
-}
-
-ParsedChunkQueue::~ParsedChunkQueue()
-{
-}
-
-bool ParsedChunkQueue::enqueue(std::unique_ptr<HTMLDocumentParser::ParsedChunk> chunk)
-{
- MaybeLocker locker(m_mutex.get());
-
- m_pendingTokenCount += chunk->tokens->size();
- m_peakPendingTokenCount = std::max(m_peakPendingTokenCount, m_pendingTokenCount);
-
- bool wasEmpty = m_pendingChunks.isEmpty();
- m_pendingChunks.append(std::move(chunk));
- m_peakPendingChunkCount = std::max(m_peakPendingChunkCount, m_pendingChunks.size());
-
- return wasEmpty;
-}
-
-void ParsedChunkQueue::clear()
-{
- MaybeLocker locker(m_mutex.get());
-
- m_pendingTokenCount = 0;
- m_pendingChunks.clear();
-}
-
-void ParsedChunkQueue::takeAll(Vector<std::unique_ptr<HTMLDocumentParser::ParsedChunk>>& vector)
-{
- MaybeLocker locker(m_mutex.get());
-
- ASSERT(vector.isEmpty());
- m_pendingChunks.swap(vector);
-}
-
-size_t ParsedChunkQueue::peakPendingChunkCount()
-{
- MaybeLocker locker(m_mutex.get());
- return m_peakPendingChunkCount;
-}
-
-size_t ParsedChunkQueue::peakPendingTokenCount()
-{
- MaybeLocker locker(m_mutex.get());
- return m_peakPendingTokenCount;
-}
-
-} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698