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

Unified Diff: third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationDispatcher.cpp

Issue 2751513007: [Device Service] Eliminate content::ScreenOrientationObserver. (Closed)
Patch Set: Use DCHECK(!m_listener) in destructor Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationDispatcher.cpp
diff --git a/third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationDispatcher.cpp b/third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationDispatcher.cpp
index fccceedf4be6573204b6e60490409cf2c016a675..4e6defe840e334589ef3a8bebdcbe575a094c49b 100644
--- a/third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationDispatcher.cpp
+++ b/third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationDispatcher.cpp
@@ -4,7 +4,9 @@
#include "modules/screen_orientation/ScreenOrientationDispatcher.h"
+#include "platform/ServiceConnector.h"
#include "public/platform/Platform.h"
+#include "services/device/public/interfaces/constants.mojom-blink.h"
namespace blink {
@@ -16,16 +18,27 @@ ScreenOrientationDispatcher& ScreenOrientationDispatcher::instance() {
ScreenOrientationDispatcher::ScreenOrientationDispatcher() {}
+ScreenOrientationDispatcher::~ScreenOrientationDispatcher() {
+ DCHECK(!m_listener);
+}
+
DEFINE_TRACE(ScreenOrientationDispatcher) {
PlatformEventDispatcher::trace(visitor);
}
void ScreenOrientationDispatcher::startListening() {
- Platform::current()->startListening(WebPlatformEventTypeScreenOrientation, 0);
+ DCHECK(!m_listener);
+
+ ServiceConnector::instance().connectToInterface(
+ device::mojom::blink::kServiceName, mojo::MakeRequest(&m_listener));
+ m_listener->Start();
}
void ScreenOrientationDispatcher::stopListening() {
- Platform::current()->stopListening(WebPlatformEventTypeScreenOrientation);
+ DCHECK(m_listener);
+
+ m_listener->Stop();
+ m_listener.reset();
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698