From callback-dev-return-14749-apmail-incubator-callback-dev-archive=incubator.apache.org@incubator.apache.org Fri Oct 5 18:29:26 2012 Return-Path: X-Original-To: apmail-incubator-callback-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8853DD7A8 for ; Fri, 5 Oct 2012 18:29:26 +0000 (UTC) Received: (qmail 99144 invoked by uid 500); 5 Oct 2012 18:29:26 -0000 Delivered-To: apmail-incubator-callback-dev-archive@incubator.apache.org Received: (qmail 99115 invoked by uid 500); 5 Oct 2012 18:29:26 -0000 Mailing-List: contact callback-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@incubator.apache.org Delivered-To: mailing list callback-dev@incubator.apache.org Received: (qmail 99107 invoked by uid 99); 5 Oct 2012 18:29:26 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Oct 2012 18:29:26 +0000 X-ASF-Spam-Status: No, hits=2.5 required=5.0 tests=FRT_ADOBE2,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of agrieve@google.com designates 209.85.214.175 as permitted sender) Received: from [209.85.214.175] (HELO mail-ob0-f175.google.com) (209.85.214.175) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Oct 2012 18:29:19 +0000 Received: by mail-ob0-f175.google.com with SMTP id eq6so1996634obc.6 for ; Fri, 05 Oct 2012 11:28:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type :x-system-of-record; bh=Ff25uY87l02xWE1t3hGmQbLy70rzSVdKkY1Y32NNqQk=; b=Iv2pbQuWnsSLIKrKaeFrKBD3xrB6l8i/GAEGm1dqOqpb7a+jFKzL+az2sU3JaZYh3Q HubWNQWFzk0h2FA9GQy3ev2mQ6Jg2FOnRf82FWVtX0btDYugsPsbAPcxkG0l2aNR33oT P2h9ULTLRejsWC047iNQRueXyOQMGawfBsqC1fFlnoZVrHPQHeReCGNfuhJk8lqSolpQ Il1xqH1AJB+763fNAgKVjWmf/VPlzeJlP1sp4EqQKSXTvwVTbrGWWRGDDCdkySaCyYrI uwvLd2/ix3r9YmZPS+FGpPVfZ5LCaOE9T7BUSK2Ah4yo3Aff0O6YoVEEzTYAPSmN1wlM Dqng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type :x-system-of-record:x-gm-message-state; bh=Ff25uY87l02xWE1t3hGmQbLy70rzSVdKkY1Y32NNqQk=; b=pMnN0OcwGiNATUJi7rcQhkCRjcDG81hzkGHn7BA8j0D58ifIB5Z/X7LsKdeDVisq1M eg6Ur3dbCoxN35AIIwIhC68Aq+mdfFMuW7GewvORFdFFQST6+3RFI11h+eX3YvEIneUr wTtlMd2w9Fq8KussUarjDaHQbz3CcZ/IGtz1NWE/uvhzUHDtL49Y9saasHfOCl63BfdI q8qlaFtaSiNngyzPL2reEfXnZMUqvBQHQMV/e3zJFE7d9Uum+znZ2YWeJ4bLRjg0U1Iy 8IrCJmdFImrgu+vZKhf/wqt9CgRrQEwkXyJHfJ5GmlZdcRT5p8wKySi9gKEkrs+florj SXwg== Received: by 10.182.202.39 with SMTP id kf7mr7812054obc.37.1349461738820; Fri, 05 Oct 2012 11:28:58 -0700 (PDT) MIME-Version: 1.0 Sender: agrieve@google.com Received: by 10.182.235.14 with HTTP; Fri, 5 Oct 2012 11:28:38 -0700 (PDT) In-Reply-To: References: From: Andrew Grieve Date: Fri, 5 Oct 2012 14:28:38 -0400 X-Google-Sender-Auth: DU7xG6Ii_ibdWwnDFXrIIVfqa_w Message-ID: Subject: Re: Changes to iOS PluginResult sending To: callback-dev@incubator.apache.org Content-Type: multipart/alternative; boundary=e89a8f6471d194942604cb540b8d X-System-Of-Record: true X-Gm-Message-State: ALoCoQk4TJCEpWUsVQVkZNTx3inPxLbw9ZDBcgOhDbQT6TQ2x21dZQ2w+U3Yfr6A28wJA03k+WZPquMFSWtbfrlCfnlPBzVoNgpOZjwJj5hWs1e8GHI/QhOPi3IrecaCidx8qFoibER1+qEOaiLTrAWfPcomBag21wCP/h287or4P6fQcdQ/ldXk1/RRc+ndeYmw6EvchDEtkOeZNf5EVP/9fD2d9Q2GEQ== --e89a8f6471d194942604cb540b8d Content-Type: text/plain; charset=ISO-8859-1 I'm not sure why this would have changed. The PluginResult::success method had a setTimeout in it, which I removed, but pretty much none of the core plugins used that method anyways. They all used writeJavascript:callback, which didn't use a setTimeout. The one spot in the code where I did see a comment about alerts causing deadlock worked around it dispatching using [self performSelectonOnMainThread:@selector(writeJavascript:) afterDelay]; This is what I've used to in the "new path" so that all plugins use it to avoid this case. What are the specific cases you're seeing? On Fri, Oct 5, 2012 at 2:06 PM, Becky Gibson wrote: > I am seeing instances where a JavaScript alert within a function callback > will hang the app. We have seen this issue before and the solution is to > wrap the alert in a setTimeout, for example, setTimeout(function() { > alert('error with ' + error.code); }); > > This problem now seems much more prevalent, especially with an iOS 5.1 > device. Could this be related to the exec speed improvements? If so we > need to make sure to document the use of setTimeout() or folks are going to > be unhappy when they go to run their apps. > > -becky > > On Fri, Oct 5, 2012 at 10:49 AM, Michal Mocny wrote: > > > For those who didn't click the bug link to read the full benchmarks, I'll > > summarize: > > > > If exec() is called from the context of a plugin result callback: perf > > improved *3x* [IFRAME_NAV] *6x* [XHR_NO_PAYLOAD] > > If exec() is called not from the context of a plugin result callback: > perf > > improved *66%* [IFRAME_NAV] *33%* [XHR_NO_PAYLOAD] > > > > Excellent work Andrew! > > > > > > > > On Thu, Oct 4, 2012 at 7:06 PM, Filip Maj wrote: > > > > > Sweet that sounds good > > > > > > On 10/4/12 2:20 PM, "Shazron" wrote: > > > > > > >+1 > > > > > > > >On Thu, Oct 4, 2012 at 2:18 PM, Brian LeRoux wrote: > > > >> nice! looks great andrew > > > >> > > > >> On Thu, Oct 4, 2012 at 10:48 PM, Andrew Grieve > > > >>wrote: > > > >>> TLDR: Added a new method for plugins to use to send plugin results > to > > > >>>JS. > > > >>> > > > >>> I've done some work to try and optimize the exec() bridge on iOS: > > > >>> https://issues.apache.org/jira/browse/CB-1579 > > > >>> > > > >>> The main goal of the change: whenever > > > >>>stringByEvaluatingJavascriptString is > > > >>> used to call a JS callback, poll for exec() messages using the > return > > > >>>value. > > > >>> > > > >>> The two ways plugins sent results in before my change: > > > >>> > > > >>> Before my change, plugins would send results using either: > > > >>> [self success:pluginResult callbackId:callbackId] > > > >>> or (more commonly) > > > >>> [self writeJavascript:[pluginResult > > toSuccessCallback:callbackId]] > > > >>> > > > >>> > > > >>> Both of these returned a string, which means I had to create a new > > > >>>method > > > >>> that could take advantage of the optimization. > > > >>> > > > >>> So, the new fancy: > > > >>> [self.commandDelegate sendPluginResult:pluginResult > > > >>>callbackId:callbackId]; > > > >>> > > > >>> And for custom JS callbacks: > > > >>> [self.commandDelegate evalJs:js]; // has a void return value. > > > >>> > > > >>> > > > >>> sendPluginResult: and evalJs:js have the extra bonus that they are > > > >>> thread-safe and they work around cases where an alert() in the JS > > > >>>callback > > > >>> would result in dead-lock. > > > >>> > > > >>> I've left both of the old signatures so as to not break third-party > > > >>> plugins, but did go and update all of the core plugins. I'd like to > > > >>> deprecate them. I'll go ahead and do that tomorrow probably. > > > >>> > > > >>> I plan on updating the plugin guide to use this new method. > > > > > > > > > --e89a8f6471d194942604cb540b8d--