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

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

Issue 625583002: Properly suspend HTMLDocumentParser (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years 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 /* 1 /*
2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2010 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 { 74 {
75 return adoptPtr(new HTMLParserScheduler(parser)); 75 return adoptPtr(new HTMLParserScheduler(parser));
76 } 76 }
77 ~HTMLParserScheduler(); 77 ~HTMLParserScheduler();
78 78
79 bool isScheduledForResume() const { return m_isSuspendedWithActiveTimer || m _continueNextChunkTimer.isActive(); } 79 bool isScheduledForResume() const { return m_isSuspendedWithActiveTimer || m _continueNextChunkTimer.isActive(); }
80 80
81 void scheduleForResume(); 81 void scheduleForResume();
82 bool yieldIfNeeded(const SpeculationsPumpSession&, bool startingScript); 82 bool yieldIfNeeded(const SpeculationsPumpSession&, bool startingScript);
83 83
84 /**
85 * Can only be called if this scheduler is suspended. If this is called,
86 * then after the scheduler is resumed by calling resume(), this call
87 * ensures that HTMLDocumentParser::resumeAfterYield will be called. Used to
88 * signal this scheduler that the background html parser sent chunks to
89 * HTMLDocumentParser while it was suspended.
90 */
91 void forceResumeAfterYield();
92
84 void suspend(); 93 void suspend();
85 void resume(); 94 void resume();
86 95
87 private: 96 private:
88 explicit HTMLParserScheduler(HTMLDocumentParser*); 97 explicit HTMLParserScheduler(HTMLDocumentParser*);
89 98
90 bool shouldYield(const SpeculationsPumpSession&, bool startingScript) const; 99 bool shouldYield(const SpeculationsPumpSession&, bool startingScript) const;
91 void continueNextChunkTimerFired(Timer<HTMLParserScheduler>*); 100 void continueNextChunkTimerFired(Timer<HTMLParserScheduler>*);
92 101
93 HTMLDocumentParser* m_parser; 102 HTMLDocumentParser* m_parser;
94 103
95 Timer<HTMLParserScheduler> m_continueNextChunkTimer; 104 Timer<HTMLParserScheduler> m_continueNextChunkTimer;
96 bool m_isSuspendedWithActiveTimer; 105 bool m_isSuspendedWithActiveTimer;
97 }; 106 };
98 107
99 } 108 }
100 109
101 #endif 110 #endif
OLDNEW
« no previous file with comments | « Source/core/html/parser/HTMLDocumentParser.cpp ('k') | Source/core/html/parser/HTMLParserScheduler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698