Filip Maj created CB-559:
----------------------------

             Summary: Windows Phone plugins (aka Commands) are instantiated on 
every cordova command call
                 Key: CB-559
                 URL: https://issues.apache.org/jira/browse/CB-559
             Project: Apache Callback
          Issue Type: Improvement
          Components: WP7
    Affects Versions: 1.6.1
         Environment: Samsung Focus
            Reporter: Filip Maj
            Assignee: Filip Maj
             Fix For: 1.7.0


Each instance of a plugin, in Windows Phone terminology a Command, just like on 
other platforms, are lazily-loaded. However, each is not cached once 
instantiated. Therefore, on every cordova command execution into native, a new 
instance of the desired Command is created.

For details, see the [ProcessCommand method and how it always invokes the 
CreateByServiceName 
method|https://github.com/apache/incubator-cordova-wp7/blob/master/framework/Cordova/NativeExecution.cs#L73],
 which in turns [always creates a new instance of a 
Plugin|https://github.com/apache/incubator-cordova-wp7/blob/master/framework/Cordova/CommandFactory.cs#L101].

Instead of caching the Command Type inside the Command Factory, we should cache 
instances of the plugins. This should speed up the bridge on calls to the same 
plugin as well as preserve the assumption that Plugins are singleton.

Working on patching this.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to