示例#1
0
        public void Dispose()
        {
            if (m_Disposed)
            {
                return;
            }

            m_VolatileStore = null;
            m_StoreData     = null;
            m_Disposed      = true;
        }
 public PropertyDatabaseView(PropertyDatabase propertyDatabase, PropertyDatabaseVolatileMemoryStore volatileMemoryStore, PropertyDatabaseMemoryStore memoryStore, PropertyDatabaseFileStore fileStore, PropertyStringTable stringTable, bool delayedSync)
 {
     m_PropertyDatabase        = propertyDatabase;
     m_MemoryStore             = memoryStore;
     m_FileStore               = fileStore;
     m_VolatileMemoryStoreView = (PropertyDatabaseVolatileMemoryStoreView)volatileMemoryStore.GetView();
     m_MemoryStoreView         = (PropertyDatabaseMemoryStoreView)memoryStore.GetView();
     m_FileStoreView           = (PropertyDatabaseFileStoreView)fileStore.GetView();
     m_StringTableView         = stringTable.GetView(delayedSync);
     m_Disposed    = false;
     m_DelayedSync = delayedSync;
 }
        public PropertyDatabase(string filePath, bool autoBackgroundUpdate, double backgroundUpdateDebounceInSeconds = k_DefaultBackgroundUpdateDebounceInSeconds)
        {
            this.filePath        = filePath;
            stringTableFilePath  = GetStringTablePath(filePath);
            m_LocalVolatileStore = new PropertyDatabaseVolatileMemoryStore();
            m_LocalStore         = new PropertyDatabaseMemoryStore();
            m_FileStore          = new PropertyDatabaseFileStore(filePath);
            m_StringTable        = new PropertyStringTable(stringTableFilePath, 30);

            // Do not allow automatic background updates while running tests. The writing of the file
            // causes an assembly leak during the test Unity.IntegrationTests.Scripting.AssemblyReloadTest.AssemblyReloadDoesntLeakAssemblies
            // on MacOs. I haven't found out why exactly does the writing of a file causes an assembly to be held, so instead I deactivate
            // the automatic update during tests.
            this.autoBackgroundUpdate = autoBackgroundUpdate && !Utils.IsRunningTests();

            m_Debounce = Delayer.Debounce(_ => TriggerPropertyDatabaseBackgroundUpdate(), backgroundUpdateDebounceInSeconds);
        }
示例#4
0
 public PropertyDatabaseVolatileMemoryStoreView(PropertyDatabaseVolatileMemoryStore volatileStore, List <PropertyDatabaseVolatileRecord> storeData)
 {
     m_VolatileStore = volatileStore;
     m_StoreData     = storeData;
     m_Disposed      = false;
 }