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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/TokenizedChunkQueue.h

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, 4 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 unified diff | Download patch
OLDNEW
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 #ifndef ParsedChunkQueue_h 5 #ifndef TokenizedChunkQueue_h
6 #define ParsedChunkQueue_h 6 #define TokenizedChunkQueue_h
7 7
8 #include "core/html/parser/HTMLDocumentParser.h" 8 #include "core/html/parser/HTMLDocumentParser.h"
9 #include "wtf/Deque.h" 9 #include "wtf/Deque.h"
10 #include "wtf/PassRefPtr.h" 10 #include "wtf/PassRefPtr.h"
11 #include "wtf/ThreadSafeRefCounted.h" 11 #include "wtf/ThreadSafeRefCounted.h"
12 #include "wtf/ThreadingPrimitives.h" 12 #include "wtf/ThreadingPrimitives.h"
13 #include "wtf/Vector.h" 13 #include "wtf/Vector.h"
14 #include <memory> 14 #include <memory>
15 15
16 namespace blink { 16 namespace blink {
17 17
18 // ParsedChunkQueue is used to transfer parsed HTML token chunks 18 // TokenizedChunkQueue is used to transfer parsed HTML token chunks
19 // from BackgroundHTMLParser thread to Blink main thread without 19 // from BackgroundHTMLParser thread to Blink main thread without
20 // spamming task queue. 20 // spamming task queue.
21 // ParsedChunkQueue is accessed from both BackgroundHTMLParser 21 // TokenizedChunkQueue is accessed from both BackgroundHTMLParser
22 // thread (producer) and Blink main thread (consumer). 22 // thread (producer) and Blink main thread (consumer).
23 // Access to the backend queue vector is protected by a mutex. 23 // Access to the backend queue vector is protected by a mutex.
24 // If enqueue is done against empty queue, BackgroundHTMLParser 24 // If enqueue is done against empty queue, BackgroundHTMLParser
25 // thread kicks a consumer task on Blink main thread. 25 // thread kicks a consumer task on Blink main thread.
26 class ParsedChunkQueue : public ThreadSafeRefCounted<ParsedChunkQueue> { 26 class TokenizedChunkQueue : public ThreadSafeRefCounted<TokenizedChunkQueue> {
27 public: 27 public:
28 static PassRefPtr<ParsedChunkQueue> create() 28 static PassRefPtr<TokenizedChunkQueue> create()
29 { 29 {
30 return adoptRef(new ParsedChunkQueue); 30 return adoptRef(new TokenizedChunkQueue);
31 } 31 }
32 32
33 ~ParsedChunkQueue(); 33 ~TokenizedChunkQueue();
34 34
35 bool enqueue(std::unique_ptr<HTMLDocumentParser::ParsedChunk>); 35 bool enqueue(std::unique_ptr<HTMLDocumentParser::TokenizedChunk>);
36 void clear(); 36 void clear();
37 37
38 void takeAll(Vector<std::unique_ptr<HTMLDocumentParser::ParsedChunk>>&); 38 void takeAll(Vector<std::unique_ptr<HTMLDocumentParser::TokenizedChunk>>&);
39 size_t peakPendingChunkCount(); 39 size_t peakPendingChunkCount();
40 size_t peakPendingTokenCount(); 40 size_t peakPendingTokenCount();
41 41
42 private: 42 private:
43 ParsedChunkQueue(); 43 TokenizedChunkQueue();
44 44
45 std::unique_ptr<Mutex> m_mutex; 45 std::unique_ptr<Mutex> m_mutex;
46 Vector<std::unique_ptr<HTMLDocumentParser::ParsedChunk>> m_pendingChunks; 46 Vector<std::unique_ptr<HTMLDocumentParser::TokenizedChunk>> m_pendingChunks;
47 size_t m_peakPendingChunkCount = 0; 47 size_t m_peakPendingChunkCount = 0;
48 size_t m_peakPendingTokenCount = 0; 48 size_t m_peakPendingTokenCount = 0;
49 size_t m_pendingTokenCount = 0; 49 size_t m_pendingTokenCount = 0;
50 }; 50 };
51 51
52 } // namespace blink 52 } // namespace blink
53 53
54 #endif 54 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698