[gnome-documents/gnome-3-24] documents: Sprinkle debug



commit 0f78c2ed7e4ae42b5baa5c15b81daf2a5303de96
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Apr 20 12:02:07 2017 +0200

    documents: Sprinkle debug
    
    https://bugzilla.gnome.org/show_bug.cgi?id=781531

 src/documents.js |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/documents.js b/src/documents.js
index 328ff03..18d32a6 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -372,6 +372,8 @@ const DocCommon = new Lang.Class({
         GLib.mkdir_with_parents(localDir, 448);
 
         if (!useCache) {
+            Utils.debug('Downloading ' + this.__name__ + ' ' + this.id + ' to ' + this.uriToLoad +
+                        ': bypass cache ');
             this.downloadImpl(localFile, cancellable, callback);
             return;
         }
@@ -387,6 +389,8 @@ const DocCommon = new Lang.Class({
                 try {
                     info = object.query_info_finish(res);
                 } catch (e) {
+                    Utils.debug('Downloading ' + this.__name__ + ' ' + this.id + ' to ' + this.uriToLoad +
+                                ': cache miss');
                     this.downloadImpl(localFile, cancellable, callback);
                     return;
                 }
@@ -397,6 +401,8 @@ const DocCommon = new Lang.Class({
                     return;
                 }
 
+                Utils.debug('Downloading ' + this.__name__ + ' ' + this.id + ' to ' + this.uriToLoad +
+                            ': cache stale (' + this.mtime + ' > ' + cacheMtime + ')');
                 this.downloadImpl(localFile, cancellable, callback);
             }));
     },
@@ -406,6 +412,7 @@ const DocCommon = new Lang.Class({
     },
 
     load: function(passwd, cancellable, callback) {
+        Utils.debug('Loading ' + this.__name__ + ' ' + this.id);
         this.download(true, cancellable, Lang.bind(this,
             function(fromCache, error) {
                 if (error) {
@@ -670,6 +677,8 @@ const DocCommon = new Lang.Class({
     },
 
     loadLocal: function(passwd, cancellable, callback) {
+        Utils.debug('Loading ' + this.__name__ + ' ' + this.id + ' from ' + this.uriToLoad);
+
         if (this.mimeType == 'application/x-mobipocket-ebook' ||
             this.mimeType == 'application/x-fictionbook+xml' ||
             this.mimeType == 'application/x-zip-compressed-fb2') {
@@ -857,6 +866,7 @@ const LocalDocument = new Lang.Class({
     },
 
     load: function(passwd, cancellable, callback) {
+        Utils.debug('Loading ' + this.__name__ + ' ' + this.id);
         this.loadLocal(passwd, cancellable, callback);
     },
 
@@ -949,6 +959,8 @@ const GoogleDocument = new Lang.Class({
                     return;
                 }
 
+                Utils.debug('Created GDataEntry for ' + this.id);
+
                 let inputStream;
 
                 try {
@@ -1286,6 +1298,8 @@ const SkydriveDocument = new Lang.Class({
                     return;
                 }
 
+                Utils.debug('Created ZpjEntry for ' + this.id);
+
                 service.download_file_to_stream_async(entry, cancellable, Lang.bind(this,
                     function(object, res) {
                         let inputStream;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]