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

Side by Side Diff: third_party/WebKit/Source/core/dom/DocumentLifecycle.h

Issue 1364063007: Throttle rendering pipeline for invisible frames (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo in comment. Created 5 years, 2 months 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 ~DetachScope() 128 ~DetachScope()
129 { 129 {
130 m_documentLifecycle.decrementDetachCount(); 130 m_documentLifecycle.decrementDetachCount();
131 } 131 }
132 132
133 private: 133 private:
134 DocumentLifecycle& m_documentLifecycle; 134 DocumentLifecycle& m_documentLifecycle;
135 }; 135 };
136 136
137 class PreventThrottlingScope {
138 STACK_ALLOCATED();
139 WTF_MAKE_NONCOPYABLE(PreventThrottlingScope);
140 public:
141 PreventThrottlingScope(DocumentLifecycle&);
142 ~PreventThrottlingScope();
143
144 private:
145 DocumentLifecycle& m_lifecycle;
146 };
147
137 DocumentLifecycle(); 148 DocumentLifecycle();
138 ~DocumentLifecycle(); 149 ~DocumentLifecycle();
139 150
140 bool isActive() const { return m_state > Inactive && m_state < Stopping; } 151 bool isActive() const { return m_state > Inactive && m_state < Stopping; }
141 State state() const { return m_state; } 152 State state() const { return m_state; }
142 153
143 bool stateAllowsTreeMutations() const; 154 bool stateAllowsTreeMutations() const;
144 bool stateAllowsLayoutTreeMutations() const; 155 bool stateAllowsLayoutTreeMutations() const;
145 bool stateAllowsDetach() const; 156 bool stateAllowsDetach() const;
146 bool stateAllowsLayoutInvalidation() const; 157 bool stateAllowsLayoutInvalidation() const;
147 bool stateAllowsLayoutTreeNotifications() const; 158 bool stateAllowsLayoutTreeNotifications() const;
148 159
149 void advanceTo(State); 160 void advanceTo(State);
150 void ensureStateAtMost(State); 161 void ensureStateAtMost(State);
151 162
152 bool inDetach() const { return m_detachCount; } 163 bool inDetach() const { return m_detachCount; }
153 void incrementDetachCount() { m_detachCount++; } 164 void incrementDetachCount() { m_detachCount++; }
154 void decrementDetachCount() 165 void decrementDetachCount()
155 { 166 {
156 ASSERT(m_detachCount > 0); 167 ASSERT(m_detachCount > 0);
157 m_detachCount--; 168 m_detachCount--;
158 } 169 }
159 170
171 bool throttlingAllowed() const;
172
160 #if ENABLE(ASSERT) 173 #if ENABLE(ASSERT)
161 static const char* stateAsDebugString(const State); 174 static const char* stateAsDebugString(const State);
162 #endif 175 #endif
163 176
164 private: 177 private:
165 #if ENABLE(ASSERT) 178 #if ENABLE(ASSERT)
166 bool canAdvanceTo(State) const; 179 bool canAdvanceTo(State) const;
167 bool canRewindTo(State) const; 180 bool canRewindTo(State) const;
168 #endif 181 #endif
169 182
183 void incrementPreventThrottlingCount();
184 void decrementPreventThrottlingCount();
185
170 State m_state; 186 State m_state;
171 int m_detachCount; 187 int m_detachCount;
172 }; 188 };
173 189
174 inline bool DocumentLifecycle::stateAllowsTreeMutations() const 190 inline bool DocumentLifecycle::stateAllowsTreeMutations() const
175 { 191 {
176 // FIXME: We should not allow mutations in InPreLayout or AfterPerformLayout either, 192 // FIXME: We should not allow mutations in InPreLayout or AfterPerformLayout either,
177 // but we need to fix MediaList listeners and plugins first. 193 // but we need to fix MediaList listeners and plugins first.
178 return m_state != InStyleRecalc 194 return m_state != InStyleRecalc
179 && m_state != InPerformLayout 195 && m_state != InPerformLayout
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 && m_state != InCompositingUpdate 231 && m_state != InCompositingUpdate
216 && m_state != InPaintInvalidation 232 && m_state != InPaintInvalidation
217 && m_state != InUpdatePaintProperties 233 && m_state != InUpdatePaintProperties
218 && m_state != InPaint 234 && m_state != InPaint
219 && m_state != InCompositingForSlimmingPaintV2; 235 && m_state != InCompositingForSlimmingPaintV2;
220 } 236 }
221 237
222 } // namespace blink 238 } // namespace blink
223 239
224 #endif 240 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698