| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "platform/ScopedOrientationChangeIndicator.h" | 5 #include "platform/ScopedOrientationChangeIndicator.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 ScopedOrientationChangeIndicator::State | 11 ScopedOrientationChangeIndicator::State |
| 12 ScopedOrientationChangeIndicator::state_ = | 12 ScopedOrientationChangeIndicator::state_ = |
| 13 ScopedOrientationChangeIndicator::State::kNotProcessing; | 13 ScopedOrientationChangeIndicator::State::kNotProcessing; |
| 14 | 14 |
| 15 ScopedOrientationChangeIndicator::ScopedOrientationChangeIndicator() { | 15 ScopedOrientationChangeIndicator::ScopedOrientationChangeIndicator() { |
| 16 DCHECK(IsMainThread()); | 16 DCHECK(IsMainThread()); |
| 17 | 17 |
| 18 previous_state_ = state_; | 18 previous_state_ = state_; |
| 19 state_ = State::kProcessing; | 19 state_ = State::kProcessing; |
| 20 } | 20 } |
| 21 | 21 |
| 22 ScopedOrientationChangeIndicator::~ScopedOrientationChangeIndicator() { | 22 ScopedOrientationChangeIndicator::~ScopedOrientationChangeIndicator() { |
| 23 DCHECK(IsMainThread()); | 23 DCHECK(IsMainThread()); |
| 24 state_ = previous_state_; | 24 state_ = previous_state_; |
| 25 } | 25 } |
| 26 | 26 |
| 27 // static | 27 // static |
| 28 bool ScopedOrientationChangeIndicator::ProcessingOrientationChange() { | 28 bool ScopedOrientationChangeIndicator::ProcessingOrientationChange() { |
| 29 DCHECK(IsMainThread()); | 29 DCHECK(IsMainThread()); |
| 30 return state_ == State::kProcessing; | 30 return state_ == State::kProcessing; |
| 31 } | 31 } |
| 32 | 32 |
| 33 } // namespace blink | 33 } // namespace blink |
| OLD | NEW |