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

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

Issue 1438193002: Oilpan: move HTMLParserScheduler to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move the object to the heap instead Created 5 years, 1 month 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 double elapsedTime() const; 64 double elapsedTime() const;
65 void addedElementTokens(size_t count); 65 void addedElementTokens(size_t count);
66 size_t processedElementTokens() const { return m_processedElementTokens; } 66 size_t processedElementTokens() const { return m_processedElementTokens; }
67 67
68 private: 68 private:
69 double m_startTime; 69 double m_startTime;
70 size_t m_processedElementTokens; 70 size_t m_processedElementTokens;
71 }; 71 };
72 72
73 class HTMLParserScheduler { 73 class HTMLParserScheduler final : public NoBaseWillBeGarbageCollectedFinalized<H TMLParserScheduler> {
74 WTF_MAKE_NONCOPYABLE(HTMLParserScheduler); USING_FAST_MALLOC(HTMLParserSched uler); 74 WTF_MAKE_NONCOPYABLE(HTMLParserScheduler);
75 USING_FAST_MALLOC_WILL_BE_REMOVED(HTMLParserScheduler);
75 public: 76 public:
76 static PassOwnPtr<HTMLParserScheduler> create(HTMLDocumentParser* parser, We bTaskRunner* loadingTaskRunner) 77 static PassOwnPtrWillBeRawPtr<HTMLParserScheduler> create(HTMLDocumentParser * parser, WebTaskRunner* loadingTaskRunner)
77 { 78 {
78 return adoptPtr(new HTMLParserScheduler(parser, loadingTaskRunner)); 79 return adoptPtrWillBeNoop(new HTMLParserScheduler(parser, loadingTaskRun ner));
79 } 80 }
80 ~HTMLParserScheduler(); 81 ~HTMLParserScheduler();
81 82
82 bool isScheduledForResume() const { return m_isSuspendedWithActiveTimer || m _cancellableContinueParse->isPending(); } 83 bool isScheduledForResume() const { return m_isSuspendedWithActiveTimer || m _cancellableContinueParse->isPending(); }
83 84
84 void scheduleForResume(); 85 void scheduleForResume();
85 bool yieldIfNeeded(const SpeculationsPumpSession&, bool startingScript); 86 bool yieldIfNeeded(const SpeculationsPumpSession&, bool startingScript);
86 87
87 /** 88 /**
88 * Can only be called if this scheduler is suspended. If this is called, 89 * Can only be called if this scheduler is suspended. If this is called,
89 * then after the scheduler is resumed by calling resume(), this call 90 * then after the scheduler is resumed by calling resume(), this call
90 * ensures that HTMLDocumentParser::resumeAfterYield will be called. Used to 91 * ensures that HTMLDocumentParser::resumeAfterYield will be called. Used to
91 * signal this scheduler that the background html parser sent chunks to 92 * signal this scheduler that the background html parser sent chunks to
92 * HTMLDocumentParser while it was suspended. 93 * HTMLDocumentParser while it was suspended.
93 */ 94 */
94 void forceResumeAfterYield(); 95 void forceResumeAfterYield();
95 96
96 void suspend(); 97 void suspend();
97 void resume(); 98 void resume();
98 99
99 void detach(); // Clear active tasks if any. 100 void detach(); // Clear active tasks if any.
100 101
102 DECLARE_TRACE();
103
101 private: 104 private:
102 HTMLParserScheduler(HTMLDocumentParser*, WebTaskRunner*); 105 HTMLParserScheduler(HTMLDocumentParser*, WebTaskRunner*);
103 106
104 bool shouldYield(const SpeculationsPumpSession&, bool startingScript) const; 107 bool shouldYield(const SpeculationsPumpSession&, bool startingScript) const;
105 void continueParsing(); 108 void continueParsing();
106 109
107 HTMLDocumentParser* m_parser; 110 RawPtrWillBeMember<HTMLDocumentParser> m_parser;
108 OwnPtr<WebTaskRunner> m_loadingTaskRunner; 111 OwnPtr<WebTaskRunner> m_loadingTaskRunner;
109 112
110 OwnPtr<CancellableTaskFactory> m_cancellableContinueParse; 113 OwnPtr<CancellableTaskFactory> m_cancellableContinueParse;
111 bool m_isSuspendedWithActiveTimer; 114 bool m_isSuspendedWithActiveTimer;
112 }; 115 };
113 116
114 } 117 }
115 118
116 #endif 119 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698