Stale image preview - refresh image when the timestamp of image file changes on disk #6443

wants to merge 2 commits into


None yet
4 participants

couzteau commented Jan 9, 2014

fix #6356 - forcing CEF to reload a cached image when its timestamp on disk changes.

This pull does two things:
a) it enables file sync manager to detect if an image file viewed by a custom viewer changes
b) it enables a work around for CEFs failure to reload files that changed on disk.

Ideally none of this code would not be necessary if CEF automatically purged its cache of files loaded via the file protocol based on their timestamp on disk.

couzteau added some commits Jan 9, 2014

@ghost ghost assigned peterflynn Jan 24, 2014


dangoor commented May 16, 2014

@peterflynn I think your plate may be overloaded. Should we reassign this PR?

@couzteau I know you're busy with other things. Do you want someone else to take over this change?


JeffryBooher commented May 27, 2014

@couzteau @dangoor we're going to need this fixed for split view so i'm going to take this over.

@@ -73,6 +74,8 @@ define(function (require, exports, module) {
var _currentEditorsDocument = null;
/** @type {?string} full path to file */
var _currentlyViewedPath = null;
+ /** @type {?Date} modification time of file */
+ var _currentlyViewedFileMTime = null;

peterflynn May 27, 2014


I'm not sure if we should make EditorManager responsible for tracking the mtime on behalf of custom viewers -- in particular, having this 'singletonized' as module state doesn't scale well to split views. If there was a custom viewer base class, that might be a natural place to put it, but we don't have that at this point... It seems cleaner to do one of these things:

  • Have FileSyncManager just ask EditorManager to call something like customViewer.fileMaybeModified(mtime) 100% of the time. And then the custom viewer could check that again whatever mtime it had last, per custom viewer instance.
  • Extension of above: Actually make an (optional) custom viewer base class for tracking mtime
  • Bypass FileSyncManager and listen for specific FileSystem change notifications -- like we do for updating the FindInFiles results panel. Parsing the change events is a little tricky since there are a number of different cases (see docs at top of FileSystem module), but it's definitely the most efficient way to go -- which also will matter more once we have splitviews.

couzteau commented Jun 5, 2014

Closing as this has been replaced by #7952

@couzteau couzteau closed this Jun 5, 2014

@couzteau couzteau deleted the couzteau/fix-6356-stale-image-update branch Jun 5, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment