OLD | NEW |
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 class HTMLParserScheduler { | 72 class HTMLParserScheduler { |
73 WTF_MAKE_NONCOPYABLE(HTMLParserScheduler); WTF_MAKE_FAST_ALLOCATED(HTMLParse
rScheduler); | 73 WTF_MAKE_NONCOPYABLE(HTMLParserScheduler); WTF_MAKE_FAST_ALLOCATED(HTMLParse
rScheduler); |
74 public: | 74 public: |
75 static PassOwnPtr<HTMLParserScheduler> create(HTMLDocumentParser* parser) | 75 static PassOwnPtr<HTMLParserScheduler> create(HTMLDocumentParser* parser) |
76 { | 76 { |
77 return adoptPtr(new HTMLParserScheduler(parser)); | 77 return adoptPtr(new HTMLParserScheduler(parser)); |
78 } | 78 } |
79 ~HTMLParserScheduler(); | 79 ~HTMLParserScheduler(); |
80 | 80 |
81 bool isScheduledForResume() const { return m_isSuspendedWithActiveTimer || m
_cancellableContinueParse.isPending(); } | 81 bool isScheduledForResume() const { return m_isSuspendedWithActiveTimer || m
_cancellableContinueParse->isPending(); } |
82 | 82 |
83 void scheduleForResume(); | 83 void scheduleForResume(); |
84 bool yieldIfNeeded(const SpeculationsPumpSession&, bool startingScript); | 84 bool yieldIfNeeded(const SpeculationsPumpSession&, bool startingScript); |
85 | 85 |
86 /** | 86 /** |
87 * Can only be called if this scheduler is suspended. If this is called, | 87 * Can only be called if this scheduler is suspended. If this is called, |
88 * then after the scheduler is resumed by calling resume(), this call | 88 * then after the scheduler is resumed by calling resume(), this call |
89 * ensures that HTMLDocumentParser::resumeAfterYield will be called. Used to | 89 * ensures that HTMLDocumentParser::resumeAfterYield will be called. Used to |
90 * signal this scheduler that the background html parser sent chunks to | 90 * signal this scheduler that the background html parser sent chunks to |
91 * HTMLDocumentParser while it was suspended. | 91 * HTMLDocumentParser while it was suspended. |
92 */ | 92 */ |
93 void forceResumeAfterYield(); | 93 void forceResumeAfterYield(); |
94 | 94 |
95 void suspend(); | 95 void suspend(); |
96 void resume(); | 96 void resume(); |
97 | 97 |
98 void detach(); // Clear active tasks if any. | 98 void detach(); // Clear active tasks if any. |
99 | 99 |
100 private: | 100 private: |
101 explicit HTMLParserScheduler(HTMLDocumentParser*); | 101 explicit HTMLParserScheduler(HTMLDocumentParser*); |
102 | 102 |
103 bool shouldYield(const SpeculationsPumpSession&, bool startingScript) const; | 103 bool shouldYield(const SpeculationsPumpSession&, bool startingScript) const; |
104 void continueParsing(); | 104 void continueParsing(); |
105 | 105 |
106 HTMLDocumentParser* m_parser; | 106 HTMLDocumentParser* m_parser; |
107 WebTaskRunner* m_loadingTaskRunner; // NOT OWNED | 107 WebTaskRunner* m_loadingTaskRunner; // NOT OWNED |
108 | 108 |
109 CancellableTaskFactory m_cancellableContinueParse; | 109 OwnPtr<CancellableTaskFactory> m_cancellableContinueParse; |
110 bool m_isSuspendedWithActiveTimer; | 110 bool m_isSuspendedWithActiveTimer; |
111 }; | 111 }; |
112 | 112 |
113 } | 113 } |
114 | 114 |
115 #endif | 115 #endif |
OLD | NEW |