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

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

Issue 1364063007: Throttle rendering pipeline for invisible frames (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Early-out for intersection update walk. 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 20 matching lines...) Expand all
31 #include "config.h" 31 #include "config.h"
32 #include "core/dom/DocumentLifecycle.h" 32 #include "core/dom/DocumentLifecycle.h"
33 33
34 #include "platform/RuntimeEnabledFeatures.h" 34 #include "platform/RuntimeEnabledFeatures.h"
35 #include "wtf/Assertions.h" 35 #include "wtf/Assertions.h"
36 36
37 namespace blink { 37 namespace blink {
38 38
39 static DocumentLifecycle::DeprecatedTransition* s_deprecatedTransitionStack = 0; 39 static DocumentLifecycle::DeprecatedTransition* s_deprecatedTransitionStack = 0;
40 40
41 // TODO(skyostil): Come up with a better way to store cross-frame lifecycle
42 // related data to avoid this being a global setting.
43 static DocumentLifecycle::ThrottlingMode s_throttlingMode = DocumentLifecycle::T hrottlingMode::Allow;
esprehn 2015/10/14 22:09:46 unsigned s_throttleCount
Sami 2015/10/16 16:48:08 Done (made it s_throttlingDisallowCount since that
44
41 DocumentLifecycle::Scope::Scope(DocumentLifecycle& lifecycle, State finalState) 45 DocumentLifecycle::Scope::Scope(DocumentLifecycle& lifecycle, State finalState)
42 : m_lifecycle(lifecycle) 46 : m_lifecycle(lifecycle)
43 , m_finalState(finalState) 47 , m_finalState(finalState)
44 { 48 {
45 } 49 }
46 50
47 DocumentLifecycle::Scope::~Scope() 51 DocumentLifecycle::Scope::~Scope()
48 { 52 {
49 m_lifecycle.advanceTo(m_finalState); 53 m_lifecycle.advanceTo(m_finalState);
50 } 54 }
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 void DocumentLifecycle::ensureStateAtMost(State state) 288 void DocumentLifecycle::ensureStateAtMost(State state)
285 { 289 {
286 ASSERT(state == VisualUpdatePending || state == StyleClean || state == Layou tClean); 290 ASSERT(state == VisualUpdatePending || state == StyleClean || state == Layou tClean);
287 if (m_state <= state) 291 if (m_state <= state)
288 return; 292 return;
289 ASSERT_WITH_MESSAGE(canRewindTo(state), 293 ASSERT_WITH_MESSAGE(canRewindTo(state),
290 "Cannot rewind document lifecycle from %s to %s.", stateAsDebugString(m_ state), stateAsDebugString(state)); 294 "Cannot rewind document lifecycle from %s to %s.", stateAsDebugString(m_ state), stateAsDebugString(state));
291 m_state = state; 295 m_state = state;
292 } 296 }
293 297
298 void DocumentLifecycle::setThrottlingMode(ThrottlingMode throttlingMode)
299 {
300 s_throttlingMode = throttlingMode;
301 }
302
303 DocumentLifecycle::ThrottlingMode DocumentLifecycle::throttlingMode() const
304 {
305 return s_throttlingMode;
306 }
307
294 #if ENABLE(ASSERT) 308 #if ENABLE(ASSERT)
295 #define DEBUG_STRING_CASE(StateName) \ 309 #define DEBUG_STRING_CASE(StateName) \
296 case StateName: return #StateName 310 case StateName: return #StateName
297 311
298 const char* DocumentLifecycle::stateAsDebugString(const State state) 312 const char* DocumentLifecycle::stateAsDebugString(const State state)
299 { 313 {
300 switch (state) { 314 switch (state) {
301 DEBUG_STRING_CASE(Uninitialized); 315 DEBUG_STRING_CASE(Uninitialized);
302 DEBUG_STRING_CASE(Inactive); 316 DEBUG_STRING_CASE(Inactive);
303 DEBUG_STRING_CASE(VisualUpdatePending); 317 DEBUG_STRING_CASE(VisualUpdatePending);
(...skipping 19 matching lines...) Expand all
323 DEBUG_STRING_CASE(Stopped); 337 DEBUG_STRING_CASE(Stopped);
324 DEBUG_STRING_CASE(Disposed); 338 DEBUG_STRING_CASE(Disposed);
325 } 339 }
326 340
327 ASSERT_NOT_REACHED(); 341 ASSERT_NOT_REACHED();
328 return "Unknown"; 342 return "Unknown";
329 } 343 }
330 #endif 344 #endif
331 345
332 } 346 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698