You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/07/17 02:52:18 UTC

[1/2] ios commit: [CB-4133] iOS detection of plugins that run long on main thread

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 <dr...@chromium.org>
Authored: Thu Jul 11 07:54:11 2013 -0400
Committer: Andrew Grieve <ag...@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;


[2/2] ios commit: [CB-4133] iOS detection of plugins that run long on main thread

Posted by ag...@apache.org.
[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 <dr...@chromium.org>
Authored: Thu Jul 11 07:54:11 2013 -0400
Committer: Andrew Grieve <ag...@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;