Mercurial > hg > orthanc-stone
changeset 930:bf03cb879eb4
Fixed LoaderCache
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Wed, 24 Jul 2019 18:45:33 +0200 |
parents | 408bcc6c1505 |
children | fc38c4ab17e3 |
files | Framework/Loaders/LoaderCache.cpp Framework/Loaders/LoaderCache.h |
diffstat | 2 files changed, 24 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/Loaders/LoaderCache.cpp Wed Jul 24 14:27:06 2019 +0200 +++ b/Framework/Loaders/LoaderCache.cpp Wed Jul 24 18:45:33 2019 +0200 @@ -24,6 +24,13 @@ #include "OrthancMultiframeVolumeLoader.h" #include "DicomStructureSetLoader.h" +#if ORTHANC_ENABLE_WASM == 1 +# include <unistd.h> +# include "../Oracle/WebAssemblyOracle.h" +#else +# include "../Oracle/ThreadedOracle.h" +#endif + #include "../Messages/LockingEmitter.h" #include "../Volumes/DicomVolumeImage.h" #include "../Volumes/DicomVolumeImageMPRSlicer.h" @@ -34,13 +41,13 @@ namespace OrthancStone { #if ORTHANC_ENABLE_WASM == 1 - LoaderCache::LoaderCache(IOracle& oracle) + LoaderCache::LoaderCache(WebAssemblyOracle& oracle) : oracle_(oracle) { } #else - LoaderCache::LoaderCache(IOracle& oracle, LockingEmitter& lockingEmitter) + LoaderCache::LoaderCache(ThreadedOracle& oracle, LockingEmitter& lockingEmitter) : oracle_(oracle) , lockingEmitter_(lockingEmitter) { @@ -59,12 +66,17 @@ // find in cache if (seriesVolumeProgressiveLoaders_.find(seriesUuid) == seriesVolumeProgressiveLoaders_.end()) { +#if ORTHANC_ENABLE_WASM == 1 + LOG(WARNING) << "Performing request for series " << seriesUuid << " sbrk(0) = " << sbrk(0); +#else + LOG(WARNING) << "Performing request for series " << seriesUuid; +#endif boost::shared_ptr<DicomVolumeImage> volumeImage(new DicomVolumeImage); boost::shared_ptr<OrthancSeriesVolumeProgressiveLoader> loader; { #if ORTHANC_ENABLE_WASM == 1 - loader.reset(new OrthancSeriesVolumeProgressiveLoader(volumeImage, GetParent()->GetOracleRef(), GetParent()->GetOracleRef())); + loader.reset(new OrthancSeriesVolumeProgressiveLoader(volumeImage, oracle_, oracle_)); #else LockingEmitter::WriterLock lock(lockingEmitter_); loader.reset(new OrthancSeriesVolumeProgressiveLoader(volumeImage, oracle_, lock.GetOracleObservable())); @@ -115,7 +127,7 @@ { #if ORTHANC_ENABLE_WASM == 1 - loader.reset(new OrthancMultiframeVolumeLoader(volumeImage, GetParent()->GetOracleRef(), GetParent()->GetOracleRef())); + loader.reset(new OrthancMultiframeVolumeLoader(volumeImage, oracle_, oracle_)); #else LockingEmitter::WriterLock lock(lockingEmitter_); loader.reset(new OrthancMultiframeVolumeLoader(volumeImage, oracle_, lock.GetOracleObservable())); @@ -167,7 +179,7 @@ { #if ORTHANC_ENABLE_WASM == 1 - loader.reset(new DicomStructureSetLoader(volumeImage, GetParent()->GetOracleRef(), GetParent()->GetOracleRef())); + loader.reset(new DicomStructureSetLoader(oracle_, oracle_)); #else LockingEmitter::WriterLock lock(lockingEmitter_); loader.reset(new DicomStructureSetLoader(oracle_, lock.GetOracleObservable()));
--- a/Framework/Loaders/LoaderCache.h Wed Jul 24 14:27:06 2019 +0200 +++ b/Framework/Loaders/LoaderCache.h Wed Jul 24 18:45:33 2019 +0200 @@ -31,12 +31,11 @@ class DicomVolumeImageMPRSlicer; class DicomStructureSetLoader; class OrthancMultiframeVolumeLoader; - class IOracle; #if ORTHANC_ENABLE_WASM == 1 - //class WebAssemblyOracle; + class WebAssemblyOracle; #else - //class ThreadedOracle; + class ThreadedOracle; class LockingEmitter; #endif @@ -44,9 +43,9 @@ { public: #if ORTHANC_ENABLE_WASM == 1 - LoaderCache(IOracle& oracle); + LoaderCache(WebAssemblyOracle& oracle); #else - LoaderCache(IOracle& oracle, LockingEmitter& lockingEmitter); + LoaderCache(ThreadedOracle& oracle, LockingEmitter& lockingEmitter); #endif boost::shared_ptr<OrthancSeriesVolumeProgressiveLoader> @@ -59,11 +58,11 @@ void ClearCache(); private: - IOracle& oracle_; + #if ORTHANC_ENABLE_WASM == 1 - //WebAssemblyOracle& oracle_; + WebAssemblyOracle& oracle_; #else - //ThreadedOracle& oracle_; + ThreadedOracle& oracle_; LockingEmitter& lockingEmitter_; #endif