diff options
author | Liang Qi <liang.qi@qt.io> | 2016-10-08 17:15:55 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-10-08 17:15:55 +0200 |
commit | 3e71810cf3153e4331fc075a73b6408adcf33654 (patch) | |
tree | 9f5fbb7a5dc2a902b380dd69a222c0f2cd6eb760 /src/corelib/io/qfilesystemwatcher_fsevents_p.h | |
parent | 6feec9da93032d11a768802ac2187d9d4153b1ec (diff) | |
parent | ebd1046323615f22192055a94438bf85fc360ca3 (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
src/network/access/qhttpnetworkconnection.cpp
src/network/access/qhttpnetworkconnection_p.h
Change-Id: I11f8641ef482efa8cee1b79977d19cc3182814b4
Diffstat (limited to 'src/corelib/io/qfilesystemwatcher_fsevents_p.h')
-rw-r--r-- | src/corelib/io/qfilesystemwatcher_fsevents_p.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/corelib/io/qfilesystemwatcher_fsevents_p.h b/src/corelib/io/qfilesystemwatcher_fsevents_p.h index 5281d64d63..c23fc63735 100644 --- a/src/corelib/io/qfilesystemwatcher_fsevents_p.h +++ b/src/corelib/io/qfilesystemwatcher_fsevents_p.h @@ -87,7 +87,7 @@ Q_SIGNALS: private slots: void doEmitFileChanged(const QString &path, bool removed); void doEmitDirectoryChanged(const QString &path, bool removed); - void restartStream(); + bool restartStream(); private: struct Info { @@ -118,6 +118,19 @@ private: typedef QHash<QString, DirInfo> DirsByName; typedef QHash<QString, qint64> PathRefCounts; + struct WatchingState { + // These fields go hand-in-hand. FSEvents watches paths, and there is no use in watching + // the same path multiple times. So, the "refcount" on a path is the number of watched + // files that have the same path, plus the number of directories that have the same path. + // + // If the stream fails to start after adding files/directories, the watcher will try to + // keep watching files/directories that it was already watching. It does that by restoring + // the previous WatchingState and restarting the stream. + FilesByPath watchedFiles; + DirsByName watchedDirectories; + PathRefCounts watchedPaths; + }; + QFseventsFileSystemWatcherEngine(QObject *parent); bool startStream(); void stopStream(bool isStopped = false); @@ -131,10 +144,8 @@ private: QMutex lock; dispatch_queue_t queue; FSEventStreamRef stream; - FilesByPath watchedFiles; - DirsByName watchedDirectories; - PathRefCounts watchedPaths; FSEventStreamEventId lastReceivedEvent; + WatchingState watchingState; }; QT_END_NAMESPACE |