captive_shared_cache_map_object_FileSizes_changed(): Improved performance.
[captive.git] / src / libcaptive / cc / sharedcachemap-priv.h
index 1b353e8..af2fcac 100644 (file)
@@ -54,11 +54,17 @@ struct _CaptiveSharedCacheMapObject {
         * as the offsets are usually PAGE_SIZE aligned due to pin-Bcb expectations.
         */
        guint64 FileSize;       /* ==CC_FILE_SIZES.FileSize.QuadPart */
-       /* We use 'FileSize' instead of 'ValidDataLength' as I assume W32
+       /* We use do not use 'ValidDataLength' as I assume W32
         * automatically increases 'ValidDataLength' during Cache Manager write operations.
         * We do not increase it and therefore it is mostly useless for us.
         */
        guint64 ValidDataLength;        /* ==CC_FILE_SIZES.ValidDataLength.QuadPart */
+       /* The real allocation size of 'buffer' and 'pages'.
+        * Maintained by captive_shared_cache_map_object_FileSizes_changed()
+        * to prevent continous reallocation to (n+1) size.
+        * We use (n*2) sizes for logaritmic time complexity.
+        */
+       guint64 alloc_length;
        CACHE_MANAGER_CALLBACKS CallBacks;
        VOID *LazyWriterContext;
        gboolean PinAccess;