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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 private: | 46 private: |
47 RefPtrWillBeMember<Document> m_document; | 47 RefPtrWillBeMember<Document> m_document; |
48 }; | 48 }; |
49 | 49 |
50 class PumpSession : public NestingLevelIncrementer, public ActiveParserSession { | 50 class PumpSession : public NestingLevelIncrementer, public ActiveParserSession { |
51 STACK_ALLOCATED(); | 51 STACK_ALLOCATED(); |
52 public: | 52 public: |
53 PumpSession(unsigned& nestingLevel, Document*); | 53 PumpSession(unsigned& nestingLevel, Document*); |
54 ~PumpSession(); | 54 ~PumpSession(); |
55 | |
56 int processedTokens; | |
57 double startTime; | |
58 bool needsYield; | |
59 bool didSeeScript; | |
60 }; | 55 }; |
61 | 56 |
62 class HTMLParserScheduler { | 57 class HTMLParserScheduler { |
63 WTF_MAKE_NONCOPYABLE(HTMLParserScheduler); WTF_MAKE_FAST_ALLOCATED; | 58 WTF_MAKE_NONCOPYABLE(HTMLParserScheduler); WTF_MAKE_FAST_ALLOCATED; |
64 public: | 59 public: |
65 static PassOwnPtr<HTMLParserScheduler> create(HTMLDocumentParser* parser) | 60 static PassOwnPtr<HTMLParserScheduler> create(HTMLDocumentParser* parser) |
66 { | 61 { |
67 return adoptPtr(new HTMLParserScheduler(parser)); | 62 return adoptPtr(new HTMLParserScheduler(parser)); |
68 } | 63 } |
69 ~HTMLParserScheduler(); | 64 ~HTMLParserScheduler(); |
70 | 65 |
71 void scheduleForResume(); | 66 void scheduleForResume(); |
72 bool isScheduledForResume() const { return m_isSuspendedWithActiveTimer || m
_continueNextChunkTimer.isActive(); } | 67 bool isScheduledForResume() const { return m_isSuspendedWithActiveTimer || m
_continueNextChunkTimer.isActive(); } |
73 | 68 |
74 void suspend(); | 69 void suspend(); |
75 void resume(); | 70 void resume(); |
76 | 71 |
77 private: | 72 private: |
78 static const double parserTimeLimit; | |
79 static const int parserChunkSize; | |
80 | |
81 HTMLParserScheduler(HTMLDocumentParser*); | 73 HTMLParserScheduler(HTMLDocumentParser*); |
82 | 74 |
83 void continueNextChunkTimerFired(Timer<HTMLParserScheduler>*); | 75 void continueNextChunkTimerFired(Timer<HTMLParserScheduler>*); |
84 | 76 |
85 HTMLDocumentParser* m_parser; | 77 HTMLDocumentParser* m_parser; |
86 | 78 |
87 Timer<HTMLParserScheduler> m_continueNextChunkTimer; | 79 Timer<HTMLParserScheduler> m_continueNextChunkTimer; |
88 bool m_isSuspendedWithActiveTimer; | 80 bool m_isSuspendedWithActiveTimer; |
89 }; | 81 }; |
90 | 82 |
91 } | 83 } |
92 | 84 |
93 #endif | 85 #endif |
OLD | NEW |