cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [1/2] ios commit: [CB-4133] iOS detection of plugins that run long on main thread
Date Wed, 17 Jul 2013 00:52:18 GMT
Updated Branches:
  refs/heads/3.0.x f84601560 -> 68f2bc6e4
  refs/heads/master 814e9e0cd -> b4a3cd16a


[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/b4a3cd16
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/b4a3cd16
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/b4a3cd16

Branch: refs/heads/master
Commit: b4a3cd16a74a353fb4f2109ac84cca055a9f4032
Parents: 814e9e0
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:51:59 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/b4a3cd16/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/b4a3cd16/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