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



commit e7ea85a4e1daafc971b4c42c1bc3514a46a663df
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 7fd95b4..030ea62 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -366,6 +366,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;
         }
@@ -381,6 +383,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;
                 }
@@ -391,6 +395,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);
             }));
     },
@@ -400,6 +406,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) {
@@ -662,6 +669,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') {
@@ -854,6 +863,7 @@ const LocalDocument = new Lang.Class({
     },
 
     load: function(passwd, cancellable, callback) {
+        Utils.debug('Loading ' + this.__name__ + ' ' + this.id);
         this.loadLocal(passwd, cancellable, callback);
     },
 
@@ -946,6 +956,8 @@ const GoogleDocument = new Lang.Class({
                     return;
                 }
 
+                Utils.debug('Created GDataEntry for ' + this.id);
+
                 let inputStream;
 
                 try {
@@ -1285,6 +1297,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]