Commit 73f0a1c9 authored by Zhuoyu Qian's avatar Zhuoyu Qian Committed by Commit Bot

Change SandboxFileSystemBackendDelegate members to use url::Origin.

This CL update the members visited_origins_ and sticky_dirty_origins_
of SandboxFileSystemBackendDelegate to use dedicated Origin type
instead of GURL.

Bug: 598424
Change-Id: I3416bca660885737cdaea93dd8fe223f3fe70f26
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2071168
Commit-Queue: Victor Costan <pwnall@chromium.org>
Reviewed-by: default avatarVictor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#744205}
parent e76a0ffd
...@@ -415,8 +415,7 @@ int64_t SandboxFileSystemBackendDelegate::GetOriginUsageOnFileTaskRunner( ...@@ -415,8 +415,7 @@ int64_t SandboxFileSystemBackendDelegate::GetOriginUsageOnFileTaskRunner(
// Don't use usage cache and return recalculated usage for sticky invalidated // Don't use usage cache and return recalculated usage for sticky invalidated
// origins. // origins.
if (base::Contains(sticky_dirty_origins_, if (base::Contains(sticky_dirty_origins_, std::make_pair(origin, type)))
std::make_pair(origin.GetURL(), type)))
return RecalculateUsage(file_system_context, origin, type); return RecalculateUsage(file_system_context, origin, type);
base::FilePath base_path = base::FilePath base_path =
...@@ -432,7 +431,7 @@ int64_t SandboxFileSystemBackendDelegate::GetOriginUsageOnFileTaskRunner( ...@@ -432,7 +431,7 @@ int64_t SandboxFileSystemBackendDelegate::GetOriginUsageOnFileTaskRunner(
uint32_t dirty_status = 0; uint32_t dirty_status = 0;
bool dirty_status_available = bool dirty_status_available =
usage_cache()->GetDirty(usage_file_path, &dirty_status); usage_cache()->GetDirty(usage_file_path, &dirty_status);
bool visited = !visited_origins_.insert(origin.GetURL()).second; bool visited = !visited_origins_.insert(origin).second;
if (is_valid && (dirty_status == 0 || (dirty_status_available && visited))) { if (is_valid && (dirty_status == 0 || (dirty_status_available && visited))) {
// The usage cache is clean (dirty == 0) or the origin is already // The usage cache is clean (dirty == 0) or the origin is already
// initialized and running. Read the cache file to get the usage. // initialized and running. Read the cache file to get the usage.
...@@ -535,7 +534,7 @@ void SandboxFileSystemBackendDelegate::InvalidateUsageCache( ...@@ -535,7 +534,7 @@ void SandboxFileSystemBackendDelegate::InvalidateUsageCache(
void SandboxFileSystemBackendDelegate::StickyInvalidateUsageCache( void SandboxFileSystemBackendDelegate::StickyInvalidateUsageCache(
const url::Origin& origin, const url::Origin& origin,
FileSystemType type) { FileSystemType type) {
sticky_dirty_origins_.insert(std::make_pair(origin.GetURL(), type)); sticky_dirty_origins_.insert(std::make_pair(origin, type));
quota_observer()->SetUsageCacheEnabled(origin, type, false); quota_observer()->SetUsageCacheEnabled(origin, type, false);
InvalidateUsageCache(origin, type); InvalidateUsageCache(origin, type);
} }
......
...@@ -251,9 +251,9 @@ class COMPONENT_EXPORT(STORAGE_BROWSER) SandboxFileSystemBackendDelegate ...@@ -251,9 +251,9 @@ class COMPONENT_EXPORT(STORAGE_BROWSER) SandboxFileSystemBackendDelegate
THREAD_CHECKER(io_thread_checker_); THREAD_CHECKER(io_thread_checker_);
// Accessed only on the file thread. // Accessed only on the file thread.
std::set<GURL> visited_origins_; std::set<url::Origin> visited_origins_;
std::set<std::pair<GURL, FileSystemType>> sticky_dirty_origins_; std::set<std::pair<url::Origin, FileSystemType>> sticky_dirty_origins_;
std::map<FileSystemType, UpdateObserverList> update_observers_; std::map<FileSystemType, UpdateObserverList> update_observers_;
std::map<FileSystemType, ChangeObserverList> change_observers_; std::map<FileSystemType, ChangeObserverList> change_observers_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment