cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [2/2] ios commit: [CB-4133] iOS detection of plugins that run long on main thread
Date Wed, 17 Jul 2013 00:52:19 GMT
[CB-4133] iOS detection of plugins that run long on main thread


Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/68f2bc6e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/68f2bc6e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/68f2bc6e

Branch: refs/heads/3.0.x
Commit: 68f2bc6e4c52d6b0fe4323674d9f1e97e07f8055
Parents: f846015
Author: David Kemp <drkemp@chromium.org>
Authored: Thu Jul 11 07:54:11 2013 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Tue Jul 16 20:52:12 2013 -0400

----------------------------------------------------------------------
 CordovaLib/Classes/CDVCommandQueue.m    | 7 +++++--
 CordovaLib/Classes/CDVWebViewDelegate.m | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/68f2bc6e/CordovaLib/Classes/CDVCommandQueue.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCommandQueue.m b/CordovaLib/Classes/CDVCommandQueue.m
index 6b2c541..710e463 100644
--- a/CordovaLib/Classes/CDVCommandQueue.m
+++ b/CordovaLib/Classes/CDVCommandQueue.m
@@ -141,7 +141,7 @@
         return NO;
     }
     BOOL retVal = YES;
-
+    double started = [[NSDate date] timeIntervalSince1970] * 1000.0;
     // Find the proper selector to call.
     NSString* methodName = [NSString stringWithFormat:@"%@:", command.methodName];
     SEL normalSelector = NSSelectorFromString(methodName);
@@ -153,7 +153,10 @@
         NSLog(@"ERROR: Method '%@' not defined in Plugin '%@'", methodName, command.className);
         retVal = NO;
     }
-
+    double elapsed = [[NSDate date] timeIntervalSince1970] * 1000.0 - started;
+    if (elapsed > 10) {
+        NSLog(@"THREAD WARNING: ['%@'] took '%f' ms. Plugin should use a background thread.",
command.className, elapsed);
+    }
     return retVal;
 }
 

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/68f2bc6e/CordovaLib/Classes/CDVWebViewDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewDelegate.m b/CordovaLib/Classes/CDVWebViewDelegate.m
index fa1ecc7..6576b14 100644
--- a/CordovaLib/Classes/CDVWebViewDelegate.m
+++ b/CordovaLib/Classes/CDVWebViewDelegate.m
@@ -363,7 +363,7 @@ typedef enum {
             break;
 
         case STATE_WAITING_FOR_LOAD_FINISH:
-            if([error code] != NSURLErrorCancelled) {
+            if ([error code] != NSURLErrorCancelled) {
                 if (_loadCount == 1) {
                     _state = STATE_IDLE;
                     fireCallback = YES;


Mime
View raw message