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

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

Issue 1738613002: Rename enums/functions that collide in chromium style in core/dom/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@get-names-3
Patch Set: get-names-4: Created 4 years, 10 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 23 matching lines...) Expand all
34 #include "wtf/Assertions.h" 34 #include "wtf/Assertions.h"
35 35
36 namespace blink { 36 namespace blink {
37 37
38 static DocumentLifecycle::DeprecatedTransition* s_deprecatedTransitionStack = 0; 38 static DocumentLifecycle::DeprecatedTransition* s_deprecatedTransitionStack = 0;
39 39
40 // TODO(skyostil): Come up with a better way to store cross-frame lifecycle 40 // TODO(skyostil): Come up with a better way to store cross-frame lifecycle
41 // related data to avoid this being a global setting. 41 // related data to avoid this being a global setting.
42 static unsigned s_allowThrottlingCount = 0; 42 static unsigned s_allowThrottlingCount = 0;
43 43
44 DocumentLifecycle::Scope::Scope(DocumentLifecycle& lifecycle, State finalState) 44 DocumentLifecycle::Scope::Scope(DocumentLifecycle& lifecycle, LifecycleState fin alState)
45 : m_lifecycle(lifecycle) 45 : m_lifecycle(lifecycle)
46 , m_finalState(finalState) 46 , m_finalState(finalState)
47 { 47 {
48 } 48 }
49 49
50 DocumentLifecycle::Scope::~Scope() 50 DocumentLifecycle::Scope::~Scope()
51 { 51 {
52 m_lifecycle.advanceTo(m_finalState); 52 m_lifecycle.advanceTo(m_finalState);
53 } 53 }
54 54
55 DocumentLifecycle::DeprecatedTransition::DeprecatedTransition(State from, State to) 55 DocumentLifecycle::DeprecatedTransition::DeprecatedTransition(LifecycleState fro m, LifecycleState to)
56 : m_previous(s_deprecatedTransitionStack) 56 : m_previous(s_deprecatedTransitionStack)
57 , m_from(from) 57 , m_from(from)
58 , m_to(to) 58 , m_to(to)
59 { 59 {
60 s_deprecatedTransitionStack = this; 60 s_deprecatedTransitionStack = this;
61 } 61 }
62 62
63 DocumentLifecycle::DeprecatedTransition::~DeprecatedTransition() 63 DocumentLifecycle::DeprecatedTransition::~DeprecatedTransition()
64 { 64 {
65 s_deprecatedTransitionStack = m_previous; 65 s_deprecatedTransitionStack = m_previous;
(...skipping 15 matching lines...) Expand all
81 , m_detachCount(0) 81 , m_detachCount(0)
82 { 82 {
83 } 83 }
84 84
85 DocumentLifecycle::~DocumentLifecycle() 85 DocumentLifecycle::~DocumentLifecycle()
86 { 86 {
87 } 87 }
88 88
89 #if ENABLE(ASSERT) 89 #if ENABLE(ASSERT)
90 90
91 bool DocumentLifecycle::canAdvanceTo(State nextState) const 91 bool DocumentLifecycle::canAdvanceTo(LifecycleState nextState) const
92 { 92 {
93 // We can stop from anywhere. 93 // We can stop from anywhere.
94 if (nextState == Stopping) 94 if (nextState == Stopping)
95 return true; 95 return true;
96 96
97 switch (m_state) { 97 switch (m_state) {
98 case Uninitialized: 98 case Uninitialized:
99 return nextState == Inactive; 99 return nextState == Inactive;
100 case Inactive: 100 case Inactive:
101 if (nextState == StyleClean) 101 if (nextState == StyleClean)
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 case Stopped: 241 case Stopped:
242 return nextState == Disposed; 242 return nextState == Disposed;
243 case Disposed: 243 case Disposed:
244 // FIXME: We can dispose a document multiple times. This seems wrong. 244 // FIXME: We can dispose a document multiple times. This seems wrong.
245 // See https://code.google.com/p/chromium/issues/detail?id=301668. 245 // See https://code.google.com/p/chromium/issues/detail?id=301668.
246 return nextState == Disposed; 246 return nextState == Disposed;
247 } 247 }
248 return false; 248 return false;
249 } 249 }
250 250
251 bool DocumentLifecycle::canRewindTo(State nextState) const 251 bool DocumentLifecycle::canRewindTo(LifecycleState nextState) const
252 { 252 {
253 // This transition is bogus, but we've whitelisted it anyway. 253 // This transition is bogus, but we've whitelisted it anyway.
254 if (s_deprecatedTransitionStack && m_state == s_deprecatedTransitionStack->f rom() && nextState == s_deprecatedTransitionStack->to()) 254 if (s_deprecatedTransitionStack && m_state == s_deprecatedTransitionStack->f rom() && nextState == s_deprecatedTransitionStack->to())
255 return true; 255 return true;
256 return m_state == StyleClean 256 return m_state == StyleClean
257 || m_state == LayoutSubtreeChangeClean 257 || m_state == LayoutSubtreeChangeClean
258 || m_state == AfterPerformLayout 258 || m_state == AfterPerformLayout
259 || m_state == LayoutClean 259 || m_state == LayoutClean
260 || m_state == CompositingClean 260 || m_state == CompositingClean
261 || m_state == PaintInvalidationClean 261 || m_state == PaintInvalidationClean
262 || m_state == PaintClean; 262 || m_state == PaintClean;
263 } 263 }
264 264
265 #endif 265 #endif
266 266
267 void DocumentLifecycle::advanceTo(State nextState) 267 void DocumentLifecycle::advanceTo(LifecycleState nextState)
268 { 268 {
269 ASSERT_WITH_MESSAGE(canAdvanceTo(nextState), 269 ASSERT_WITH_MESSAGE(canAdvanceTo(nextState),
270 "Cannot advance document lifecycle from %s to %s.", stateAsDebugString(m _state), stateAsDebugString(nextState)); 270 "Cannot advance document lifecycle from %s to %s.", stateAsDebugString(m _state), stateAsDebugString(nextState));
271 m_state = nextState; 271 m_state = nextState;
272 } 272 }
273 273
274 void DocumentLifecycle::ensureStateAtMost(State state) 274 void DocumentLifecycle::ensureStateAtMost(LifecycleState state)
275 { 275 {
276 ASSERT(state == VisualUpdatePending || state == StyleClean || state == Layou tClean); 276 ASSERT(state == VisualUpdatePending || state == StyleClean || state == Layou tClean);
277 if (m_state <= state) 277 if (m_state <= state)
278 return; 278 return;
279 ASSERT_WITH_MESSAGE(canRewindTo(state), 279 ASSERT_WITH_MESSAGE(canRewindTo(state),
280 "Cannot rewind document lifecycle from %s to %s.", stateAsDebugString(m_ state), stateAsDebugString(state)); 280 "Cannot rewind document lifecycle from %s to %s.", stateAsDebugString(m_ state), stateAsDebugString(state));
281 m_state = state; 281 m_state = state;
282 } 282 }
283 283
284 bool DocumentLifecycle::throttlingAllowed() const 284 bool DocumentLifecycle::throttlingAllowed() const
285 { 285 {
286 return s_allowThrottlingCount; 286 return s_allowThrottlingCount;
287 } 287 }
288 288
289 #if ENABLE(ASSERT) 289 #if ENABLE(ASSERT)
290 #define DEBUG_STRING_CASE(StateName) \ 290 #define DEBUG_STRING_CASE(StateName) \
291 case StateName: return #StateName 291 case StateName: return #StateName
292 292
293 const char* DocumentLifecycle::stateAsDebugString(const State state) 293 const char* DocumentLifecycle::stateAsDebugString(const LifecycleState state)
294 { 294 {
295 switch (state) { 295 switch (state) {
296 DEBUG_STRING_CASE(Uninitialized); 296 DEBUG_STRING_CASE(Uninitialized);
297 DEBUG_STRING_CASE(Inactive); 297 DEBUG_STRING_CASE(Inactive);
298 DEBUG_STRING_CASE(VisualUpdatePending); 298 DEBUG_STRING_CASE(VisualUpdatePending);
299 DEBUG_STRING_CASE(InStyleRecalc); 299 DEBUG_STRING_CASE(InStyleRecalc);
300 DEBUG_STRING_CASE(StyleClean); 300 DEBUG_STRING_CASE(StyleClean);
301 DEBUG_STRING_CASE(InLayoutSubtreeChange); 301 DEBUG_STRING_CASE(InLayoutSubtreeChange);
302 DEBUG_STRING_CASE(LayoutSubtreeChangeClean); 302 DEBUG_STRING_CASE(LayoutSubtreeChangeClean);
303 DEBUG_STRING_CASE(InPreLayout); 303 DEBUG_STRING_CASE(InPreLayout);
(...skipping 12 matching lines...) Expand all
316 DEBUG_STRING_CASE(Stopped); 316 DEBUG_STRING_CASE(Stopped);
317 DEBUG_STRING_CASE(Disposed); 317 DEBUG_STRING_CASE(Disposed);
318 } 318 }
319 319
320 ASSERT_NOT_REACHED(); 320 ASSERT_NOT_REACHED();
321 return "Unknown"; 321 return "Unknown";
322 } 322 }
323 #endif 323 #endif
324 324
325 } // namespace blink 325 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698