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

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

Issue 1394663004: Reland: BackgroundHTMLParser: Introduce ParsedChunkQueue to pass ParsedChunks to main thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ParsedChunkQueue should be ThreadSafeRefCounted Created 5 years, 2 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
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/ParsedChunkQueue.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
new file mode 100644
index 0000000000000000000000000000000000000000..338717a96ec9e99f05080761573c69a5d3c6b5b1
--- /dev/null
+++ b/third_party/WebKit/Source/core/html/parser/ParsedChunkQueue.cpp
@@ -0,0 +1,42 @@
+// 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 "config.h"
+#include "core/html/parser/ParsedChunkQueue.h"
+
+namespace blink {
+
+ParsedChunkQueue::ParsedChunkQueue()
+{
+}
+
+ParsedChunkQueue::~ParsedChunkQueue()
+{
+}
+
+bool ParsedChunkQueue::enqueue(PassOwnPtr<HTMLDocumentParser::ParsedChunk> chunk)
+{
+ MutexLocker locker(m_mutex);
+
+ bool wasEmpty = m_pendingChunks.isEmpty();
+ m_pendingChunks.append(chunk);
+ return wasEmpty;
+}
+
+void ParsedChunkQueue::clear()
+{
+ MutexLocker locker(m_mutex);
+
+ m_pendingChunks.clear();
+}
+
+void ParsedChunkQueue::takeAll(Vector<OwnPtr<HTMLDocumentParser::ParsedChunk>>& vector)
+{
+ MutexLocker locker(m_mutex);
+
+ ASSERT(vector.isEmpty());
+ m_pendingChunks.swap(vector);
+}
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/ParsedChunkQueue.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698