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

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

Issue 1175183006: Make it possible to modify background HTML parser token limits. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Make parser Settings values unsigned. Assert outstanding>=pending. Created 5 years, 6 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 | « Source/core/frame/Settings.in ('k') | 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 30 matching lines...) Expand all
41 namespace blink { 41 namespace blink {
42 42
43 class HTMLDocumentParser; 43 class HTMLDocumentParser;
44 class XSSAuditor; 44 class XSSAuditor;
45 class WebScheduler; 45 class WebScheduler;
46 46
47 class BackgroundHTMLParser { 47 class BackgroundHTMLParser {
48 WTF_MAKE_FAST_ALLOCATED(BackgroundHTMLParser); 48 WTF_MAKE_FAST_ALLOCATED(BackgroundHTMLParser);
49 public: 49 public:
50 struct Configuration { 50 struct Configuration {
51 Configuration();
51 HTMLParserOptions options; 52 HTMLParserOptions options;
52 WeakPtr<HTMLDocumentParser> parser; 53 WeakPtr<HTMLDocumentParser> parser;
53 OwnPtr<XSSAuditor> xssAuditor; 54 OwnPtr<XSSAuditor> xssAuditor;
54 OwnPtr<TokenPreloadScanner> preloadScanner; 55 OwnPtr<TokenPreloadScanner> preloadScanner;
55 OwnPtr<TextResourceDecoder> decoder; 56 OwnPtr<TextResourceDecoder> decoder;
57 // outstandingTokenLimit must be greater than or equal to
58 // pendingTokenLimit
59 size_t outstandingTokenLimit;
60 size_t pendingTokenLimit;
56 }; 61 };
57 62
58 static void start(PassRefPtr<WeakReference<BackgroundHTMLParser>>, PassOwnPt r<Configuration>, WebScheduler*); 63 static void start(PassRefPtr<WeakReference<BackgroundHTMLParser>>, PassOwnPt r<Configuration>, WebScheduler*);
59 64
60 struct Checkpoint { 65 struct Checkpoint {
61 WeakPtr<HTMLDocumentParser> parser; 66 WeakPtr<HTMLDocumentParser> parser;
62 OwnPtr<HTMLToken> token; 67 OwnPtr<HTMLToken> token;
63 OwnPtr<HTMLTokenizer> tokenizer; 68 OwnPtr<HTMLTokenizer> tokenizer;
64 HTMLTreeBuilderSimulator::State treeBuilderState; 69 HTMLTreeBuilderSimulator::State treeBuilderState;
65 HTMLInputCheckpoint inputCheckpoint; 70 HTMLInputCheckpoint inputCheckpoint;
(...skipping 23 matching lines...) Expand all
89 void sendTokensToMainThread(); 94 void sendTokensToMainThread();
90 void updateDocument(const String& decodedData); 95 void updateDocument(const String& decodedData);
91 96
92 WeakPtrFactory<BackgroundHTMLParser> m_weakFactory; 97 WeakPtrFactory<BackgroundHTMLParser> m_weakFactory;
93 BackgroundHTMLInputStream m_input; 98 BackgroundHTMLInputStream m_input;
94 HTMLSourceTracker m_sourceTracker; 99 HTMLSourceTracker m_sourceTracker;
95 OwnPtr<HTMLToken> m_token; 100 OwnPtr<HTMLToken> m_token;
96 OwnPtr<HTMLTokenizer> m_tokenizer; 101 OwnPtr<HTMLTokenizer> m_tokenizer;
97 HTMLTreeBuilderSimulator m_treeBuilderSimulator; 102 HTMLTreeBuilderSimulator m_treeBuilderSimulator;
98 HTMLParserOptions m_options; 103 HTMLParserOptions m_options;
104 const size_t m_outstandingTokenLimit;
99 WeakPtr<HTMLDocumentParser> m_parser; 105 WeakPtr<HTMLDocumentParser> m_parser;
100 106
101 OwnPtr<CompactHTMLTokenStream> m_pendingTokens; 107 OwnPtr<CompactHTMLTokenStream> m_pendingTokens;
108 const size_t m_pendingTokenLimit;
102 PreloadRequestStream m_pendingPreloads; 109 PreloadRequestStream m_pendingPreloads;
103 XSSInfoStream m_pendingXSSInfos; 110 XSSInfoStream m_pendingXSSInfos;
104 111
105 OwnPtr<XSSAuditor> m_xssAuditor; 112 OwnPtr<XSSAuditor> m_xssAuditor;
106 OwnPtr<TokenPreloadScanner> m_preloadScanner; 113 OwnPtr<TokenPreloadScanner> m_preloadScanner;
107 OwnPtr<TextResourceDecoder> m_decoder; 114 OwnPtr<TextResourceDecoder> m_decoder;
108 DocumentEncodingData m_lastSeenEncodingData; 115 DocumentEncodingData m_lastSeenEncodingData;
109 WebScheduler* m_scheduler; // NOT OWNED, scheduler will outlive BackgroundHT MLParser 116 WebScheduler* m_scheduler; // NOT OWNED, scheduler will outlive BackgroundHT MLParser
110 117
111 bool m_startingScript; 118 bool m_startingScript;
112 }; 119 };
113 120
114 } 121 }
115 122
116 #endif 123 #endif
OLDNEW
« no previous file with comments | « Source/core/frame/Settings.in ('k') | Source/core/html/parser/BackgroundHTMLParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698