blob: 0883aa1b01fd2ee8c1ca54682fb948f0c9904418 [file] [log] [blame]
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "platform/ScopedOrientationChangeIndicator.h"
#include "platform/wtf/Assertions.h"
namespace blink {
ScopedOrientationChangeIndicator::State
ScopedOrientationChangeIndicator::state_ =
ScopedOrientationChangeIndicator::State::kNotProcessing;
ScopedOrientationChangeIndicator::ScopedOrientationChangeIndicator() {
DCHECK(IsMainThread());
previous_state_ = state_;
state_ = State::kProcessing;
}
ScopedOrientationChangeIndicator::~ScopedOrientationChangeIndicator() {
DCHECK(IsMainThread());
state_ = previous_state_;
}
// static
bool ScopedOrientationChangeIndicator::ProcessingOrientationChange() {
DCHECK(IsMainThread());
return state_ == State::kProcessing;
}
} // namespace blink