Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(623)

Unified Diff: content/browser/plugin_private_storage_helper.cc

Issue 2622403002: Clear data for origin if no files found (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/storage_partition_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/plugin_private_storage_helper.cc
diff --git a/content/browser/plugin_private_storage_helper.cc b/content/browser/plugin_private_storage_helper.cc
index 86278c0409ea125a5529b411140f7d3017e2c5c1..a84f6580daa4dc56a1bca862d8742ee1afe93e8c 100644
--- a/content/browser/plugin_private_storage_helper.cc
+++ b/content/browser/plugin_private_storage_helper.cc
@@ -112,6 +112,9 @@ class PluginPrivateDataByOriginChecker {
// Keep track if the data for this origin needs to be deleted due to
// any file found that has last modified time between |begin_| and |end_|.
bool delete_this_origin_data_ = false;
+
+ // Keep track if any files exist for this origin.
+ bool files_found_ = false;
};
void PluginPrivateDataByOriginChecker::CheckFilesOnIOThread() {
@@ -168,6 +171,10 @@ void PluginPrivateDataByOriginChecker::OnDirectoryRead(
return;
}
+ // If there are files found, keep track of it.
+ if (!file_list.empty())
+ files_found_ = true;
+
// No error, process the files returned. No need to do this if we have
// already decided to delete all the data for this origin.
if (!delete_this_origin_data_) {
@@ -228,6 +235,10 @@ void PluginPrivateDataByOriginChecker::DecrementTaskCount() {
if (task_count_)
return;
+ // If no files exist for this origin, then we can safely delete it.
+ if (!files_found_)
+ delete_this_origin_data_ = true;
+
// If there are no more tasks in progress, then run |callback_| on the
// proper thread.
filesystem_context_->default_file_task_runner()->PostTask(
« no previous file with comments | « no previous file | content/browser/storage_partition_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698