OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/html/parser/TokenizedChunkQueue.h" | 5 #include "core/html/parser/TokenizedChunkQueue.h" |
6 | 6 |
7 #include "platform/RuntimeEnabledFeatures.h" | 7 #include "platform/RuntimeEnabledFeatures.h" |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 bool TokenizedChunkQueue::enqueue( | 41 bool TokenizedChunkQueue::enqueue( |
42 std::unique_ptr<HTMLDocumentParser::TokenizedChunk> chunk) { | 42 std::unique_ptr<HTMLDocumentParser::TokenizedChunk> chunk) { |
43 MaybeLocker locker(m_mutex.get()); | 43 MaybeLocker locker(m_mutex.get()); |
44 | 44 |
45 m_pendingTokenCount += chunk->tokens->size(); | 45 m_pendingTokenCount += chunk->tokens->size(); |
46 m_peakPendingTokenCount = | 46 m_peakPendingTokenCount = |
47 std::max(m_peakPendingTokenCount, m_pendingTokenCount); | 47 std::max(m_peakPendingTokenCount, m_pendingTokenCount); |
48 | 48 |
49 bool wasEmpty = m_pendingChunks.isEmpty(); | 49 bool wasEmpty = m_pendingChunks.isEmpty(); |
50 m_pendingChunks.append(std::move(chunk)); | 50 m_pendingChunks.push_back(std::move(chunk)); |
51 m_peakPendingChunkCount = | 51 m_peakPendingChunkCount = |
52 std::max(m_peakPendingChunkCount, m_pendingChunks.size()); | 52 std::max(m_peakPendingChunkCount, m_pendingChunks.size()); |
53 | 53 |
54 return wasEmpty; | 54 return wasEmpty; |
55 } | 55 } |
56 | 56 |
57 void TokenizedChunkQueue::clear() { | 57 void TokenizedChunkQueue::clear() { |
58 MaybeLocker locker(m_mutex.get()); | 58 MaybeLocker locker(m_mutex.get()); |
59 | 59 |
60 m_pendingTokenCount = 0; | 60 m_pendingTokenCount = 0; |
(...skipping 12 matching lines...) Expand all Loading... |
73 MaybeLocker locker(m_mutex.get()); | 73 MaybeLocker locker(m_mutex.get()); |
74 return m_peakPendingChunkCount; | 74 return m_peakPendingChunkCount; |
75 } | 75 } |
76 | 76 |
77 size_t TokenizedChunkQueue::peakPendingTokenCount() { | 77 size_t TokenizedChunkQueue::peakPendingTokenCount() { |
78 MaybeLocker locker(m_mutex.get()); | 78 MaybeLocker locker(m_mutex.get()); |
79 return m_peakPendingTokenCount; | 79 return m_peakPendingTokenCount; |
80 } | 80 } |
81 | 81 |
82 } // namespace blink | 82 } // namespace blink |
OLD | NEW |