Aaron created CB-9236:
-------------------------

             Summary: File plugin takes 500+ms on iOS, causing web thread to 
lock until done
                 Key: CB-9236
                 URL: https://issues.apache.org/jira/browse/CB-9236
             Project: Apache Cordova
          Issue Type: Improvement
          Components: iOS, Plugin File
    Affects Versions: 5.0.0
         Environment: iPad mini retina, iPad air 2. Both running iOS 8.3
            Reporter: Aaron


Hello,

I'm using the file API to store a gif created by the yahoo gifshot plugin. When 
the gifshot callback fires, i see in the xcode logs:

2015-06-23 12:07:42.467 AppName[5446:2010157] THREAD WARNING: ['File'] took 
'12.512939' ms. Plugin should use a background thread.
2015-06-23 12:07:43.094 AppName[5446:2010157] THREAD WARNING: ['File'] took 
'566.554932' ms. Plugin should use a background thread

This tends to interrupt interactions in the webview, such as typing into a 
form, tapping buttons, canvas animations, etc. I'm wondering if it's possible 
to get this running a separate thread. Note that a couple apps ive seen this in 
have been for iOS only. I do not have the means to run this on android & test, 
because it is using a custom plugin only built for iOS. So i cannot make a test 
case there.

Here's the respected javascript code:
{code:javascript}
    window.requestFileSystem(window.LocalFileSystem.PERSISTENT, 0, function 
(fileSys) {
      var myFolderApp = 'AppFolder';
      fileSys.root.getDirectory(myFolderApp, { create: true, exclusive: false 
}, function (directory) {
        fileSys.root.getFile(directory.fullPath + "/" + Date.now() + ".gif", { 
create: true, exclusive: false }, function (entry) {
          entry.createWriter(function (writer) {
            writer.onwriteend = function () {
              _this.processingAGif = false;
              if (InteractionStore.getByUUID(interactionUUID)) {
                MediaStore.saveForUUID(interactionUUID, entry.fullPath);
                if (InteractionStore.getByUUID(interactionUUID).complete) {
                  InteractionStore.commitInteraction(interactionUUID);
                }
                else {
                  InteractionStore.setUUIDToProcessed(interactionUUID);
                }
              }
            };
            writer.write(_this.dataURItoBlob(_this.imagebase64));
          });
        });
      });
    });
{code}

The InteractionStore and MediaStore are just memory stores for small bits of 
data. Inconsequential at this point. The commitInteraction writes the paths to 
the websql store.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to