OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/frame/FrameLifecycle.h" | 5 #include "core/frame/FrameLifecycle.h" |
6 | 6 |
7 #include "wtf/Assertions.h" | 7 #include "platform/wtf/Assertions.h" |
8 | 8 |
9 namespace blink { | 9 namespace blink { |
10 | 10 |
11 FrameLifecycle::FrameLifecycle() : state_(kAttached) {} | 11 FrameLifecycle::FrameLifecycle() : state_(kAttached) {} |
12 | 12 |
13 void FrameLifecycle::AdvanceTo(State state) { | 13 void FrameLifecycle::AdvanceTo(State state) { |
14 switch (state) { | 14 switch (state) { |
15 case kAttached: | 15 case kAttached: |
16 case kDetached: | 16 case kDetached: |
17 // Normally, only allow state to move forward. | 17 // Normally, only allow state to move forward. |
18 DCHECK_GT(state, state_); | 18 DCHECK_GT(state, state_); |
19 break; | 19 break; |
20 case kDetaching: | 20 case kDetaching: |
21 // We can go from Detaching to Detaching since the detach() method can be | 21 // We can go from Detaching to Detaching since the detach() method can be |
22 // re-entered. | 22 // re-entered. |
23 DCHECK_GE(state, state_); | 23 DCHECK_GE(state, state_); |
24 break; | 24 break; |
25 } | 25 } |
26 state_ = state; | 26 state_ = state; |
27 } | 27 } |
28 | 28 |
29 } // namespace blink | 29 } // namespace blink |
OLD | NEW |