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/ParsedChunkQueue.h" | 5 #include "core/html/parser/ParsedChunkQueue.h" |
6 | 6 |
| 7 #include <memory> |
| 8 |
7 namespace blink { | 9 namespace blink { |
8 | 10 |
9 ParsedChunkQueue::ParsedChunkQueue() | 11 ParsedChunkQueue::ParsedChunkQueue() |
10 { | 12 { |
11 } | 13 } |
12 | 14 |
13 ParsedChunkQueue::~ParsedChunkQueue() | 15 ParsedChunkQueue::~ParsedChunkQueue() |
14 { | 16 { |
15 } | 17 } |
16 | 18 |
17 bool ParsedChunkQueue::enqueue(PassOwnPtr<HTMLDocumentParser::ParsedChunk> chunk
) | 19 bool ParsedChunkQueue::enqueue(std::unique_ptr<HTMLDocumentParser::ParsedChunk>
chunk) |
18 { | 20 { |
19 MutexLocker locker(m_mutex); | 21 MutexLocker locker(m_mutex); |
20 | 22 |
21 bool wasEmpty = m_pendingChunks.isEmpty(); | 23 bool wasEmpty = m_pendingChunks.isEmpty(); |
22 m_pendingChunks.append(std::move(chunk)); | 24 m_pendingChunks.append(std::move(chunk)); |
23 return wasEmpty; | 25 return wasEmpty; |
24 } | 26 } |
25 | 27 |
26 void ParsedChunkQueue::clear() | 28 void ParsedChunkQueue::clear() |
27 { | 29 { |
28 MutexLocker locker(m_mutex); | 30 MutexLocker locker(m_mutex); |
29 | 31 |
30 m_pendingChunks.clear(); | 32 m_pendingChunks.clear(); |
31 } | 33 } |
32 | 34 |
33 void ParsedChunkQueue::takeAll(Vector<OwnPtr<HTMLDocumentParser::ParsedChunk>>&
vector) | 35 void ParsedChunkQueue::takeAll(Vector<std::unique_ptr<HTMLDocumentParser::Parsed
Chunk>>& vector) |
34 { | 36 { |
35 MutexLocker locker(m_mutex); | 37 MutexLocker locker(m_mutex); |
36 | 38 |
37 ASSERT(vector.isEmpty()); | 39 ASSERT(vector.isEmpty()); |
38 m_pendingChunks.swap(vector); | 40 m_pendingChunks.swap(vector); |
39 } | 41 } |
40 | 42 |
41 } // namespace blink | 43 } // namespace blink |
OLD | NEW |