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

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

Issue 2318883002: Revert of Implement WTF::WeakPtr in terms of base::WeakPtr (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2013 Google, Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 std::unique_ptr<XSSAuditor> xssAuditor; 58 std::unique_ptr<XSSAuditor> xssAuditor;
59 std::unique_ptr<TextResourceDecoder> decoder; 59 std::unique_ptr<TextResourceDecoder> decoder;
60 RefPtr<TokenizedChunkQueue> tokenizedChunkQueue; 60 RefPtr<TokenizedChunkQueue> tokenizedChunkQueue;
61 // outstandingTokenLimit must be greater than or equal to 61 // outstandingTokenLimit must be greater than or equal to
62 // pendingTokenLimit 62 // pendingTokenLimit
63 size_t outstandingTokenLimit; 63 size_t outstandingTokenLimit;
64 size_t pendingTokenLimit; 64 size_t pendingTokenLimit;
65 bool shouldCoalesceChunks; 65 bool shouldCoalesceChunks;
66 }; 66 };
67 67
68 // The returned BackgroundHTMLParser should only be used on the parser 68 static void start(PassRefPtr<WeakReference<BackgroundHTMLParser>>, std::uniq ue_ptr<Configuration>, const KURL& documentURL, std::unique_ptr<CachedDocumentPa rameters>, const MediaValuesCached::MediaValuesCachedData&, std::unique_ptr<WebT askRunner>);
69 // thread: it must first be initialized by calling init(), and free by
70 // calling stop().
71 static WeakPtr<BackgroundHTMLParser> create(std::unique_ptr<Configuration>, std::unique_ptr<WebTaskRunner>);
72 void init(const KURL& documentURL, std::unique_ptr<CachedDocumentParameters> , const MediaValuesCached::MediaValuesCachedData&);
73 69
74 struct Checkpoint { 70 struct Checkpoint {
75 USING_FAST_MALLOC(Checkpoint); 71 USING_FAST_MALLOC(Checkpoint);
76 public: 72 public:
77 WeakPtr<HTMLDocumentParser> parser; 73 WeakPtr<HTMLDocumentParser> parser;
78 std::unique_ptr<HTMLToken> token; 74 std::unique_ptr<HTMLToken> token;
79 std::unique_ptr<HTMLTokenizer> tokenizer; 75 std::unique_ptr<HTMLTokenizer> tokenizer;
80 HTMLTreeBuilderSimulator::State treeBuilderState; 76 HTMLTreeBuilderSimulator::State treeBuilderState;
81 HTMLInputCheckpoint inputCheckpoint; 77 HTMLInputCheckpoint inputCheckpoint;
82 TokenPreloadScannerCheckpoint preloadScannerCheckpoint; 78 TokenPreloadScannerCheckpoint preloadScannerCheckpoint;
83 String unparsedInput; 79 String unparsedInput;
84 }; 80 };
85 81
86 void appendRawBytesFromMainThread(std::unique_ptr<Vector<char>>, double byte sReceivedTime); 82 void appendRawBytesFromMainThread(std::unique_ptr<Vector<char>>, double byte sReceivedTime);
87 void setDecoder(std::unique_ptr<TextResourceDecoder>); 83 void setDecoder(std::unique_ptr<TextResourceDecoder>);
88 void flush(); 84 void flush();
89 void resumeFrom(std::unique_ptr<Checkpoint>); 85 void resumeFrom(std::unique_ptr<Checkpoint>);
90 void startedChunkWithCheckpoint(HTMLInputCheckpoint); 86 void startedChunkWithCheckpoint(HTMLInputCheckpoint);
91 void finish(); 87 void finish();
92 void stop(); 88 void stop();
93 89
94 void forcePlaintextForTextDocument(); 90 void forcePlaintextForTextDocument();
95 91
96 private: 92 private:
97 BackgroundHTMLParser(std::unique_ptr<Configuration>, std::unique_ptr<WebTask Runner>); 93 BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHTMLParser>>, std::u nique_ptr<Configuration>, const KURL& documentURL, std::unique_ptr<CachedDocumen tParameters>, const MediaValuesCached::MediaValuesCachedData&, std::unique_ptr<W ebTaskRunner>);
98 ~BackgroundHTMLParser(); 94 ~BackgroundHTMLParser();
99 95
100 void appendDecodedBytes(const String&); 96 void appendDecodedBytes(const String&);
101 void markEndOfFile(); 97 void markEndOfFile();
102 void pumpTokenizer(); 98 void pumpTokenizer();
103 99
104 // Returns whether or not the HTMLDocumentParser should be notified of 100 // Returns whether or not the HTMLDocumentParser should be notified of
105 // pending chunks. 101 // pending chunks.
106 bool queueChunkForMainThread(); 102 bool queueChunkForMainThread();
107 void notifyMainThreadOfNewChunks(); 103 void notifyMainThreadOfNewChunks();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 int m_pendingCSPMetaTokenIndex; 136 int m_pendingCSPMetaTokenIndex;
141 137
142 bool m_startingScript; 138 bool m_startingScript;
143 double m_lastBytesReceivedTime; 139 double m_lastBytesReceivedTime;
144 bool m_shouldCoalesceChunks; 140 bool m_shouldCoalesceChunks;
145 }; 141 };
146 142
147 } // namespace blink 143 } // namespace blink
148 144
149 #endif 145 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698