Title: [191007] trunk/Source/WebCore
Revision
191007
Author
[email protected]
Date
2015-10-13 14:45:43 -0700 (Tue, 13 Oct 2015)

Log Message

ASSERT(m_motionManager) on emgn.com page
https://bugs.webkit.org/show_bug.cgi?id=150070
<rdar://problem/18383732>

Reviewed by Simon Fraser.

In the WebCoreMotionManager init method, we call
into another setup method on the main thread.
However, if a listener was attached before that
ran, we'd ASSERT. This wasn't actually causing a bug
because the main thread initialization would
check the listeners once it got a chance to run.

The fix is to only check status when we've
actually initialized.

* platform/ios/WebCoreMotionManager.h: New m_initialized boolean.
* platform/ios/WebCoreMotionManager.mm: Check m_initialized before doing real work.
(-[WebCoreMotionManager init]):
(-[WebCoreMotionManager addMotionClient:]):
(-[WebCoreMotionManager removeMotionClient:]):
(-[WebCoreMotionManager addOrientationClient:]):
(-[WebCoreMotionManager removeOrientationClient:]):
(-[WebCoreMotionManager initializeOnMainThread]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (191006 => 191007)


--- trunk/Source/WebCore/ChangeLog	2015-10-13 21:28:21 UTC (rev 191006)
+++ trunk/Source/WebCore/ChangeLog	2015-10-13 21:45:43 UTC (rev 191007)
@@ -1,3 +1,30 @@
+2015-10-12  Dean Jackson  <[email protected]>
+
+        ASSERT(m_motionManager) on emgn.com page
+        https://bugs.webkit.org/show_bug.cgi?id=150070
+        <rdar://problem/18383732>
+
+        Reviewed by Simon Fraser.
+
+        In the WebCoreMotionManager init method, we call
+        into another setup method on the main thread.
+        However, if a listener was attached before that
+        ran, we'd ASSERT. This wasn't actually causing a bug
+        because the main thread initialization would
+        check the listeners once it got a chance to run.
+
+        The fix is to only check status when we've
+        actually initialized.
+
+        * platform/ios/WebCoreMotionManager.h: New m_initialized boolean.
+        * platform/ios/WebCoreMotionManager.mm: Check m_initialized before doing real work.
+        (-[WebCoreMotionManager init]):
+        (-[WebCoreMotionManager addMotionClient:]):
+        (-[WebCoreMotionManager removeMotionClient:]):
+        (-[WebCoreMotionManager addOrientationClient:]):
+        (-[WebCoreMotionManager removeOrientationClient:]):
+        (-[WebCoreMotionManager initializeOnMainThread]):
+
 2015-10-13  Chris Dumez  <[email protected]>
 
         Avoid useless copies in range-loops that are using 'auto'

Modified: trunk/Source/WebCore/platform/ios/WebCoreMotionManager.h (191006 => 191007)


--- trunk/Source/WebCore/platform/ios/WebCoreMotionManager.h	2015-10-13 21:28:21 UTC (rev 191006)
+++ trunk/Source/WebCore/platform/ios/WebCoreMotionManager.h	2015-10-13 21:45:43 UTC (rev 191007)
@@ -45,6 +45,7 @@
     NSTimer* m_updateTimer;
     BOOL m_gyroAvailable;
     BOOL m_headingAvailable;
+    BOOL m_initialized;
 }
 
 + (WebCoreMotionManager *)sharedManager;

Modified: trunk/Source/WebCore/platform/ios/WebCoreMotionManager.mm (191006 => 191007)


--- trunk/Source/WebCore/platform/ios/WebCoreMotionManager.mm	2015-10-13 21:28:21 UTC (rev 191006)
+++ trunk/Source/WebCore/platform/ios/WebCoreMotionManager.mm	2015-10-13 21:45:43 UTC (rev 191007)
@@ -77,6 +77,7 @@
     self = [super init];
     if (self)
         [self performSelectorOnMainThread:@selector(initializeOnMainThread) withObject:nil waitUntilDone:NO];
+
     return self;
 }
 
@@ -103,25 +104,29 @@
 - (void)addMotionClient:(WebCore::DeviceMotionClientIOS *)client
 {
     m_deviceMotionClients.add(client);
-    [self checkClientStatus];
+    if (m_initialized)
+        [self checkClientStatus];
 }
 
 - (void)removeMotionClient:(WebCore::DeviceMotionClientIOS *)client
 {
     m_deviceMotionClients.remove(client);
-    [self checkClientStatus];
+    if (m_initialized)
+        [self checkClientStatus];
 }
 
 - (void)addOrientationClient:(WebCore::DeviceOrientationClientIOS *)client
 {
     m_deviceOrientationClients.add(client);
-    [self checkClientStatus];
+    if (m_initialized)
+        [self checkClientStatus];
 }
 
 - (void)removeOrientationClient:(WebCore::DeviceOrientationClientIOS *)client
 {
     m_deviceOrientationClients.remove(client);
-    [self checkClientStatus];
+    if (m_initialized)
+        [self checkClientStatus];
 }
 
 - (BOOL)gyroAvailable
@@ -150,6 +155,8 @@
     m_locationManager = [allocCLLocationManagerInstance() init];
     m_headingAvailable = [getCLLocationManagerClass() headingAvailable];
 
+    m_initialized = YES;
+
     [self checkClientStatus];
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to