Title: [97972] trunk/Source/WebCore
Revision
97972
Author
kenn...@webkit.org
Date
2011-10-20 06:21:26 -0700 (Thu, 20 Oct 2011)

Log Message

m_client in DeviceMotionController can never be 0, so no need to check for it
https://bugs.webkit.org/show_bug.cgi?id=70490

Reviewed by Simon Hausmann.

No behavior change, thus no new tests.

* dom/DeviceMotionController.cpp:
(WebCore::DeviceMotionController::timerFired):
(WebCore::DeviceMotionController::addListener):
(WebCore::DeviceMotionController::removeListener):
(WebCore::DeviceMotionController::removeAllListeners):
(WebCore::DeviceMotionController::suspend):
(WebCore::DeviceMotionController::resume):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (97971 => 97972)


--- trunk/Source/WebCore/ChangeLog	2011-10-20 13:18:51 UTC (rev 97971)
+++ trunk/Source/WebCore/ChangeLog	2011-10-20 13:21:26 UTC (rev 97972)
@@ -1,3 +1,20 @@
+2011-10-20  Kenneth Rohde Christiansen  <kenn...@webkit.org>
+
+        m_client in DeviceMotionController can never be 0, so no need to check for it
+        https://bugs.webkit.org/show_bug.cgi?id=70490
+
+        Reviewed by Simon Hausmann.
+
+        No behavior change, thus no new tests.
+
+        * dom/DeviceMotionController.cpp:
+        (WebCore::DeviceMotionController::timerFired):
+        (WebCore::DeviceMotionController::addListener):
+        (WebCore::DeviceMotionController::removeListener):
+        (WebCore::DeviceMotionController::removeAllListeners):
+        (WebCore::DeviceMotionController::suspend):
+        (WebCore::DeviceMotionController::resume):
+
 2011-10-20  Cary Clark  <carycl...@google.com>
 
         [Chromium Skia on Mac] Improve focus ring

Modified: trunk/Source/WebCore/dom/DeviceMotionController.cpp (97971 => 97972)


--- trunk/Source/WebCore/dom/DeviceMotionController.cpp	2011-10-20 13:18:51 UTC (rev 97971)
+++ trunk/Source/WebCore/dom/DeviceMotionController.cpp	2011-10-20 13:21:26 UTC (rev 97972)
@@ -48,10 +48,10 @@
 void DeviceMotionController::timerFired(Timer<DeviceMotionController>* timer)
 {
     ASSERT_UNUSED(timer, timer == &m_timer);
-    ASSERT(!m_client || m_client->currentDeviceMotion());
+    ASSERT(m_client->currentDeviceMotion());
     m_timer.stop();
     
-    RefPtr<DeviceMotionData> deviceMotionData = m_client ? m_client->currentDeviceMotion() : DeviceMotionData::create();
+    RefPtr<DeviceMotionData> deviceMotionData = m_client->currentDeviceMotion();
     RefPtr<DeviceMotionEvent> event = DeviceMotionEvent::create(eventNames().devicemotionEvent, deviceMotionData.get());
  
     Vector<RefPtr<DOMWindow> > listenersVector;
@@ -63,9 +63,9 @@
     
 void DeviceMotionController::addListener(DOMWindow* window)
 {
-    // If no client is present or the client already has motion data,
+    // If the client already has motion data,
     // immediately trigger an asynchronous response.
-    if (!m_client || m_client->currentDeviceMotion()) {
+    if (m_client->currentDeviceMotion()) {
         m_newListeners.add(window);
         if (!m_timer.isActive())
             m_timer.startOneShot(0);
@@ -73,7 +73,7 @@
     
     bool wasEmpty = m_listeners.isEmpty();
     m_listeners.add(window);
-    if (wasEmpty && m_client)
+    if (wasEmpty)
         m_client->startUpdating();
 }
 
@@ -81,7 +81,7 @@
 {
     m_listeners.remove(window);
     m_newListeners.remove(window);
-    if (m_listeners.isEmpty() && m_client)
+    if (m_listeners.isEmpty())
         m_client->stopUpdating();
 }
 
@@ -93,19 +93,18 @@
 
     m_listeners.removeAll(window);
     m_newListeners.remove(window);
-    if (m_listeners.isEmpty() && m_client)
+    if (m_listeners.isEmpty())
         m_client->stopUpdating();
 }
 
 void DeviceMotionController::suspend()
 {
-    if (m_client)
-        m_client->stopUpdating();
+    m_client->stopUpdating();
 }
 
 void DeviceMotionController::resume()
 {
-    if (m_client && !m_listeners.isEmpty())
+    if (!m_listeners.isEmpty())
         m_client->startUpdating();
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to