+static inline FetchOptions::Cache toFetchOptionsCache(ResourceRequestCachePolicy policy)
+{
+ // We are setting FetchOptions::Cache values to keep current behavior consistency.
+ // FIXME: We should merge FetchOptions::Cache with ResourceRequestCachePolicy and merge related class members.
+ switch (policy) {
+ case UseProtocolCachePolicy:
+ return FetchOptions::Cache::Default;
+ case ReloadIgnoringCacheData:
+ return FetchOptions::Cache::Reload;
+ case ReturnCacheDataElseLoad:
+ return FetchOptions::Cache::Default;
+ case ReturnCacheDataDontLoad:
+ return FetchOptions::Cache::Default;
+ case DoNotUseAnyCache:
+ return FetchOptions::Cache::NoStore;
+ case RefreshAnyCacheData:
+ return FetchOptions::Cache::NoCache;
+ }
+ return FetchOptions::Cache::Default;
+}
+