| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 double elapsedTime() const; | 53 double elapsedTime() const; |
| 54 void addedElementTokens(size_t count); | 54 void addedElementTokens(size_t count); |
| 55 size_t processedElementTokens() const { return m_processedElementTokens; } | 55 size_t processedElementTokens() const { return m_processedElementTokens; } |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 double m_startTime; | 58 double m_startTime; |
| 59 size_t m_processedElementTokens; | 59 size_t m_processedElementTokens; |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 class HTMLParserScheduler final : public NoBaseWillBeGarbageCollectedFinalized<H
TMLParserScheduler> { | 62 class HTMLParserScheduler final : public GarbageCollectedFinalized<HTMLParserSch
eduler> { |
| 63 WTF_MAKE_NONCOPYABLE(HTMLParserScheduler); | 63 WTF_MAKE_NONCOPYABLE(HTMLParserScheduler); |
| 64 USING_FAST_MALLOC_WILL_BE_REMOVED(HTMLParserScheduler); | |
| 65 public: | 64 public: |
| 66 static PassOwnPtrWillBeRawPtr<HTMLParserScheduler> create(HTMLDocumentParser
* parser, WebTaskRunner* loadingTaskRunner) | 65 static RawPtr<HTMLParserScheduler> create(HTMLDocumentParser* parser, WebTas
kRunner* loadingTaskRunner) |
| 67 { | 66 { |
| 68 return adoptPtrWillBeNoop(new HTMLParserScheduler(parser, loadingTaskRun
ner)); | 67 return new HTMLParserScheduler(parser, loadingTaskRunner); |
| 69 } | 68 } |
| 70 ~HTMLParserScheduler(); | 69 ~HTMLParserScheduler(); |
| 71 | 70 |
| 72 bool isScheduledForResume() const { return m_isSuspendedWithActiveTimer || m
_cancellableContinueParse->isPending(); } | 71 bool isScheduledForResume() const { return m_isSuspendedWithActiveTimer || m
_cancellableContinueParse->isPending(); } |
| 73 | 72 |
| 74 void scheduleForResume(); | 73 void scheduleForResume(); |
| 75 bool yieldIfNeeded(const SpeculationsPumpSession&, bool startingScript); | 74 bool yieldIfNeeded(const SpeculationsPumpSession&, bool startingScript); |
| 76 | 75 |
| 77 /** | 76 /** |
| 78 * Can only be called if this scheduler is suspended. If this is called, | 77 * Can only be called if this scheduler is suspended. If this is called, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 89 void detach(); // Clear active tasks if any. | 88 void detach(); // Clear active tasks if any. |
| 90 | 89 |
| 91 DECLARE_TRACE(); | 90 DECLARE_TRACE(); |
| 92 | 91 |
| 93 private: | 92 private: |
| 94 HTMLParserScheduler(HTMLDocumentParser*, WebTaskRunner*); | 93 HTMLParserScheduler(HTMLDocumentParser*, WebTaskRunner*); |
| 95 | 94 |
| 96 bool shouldYield(const SpeculationsPumpSession&, bool startingScript) const; | 95 bool shouldYield(const SpeculationsPumpSession&, bool startingScript) const; |
| 97 void continueParsing(); | 96 void continueParsing(); |
| 98 | 97 |
| 99 RawPtrWillBeMember<HTMLDocumentParser> m_parser; | 98 Member<HTMLDocumentParser> m_parser; |
| 100 OwnPtr<WebTaskRunner> m_loadingTaskRunner; | 99 OwnPtr<WebTaskRunner> m_loadingTaskRunner; |
| 101 | 100 |
| 102 OwnPtr<CancellableTaskFactory> m_cancellableContinueParse; | 101 OwnPtr<CancellableTaskFactory> m_cancellableContinueParse; |
| 103 bool m_isSuspendedWithActiveTimer; | 102 bool m_isSuspendedWithActiveTimer; |
| 104 }; | 103 }; |
| 105 | 104 |
| 106 } // namespace blink | 105 } // namespace blink |
| 107 | 106 |
| 108 #endif | 107 #endif |
| OLD | NEW |