diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2018-10-26 08:16:54 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-10-26 08:16:54 -0400 |
| commit | cb9d679a3a93c65c44904bf77811b9d74e431e23 (patch) | |
| tree | bdc78bc01351f6eeed4714d01cd3aef6cf067109 /source/slang/default-file-system.h | |
| parent | ad47fe71defcc96a7bed87a4c3a40543978f0fb8 (diff) | |
Feature/file system cache (#692)
* First pass at caching file system.
* default-file-system -> slang-file-system
fix problem with location("build.linux") confusing windows build for now.
* Added CompressedResult
Fix problem in Result construction with it being unsigned
* Add support for Path simplification.
* Testing for Path::Simplify.
* Refactored CacheFileSystem - automatically handles ISlangFileSystem or ISlangFileSystemExt appropriately.
Removed WrapFileSystem - because wasn't possible to emulate some of the behavior if just loadFile is implemented.
Split out StringBlob - so that no need to convert between ISlangBlob and String repeatidly.
* Remove unwanted code in ~CompileRequest
Diffstat (limited to 'source/slang/default-file-system.h')
| -rw-r--r-- | source/slang/default-file-system.h | 104 |
1 files changed, 0 insertions, 104 deletions
diff --git a/source/slang/default-file-system.h b/source/slang/default-file-system.h deleted file mode 100644 index 7805dd81a..000000000 --- a/source/slang/default-file-system.h +++ /dev/null @@ -1,104 +0,0 @@ -#ifndef SLANG_DEFAULT_FILE_SYSTEM_H_INCLUDED -#define SLANG_DEFAULT_FILE_SYSTEM_H_INCLUDED - -#include "../../slang.h" -#include "../../slang-com-helper.h" -#include "../../slang-com-ptr.h" - -namespace Slang -{ - -class DefaultFileSystem : public ISlangFileSystemExt -{ -public: - // ISlangUnknown - // override ref counting, as DefaultFileSystem is singleton - SLANG_IUNKNOWN_QUERY_INTERFACE - SLANG_NO_THROW uint32_t SLANG_MCALL addRef() SLANG_OVERRIDE { return 1; } - SLANG_NO_THROW uint32_t SLANG_MCALL release() SLANG_OVERRIDE { return 1; } - - // ISlangFileSystem - virtual SLANG_NO_THROW SlangResult SLANG_MCALL loadFile( - char const* path, - ISlangBlob** outBlob) SLANG_OVERRIDE; - - // ISlangFileSystemExt - virtual SLANG_NO_THROW SlangResult SLANG_MCALL getCanoncialPath( - const char* path, - ISlangBlob** canonicalPathOut) SLANG_OVERRIDE; - - virtual SLANG_NO_THROW SlangResult SLANG_MCALL calcRelativePath( - SlangPathType fromPathType, - const char* fromPath, - const char* path, - ISlangBlob** pathOut) SLANG_OVERRIDE; - - virtual SLANG_NO_THROW SlangResult SLANG_MCALL getPathType( - const char* path, - SlangPathType* pathTypeOut) SLANG_OVERRIDE; - - /// Get a default instance - static ISlangFileSystemExt* getSingleton() { return &s_singleton; } - -private: - /// Make so not constructible - DefaultFileSystem() {} - virtual ~DefaultFileSystem() {} - - ISlangUnknown* getInterface(const Guid& guid); - - static DefaultFileSystem s_singleton; -}; - -/* Wraps an ISlangFileSystem, and provides the extra methods required to make a ISlangFileSystemExt -interface, deferring to the contained file system to do reading. - -NOTE! That this behavior is the same as previously in that.... -1) calcRelativePath, just returns the path as processed by the Path:: methods -2) getCanonicalPath, just returns the input path as the 'canonical' path. This will be wrong with a file multiply referenced through paths with .. and or . but -doing it this way means it works as before and requires no new functions. -*/ -class WrapFileSystem : public ISlangFileSystemExt -{ -public: - // ISlangUnknown - SLANG_IUNKNOWN_ALL - - // ISlangFileSystem - virtual SLANG_NO_THROW SlangResult SLANG_MCALL loadFile( - char const* path, - ISlangBlob** outBlob) SLANG_OVERRIDE; - - // ISlangFileSystemExt - virtual SLANG_NO_THROW SlangResult SLANG_MCALL getCanoncialPath( - const char* path, - ISlangBlob** canonicalPathOut) SLANG_OVERRIDE; - - virtual SLANG_NO_THROW SlangResult SLANG_MCALL calcRelativePath( - SlangPathType fromPathType, - const char* fromPath, - const char* path, - ISlangBlob** pathOut) SLANG_OVERRIDE; - - virtual SLANG_NO_THROW SlangResult SLANG_MCALL getPathType( - const char* path, - SlangPathType* pathTypeOut) SLANG_OVERRIDE; - - /// Ctor - WrapFileSystem(ISlangFileSystem* fileSystem): - m_fileSystem(fileSystem) - { - } - virtual ~WrapFileSystem() {} - - -protected: - ISlangUnknown* getInterface(const Guid& guid); - - ComPtr<ISlangFileSystem> m_fileSystem; ///< The wrapped file system - uint32_t m_refCount = 0; -}; - -} - -#endif
\ No newline at end of file |
