return flushed;
}
+static void captive_shared_cache_map_flush_all_foreach_flush(
+ CaptiveSharedCacheMapObject *captive_shared_cache_map_object, /* key */
+ CaptiveSharedCacheMapObject *captive_shared_cache_map_object_value, /* value */
+ gboolean user_data) /* unused */
+{
+ g_return_if_fail(CAPTIVE_SHARED_CACHE_MAP_IS_OBJECT(captive_shared_cache_map_object));
+ g_return_if_fail(captive_shared_cache_map_object==captive_shared_cache_map_object_value);
+
+ captive_shared_cache_map_flush(captive_shared_cache_map_object,0,G_MAXUINT64-1); /* '-1' for overflow safety */
+}
+
+static void captive_shared_cache_map_flush_all_foreach_check(
+ CaptiveSharedCacheMapObject *captive_shared_cache_map_object, /* key */
+ CaptiveSharedCacheMapObject *captive_shared_cache_map_object_value, /* value */
+ gboolean user_data) /* unused */
+{
+guint64 start,end;
+guint64 now;
+
+ g_return_if_fail(CAPTIVE_SHARED_CACHE_MAP_IS_OBJECT(captive_shared_cache_map_object));
+ g_return_if_fail(captive_shared_cache_map_object==captive_shared_cache_map_object_value);
+
+ start=0;
+ end=CAPTIVE_ROUND_UP64(captive_shared_cache_map_object->AllocationSize,PAGE_SIZE);
+
+ start=CAPTIVE_ROUND_DOWN64(start,PAGE_SIZE);
+ end=CAPTIVE_ROUND_UP64(end,PAGE_SIZE);
+
+ /* We were calling W32 code - recheck our task completion. */
+ for (now=start;now<end;now+=PAGE_SIZE) {
+CaptiveSharedCacheMapObject_page *page;
+
+ page=captive_shared_cache_map_object->pages+now/PAGE_SIZE;
+ if (!page->data_valid)
+ continue;
+ g_assert(!page->dirty);
+ }
+}
+
+void captive_shared_cache_map_flush_all(void)
+{
+ CaptiveSharedCacheMapObject_hash_init();
+ g_hash_table_foreach(
+ CaptiveSharedCacheMapObject_hash, /* hash_table */
+ (GHFunc)captive_shared_cache_map_flush_all_foreach_flush, /* func */
+ NULL); /* user_data; unused */
+ g_hash_table_foreach(
+ CaptiveSharedCacheMapObject_hash, /* hash_table */
+ (GHFunc)captive_shared_cache_map_flush_all_foreach_check, /* func */
+ NULL); /* user_data; unused */
+}
+
static void captive_shared_cache_map_is_any_dirty_foreach(
CaptiveSharedCacheMapObject *captive_shared_cache_map_object, /* key */
CaptiveSharedCacheMapObject *captive_shared_cache_map_object_value, /* value */