| Index: third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationControllerImpl.cpp
|
| diff --git a/third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationControllerImpl.cpp b/third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationControllerImpl.cpp
|
| index d5eb971ba7d9a06f8b194a01ec05bd084c1cf0b2..6ce6ca399484c608e202bbc331d00eef55846963 100644
|
| --- a/third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationControllerImpl.cpp
|
| +++ b/third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationControllerImpl.cpp
|
| @@ -13,7 +13,6 @@
|
| #include "core/page/ChromeClient.h"
|
| #include "core/page/Page.h"
|
| #include "modules/screen_orientation/ScreenOrientation.h"
|
| -#include "modules/screen_orientation/ScreenOrientationDispatcher.h"
|
| #include "platform/LayoutTestSupport.h"
|
| #include "platform/ScopedOrientationChangeIndicator.h"
|
| #include "public/platform/WebScreenInfo.h"
|
| @@ -43,7 +42,7 @@ ScreenOrientationControllerImpl::ScreenOrientationControllerImpl(
|
| WebScreenOrientationClient* client)
|
| : ScreenOrientationController(frame),
|
| ContextLifecycleObserver(frame.document()),
|
| - PlatformEventController(&frame),
|
| + PageVisibilityObserver(frame.page()),
|
| m_client(client),
|
| m_dispatchEventTimer(
|
| TaskRunnerHelper::get(TaskType::MiscPlatformAPI, &frame),
|
| @@ -114,7 +113,7 @@ bool ScreenOrientationControllerImpl::isActiveAndVisible() const {
|
| }
|
|
|
| void ScreenOrientationControllerImpl::pageVisibilityChanged() {
|
| - notifyDispatcher();
|
| + notifyAccurateListen();
|
|
|
| if (!isActiveAndVisible())
|
| return;
|
| @@ -172,7 +171,7 @@ void ScreenOrientationControllerImpl::setOrientation(
|
| m_orientation = orientation;
|
| if (m_orientation)
|
| updateOrientation();
|
| - notifyDispatcher();
|
| + notifyAccurateListen();
|
| }
|
|
|
| void ScreenOrientationControllerImpl::lock(
|
| @@ -205,40 +204,36 @@ void ScreenOrientationControllerImpl::dispatchEventTimerFired(TimerBase*) {
|
| m_orientation->dispatchEvent(Event::create(EventTypeNames::change));
|
| }
|
|
|
| -void ScreenOrientationControllerImpl::didUpdateData() {
|
| - // Do nothing.
|
| -}
|
| -
|
| -void ScreenOrientationControllerImpl::registerWithDispatcher() {
|
| - ScreenOrientationDispatcher::instance().addController(this);
|
| -}
|
| -
|
| -void ScreenOrientationControllerImpl::unregisterWithDispatcher() {
|
| - ScreenOrientationDispatcher::instance().removeController(this);
|
| -}
|
| -
|
| -bool ScreenOrientationControllerImpl::hasLastData() {
|
| - return true;
|
| -}
|
| -
|
| void ScreenOrientationControllerImpl::contextDestroyed(ExecutionContext*) {
|
| - stopUpdating();
|
| + if (m_startedAccurateListen) {
|
| + m_client->stopAccurateListen();
|
| + m_startedAccurateListen = false;
|
| + }
|
| m_client = nullptr;
|
| m_activeLock = false;
|
| }
|
|
|
| -void ScreenOrientationControllerImpl::notifyDispatcher() {
|
| - if (m_orientation && page()->isPageVisible())
|
| - startUpdating();
|
| - else
|
| - stopUpdating();
|
| +void ScreenOrientationControllerImpl::notifyAccurateListen() {
|
| + if (m_orientation && page()->isPageVisible()) {
|
| + // Timing to start accurate listening.
|
| + if (!m_startedAccurateListen) {
|
| + m_client->startAccurateListen();
|
| + m_startedAccurateListen = true;
|
| + }
|
| + } else {
|
| + // Timing to stop accurate listening.
|
| + if (m_startedAccurateListen) {
|
| + m_client->stopAccurateListen();
|
| + m_startedAccurateListen = false;
|
| + }
|
| + }
|
| }
|
|
|
| DEFINE_TRACE(ScreenOrientationControllerImpl) {
|
| visitor->trace(m_orientation);
|
| ContextLifecycleObserver::trace(visitor);
|
| Supplement<LocalFrame>::trace(visitor);
|
| - PlatformEventController::trace(visitor);
|
| + PageVisibilityObserver::trace(visitor);
|
| }
|
|
|
| } // namespace blink
|
|
|