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(
// Don't use usage cache and return recalculated usage for sticky invalidated
// origins.
if (base::Contains(sticky_dirty_origins_,
std::make_pair(origin.GetURL(), type)))
if (base::Contains(sticky_dirty_origins_, std::make_pair(origin, type)))
return RecalculateUsage(file_system_context, origin, type);
base::FilePath base_path =
......@@ -432,7 +431,7 @@ int64_t SandboxFileSystemBackendDelegate::GetOriginUsageOnFileTaskRunner(
uint32_t dirty_status = 0;
bool dirty_status_available =
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))) {
// The usage cache is clean (dirty == 0) or the origin is already
// initialized and running. Read the cache file to get the usage.
......@@ -535,7 +534,7 @@ void SandboxFileSystemBackendDelegate::InvalidateUsageCache(
void SandboxFileSystemBackendDelegate::StickyInvalidateUsageCache(
const url::Origin& origin,
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);
InvalidateUsageCache(origin, type);
}
......
......@@ -251,9 +251,9 @@ class COMPONENT_EXPORT(STORAGE_BROWSER) SandboxFileSystemBackendDelegate
THREAD_CHECKER(io_thread_checker_);
// 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, 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