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 01729DD09 for ; Wed, 26 Sep 2012 17:48:02 +0000 (UTC) Received: (qmail 19412 invoked by uid 500); 26 Sep 2012 17:48:01 -0000 Delivered-To: apmail-incubator-callback-dev-archive@incubator.apache.org Received: (qmail 19359 invoked by uid 500); 26 Sep 2012 17:48:01 -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 19350 invoked by uid 99); 26 Sep 2012 17:48:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Sep 2012 17:48:01 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of agrieve@google.com designates 209.85.216.47 as permitted sender) Received: from [209.85.216.47] (HELO mail-qa0-f47.google.com) (209.85.216.47) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Sep 2012 17:47:57 +0000 Received: by qafi29 with SMTP id i29so5628967qaf.6 for ; Wed, 26 Sep 2012 10:47:36 -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=eEHmzTVHUtIHD1ZmmaAk4I3HfLRkVS5pgk8WuCBtR2k=; b=P0BS8ZpBXQJqvPq4lJOQSwoK+HNJcI3l6IDKkYmc8xSyUceev4ihkRrkTDgr+IwrrU YD6b2ALhaQK1k2ttGJ7XoLn5snH6WN5BrYTrB8N0D6XfZ4iJUjqhZkFH40WqpMxQoFw8 XH6G39eQJFXrZnc+dQVHwg4egjCZH+EdFpNsj7C97DwzZmgyADI6opIbFp4XGfda0zVZ W4+pAaVR+AQCl2dcsiTTlw2u7uKRQvlYHFDVGNwJ/+WogNztGFqg3yyppQ/ofSd3SXYp Yi3K4SPd2avTb3/g5N9mYJaj2ITh8wQ/zzrHt0hBc6Lw4SabXSEJ7Mq9iNTbZna3jSu4 pTMw== 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=eEHmzTVHUtIHD1ZmmaAk4I3HfLRkVS5pgk8WuCBtR2k=; b=LMdxHo/Oqc6Fujbayr3VgosqoRwchTpIBNagO1sK5ggeEzFLyl/ctMoew3B0uI0xPV H+IRn2qWwa/D/T/GPix3fqyZ7HPWDAuP3jruDRZHT/I9GEsvkvEr6ACf8L4xJmfE/fZz 7960kiuTgbBwGMA42/G3pKdBwxlyqyxcCbnzS1tPRPcAvYLFbwWca75AAOg1XiG/lYIh 48nO67XDq9iTz1M9u3XQotYHNgNaGc/Ub0JpiwuY7qSL5JEJyAOS9pISh4W/3+K2oIF3 hNLI9oc5538s6ZeqJgxOsu9Xrkys365hySFPAtTBdiB7dXdtwtJ7nWoP6z88yKguRx9i E8Kg== Received: by 10.224.19.6 with SMTP id y6mr3769884qaa.17.1348681656624; Wed, 26 Sep 2012 10:47:36 -0700 (PDT) Received: by 10.224.19.6 with SMTP id y6mr3769850qaa.17.1348681656344; Wed, 26 Sep 2012 10:47:36 -0700 (PDT) MIME-Version: 1.0 Sender: agrieve@google.com Received: by 10.229.98.144 with HTTP; Wed, 26 Sep 2012 10:47:08 -0700 (PDT) In-Reply-To: References: From: Andrew Grieve Date: Wed, 26 Sep 2012 13:47:08 -0400 X-Google-Sender-Auth: MQJV8qatQHcm-aCpZJ4Plgkpm64 Message-ID: Subject: Re: Proposal for a new Plugin.execute() signature on Android To: callback-dev@incubator.apache.org Content-Type: multipart/alternative; boundary=14dae9ccdaee0aa0c304ca9e6b21 X-System-Of-Record: true X-Gm-Message-State: ALoCoQk4pj6dQ4pRf0KH/exTB06pdYXiAW2OAl41l/Q63x7aKcwDbixxBzMmi0rMbzSqM3pMFEOfZsdgTk64xhuJECwTZQvmcowvoChQw3KYfACX7FCfSanOegkzOqVtzOS/gWGHskiOyq1ZUu636pr2tGMQIixbC3ME1JRAPIF8XeEHvBK5P/DkWAb50k1fxBWeSRTuKZTp+ryNE0PmG8mNyhpx8US6Sw== X-Virus-Checked: Checked by ClamAV on apache.org --14dae9ccdaee0aa0c304ca9e6b21 Content-Type: text/plain; charset=ISO-8859-1 Okay, so I think everyone is on the same page in terms of not breaking existing plugins. Does anyone know what the reason was for making plugins async by default? On Wed, Sep 26, 2012 at 1:38 PM, Mike Reinstein wrote: > Agreed! If we can get to some kind of stability with the API exposed to > plugin developers it will go a long way. > > > > On Wed, Sep 26, 2012 at 1:32 PM, Simon MacDonald > wrote: > > > Agreed. We've broken the plugins so many times that I'm more that sure > > that 3rd party devs are sick of it. The last time we broken the > > interface on Android was in 1.9.0 and then we broke it again in 2.0.0 > > on the JavaScript side. I'd rather not break it again for 2.2.0. > > > > Also, when I say "break" I mean the code I wrote to the previous > > specification will no longer compile so I need to make changes to my > > plugin. Often we can get around this by adding in a shim which I > > believe is the best way to go. > > > > Simon Mac Donald > > http://hi.im/simonmacdonald > > > > > > On Wed, Sep 26, 2012 at 3:56 AM, Brian LeRoux wrote: > > > The only concern I have is the deprecation path needs to be long and > > > noisy---this is probably the biggest possible breaking change we could > > > introduce to the platform. > > > > > > Maybe even longer than our usual 6months / but wait until 3.0 > > > > > > Thoughts on that? > > > > > > > > > On Tue, Sep 25, 2012 at 4:56 PM, Andrew Grieve > > wrote: > > >> Michal - Yep, good summary, that's exactly the case. > > >> Simon - totally agree. I'll change what I've got to add a second > > executeV2 > > >> which takes in a JSONArray, and have the String-based one just call > > that. > > >> > > >> The reason to need an executeV2 is threading, so I'll focus on that. > > >> > > >> My biggest gripe against the current signature, is that it defaults to > > >> running things on a background thread. I expect most calls will be > fast > > >> enough to execute inline, some calls to need to run on the UI thread, > > and > > >> then only some to require doing a lot of work on a background thread. > > >> Furthermore, those that do require a background would often benefit > from > > >> doing some param/state checking on the calling thread before moving to > > the > > >> background thread. > > >> > > >> I wouldn't be proposing a new signature if there was a way to change > > >> isSync() from defaulting to false to defaulting to true, but I don't > > think > > >> that's a safe thing to change. > > >> > > >> On iOS, plugins execute on the calling thread and it's up to them to > > >> dispatch background threads if they need them. > > >> > > >> Michal pointed out that you can't comment on a diff in github, so I > > opened > > >> a pull request with the patch to enable commenting: > > >> > > > https://github.com/agrieve/incubator-cordova-android/commit/a73dffc99847b14031c1138611bb8772dc9d7b7e > > >> > > >> > > >> > > >> > > >> > > >> On Tue, Sep 25, 2012 at 10:51 AM, Simon MacDonald < > > simon.macdonald@gmail.com > > >>> wrote: > > >> > > >>> Here is what I was thinking on: > > >>> > > >>> https://issues.apache.org/jira/browse/CB-1530 > > >>> > > >>> In the PluginManager change the code so that is calls: > > >>> > > >>> plugin.execute(string, string, string); > > >>> > > >>> Then in the Plugin class add a new default method that does the > > following: > > >>> > > >>> public PluginResult execute(String action, String args, String > > callbackId) > > >>> { > > >>> return execute(action, new JSONArrary(args), callbackId); > > >>> } > > >>> > > >>> so that all the current plugins continue to work without needing any > > >>> changes. If someone wants to provide their own JSON parsing they can > > >>> override the plugin.execute(string, string, string) method and do it > > >>> themselves. > > >>> > > >>> Simon Mac Donald > > >>> http://hi.im/simonmacdonald > > >>> > > >>> > > >>> On Tue, Sep 25, 2012 at 10:33 AM, Michal Mocny > > >>> wrote: > > >>> > > > >>> > Summarizing what I think I'm hearing: > > >>> > > > >>> > The current exec signature will currently: > > >>> > (a) automatically parse JSON arguments, and > > >>> > (b) automatically move async calls onto a background thread. > > >>> > > > >>> > While both of the features simplify plugin developers in most > cases, > > >>> > sometimes manual control is desired (ie, for the two bugs you link > > to). > > >>> > > > >>> > That sounds reasonable, however, I think I'm also hearing a > proposal > > to > > >>> > replace the existing execute signature (deprecating the current > > one). If > > >>> > for the majority of cases we are happy with the current signature, > > then > > >>> is > > >>> > there perhaps a less intrusive solution? Or maybe we aren't happy > > with > > >>> the > > >>> > current signature, and this new signature is generally more future > > proof, > > >>> > more performant, etc, giving us other reasons for changing? Also, > > how > > >>> does > > >>> > this compare with other platforms? > > >>> > > > >>> > -Michal > > >>> > > > >>> > > > >>> > On Mon, Sep 24, 2012 at 11:50 PM, Andrew Grieve < > agrieve@google.com> > > >>> wrote: > > >>> > > > >>> > > Means to address two bugs: > > >>> > > > > >>> > > https://issues.apache.org/jira/browse/CB-1530 > > >>> > > https://issues.apache.org/jira/browse/CB-1532 > > >>> > > > > >>> > > I wanted to gather some opinions from those who have been around > > for > > >>> > > longer. Here is the proposed change: > > >>> > > https://github.com/agrieve/incubator-cordova-android/compare/ft3 > > >>> > > > > >>> > > My main motivation is for FileTransfer, I need to register the > > transfer > > >>> > > synchronously so that a subsequent abort() will not have a race > > >>> condition. > > >>> > > I then perform the transfer in a background thread. I *could* > > implement > > >>> > > this using the current signature by returning true in isSync() > and > > then > > >>> > > returning a NO_RESULT result, but I think the intentions are > > clearer > > >>> with > > >>> > > the new signature. > > >>> > > > > >>> > > > --14dae9ccdaee0aa0c304ca9e6b21--