summaryrefslogtreecommitdiff
path: root/chromium/content/browser/browsing_data
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/content/browser/browsing_data')
-rw-r--r--chromium/content/browser/browsing_data/conditional_cache_deletion_helper.cc5
-rw-r--r--chromium/content/browser/browsing_data/conditional_cache_deletion_helper.h4
-rw-r--r--chromium/content/browser/browsing_data/storage_partition_code_cache_data_remover.cc19
-rw-r--r--chromium/content/browser/browsing_data/storage_partition_code_cache_data_remover.h13
4 files changed, 10 insertions, 31 deletions
diff --git a/chromium/content/browser/browsing_data/conditional_cache_deletion_helper.cc b/chromium/content/browser/browsing_data/conditional_cache_deletion_helper.cc
index c74b8e14907..57763205a09 100644
--- a/chromium/content/browser/browsing_data/conditional_cache_deletion_helper.cc
+++ b/chromium/content/browser/browsing_data/conditional_cache_deletion_helper.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/location.h"
+#include "base/sequence_checker.h"
#include "base/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "content/public/browser/browser_thread.h"
@@ -38,7 +39,6 @@ ConditionalCacheDeletionHelper::ConditionalCacheDeletionHelper(
condition_(std::move(condition)),
current_entry_(nullptr),
previous_entry_(nullptr) {
- DCHECK_CURRENTLY_ON(BrowserThread::IO);
}
// static
@@ -70,7 +70,7 @@ ConditionalCacheDeletionHelper::CreateCustomKeyURLAndTimeCondition(
int ConditionalCacheDeletionHelper::DeleteAndDestroySelfWhenFinished(
net::CompletionOnceCallback completion_callback) {
- DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
completion_callback_ = std::move(completion_callback);
iterator_ = cache_->CreateIterator();
@@ -82,6 +82,7 @@ int ConditionalCacheDeletionHelper::DeleteAndDestroySelfWhenFinished(
ConditionalCacheDeletionHelper::~ConditionalCacheDeletionHelper() {}
void ConditionalCacheDeletionHelper::IterateOverEntries(int error) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
while (error != net::ERR_IO_PENDING) {
// If the entry obtained in the previous iteration matches the condition,
// mark it for deletion. The iterator is already one step forward, so it
diff --git a/chromium/content/browser/browsing_data/conditional_cache_deletion_helper.h b/chromium/content/browser/browsing_data/conditional_cache_deletion_helper.h
index 64fe71514f7..b98c3c2bc5e 100644
--- a/chromium/content/browser/browsing_data/conditional_cache_deletion_helper.h
+++ b/chromium/content/browser/browsing_data/conditional_cache_deletion_helper.h
@@ -25,7 +25,6 @@ namespace content {
class CONTENT_EXPORT ConditionalCacheDeletionHelper {
public:
// Creates a helper to delete |cache| entries that match the |condition|.
- // Must be created on the IO thread!
ConditionalCacheDeletionHelper(
disk_cache::Backend* cache,
base::RepeatingCallback<bool(const disk_cache::Entry*)> condition);
@@ -56,7 +55,6 @@ class CONTENT_EXPORT ConditionalCacheDeletionHelper {
// Deletes the cache entries according to the specified condition. Destroys
// this instance of ConditionalCacheDeletionHelper when finished.
- // Must be called on the IO thread!
//
// The return value is a net error code. If this method returns
// ERR_IO_PENDING, the |completion_callback| will be invoked when the
@@ -75,6 +73,8 @@ class CONTENT_EXPORT ConditionalCacheDeletionHelper {
net::CompletionOnceCallback completion_callback_;
+ SEQUENCE_CHECKER(sequence_checker_);
+
std::unique_ptr<disk_cache::Backend::Iterator> iterator_;
disk_cache::Entry* current_entry_;
disk_cache::Entry* previous_entry_;
diff --git a/chromium/content/browser/browsing_data/storage_partition_code_cache_data_remover.cc b/chromium/content/browser/browsing_data/storage_partition_code_cache_data_remover.cc
index 973f8c1d7ab..df92e53f08f 100644
--- a/chromium/content/browser/browsing_data/storage_partition_code_cache_data_remover.cc
+++ b/chromium/content/browser/browsing_data/storage_partition_code_cache_data_remover.cc
@@ -55,16 +55,7 @@ void StoragePartitionCodeCacheDataRemover::Remove(
<< __func__ << " called with a null callback";
done_callback_ = std::move(done_callback);
- base::PostTaskWithTraits(
- FROM_HERE, {BrowserThread::IO},
- base::BindOnce(&StoragePartitionCodeCacheDataRemover::ClearJSCodeCache,
- base::Unretained(this)));
-}
-
-void StoragePartitionCodeCacheDataRemover::ClearedCodeCache() {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
- std::move(done_callback_).Run();
- base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
+ ClearJSCodeCache();
}
void StoragePartitionCodeCacheDataRemover::ClearCache(
@@ -140,11 +131,9 @@ void StoragePartitionCodeCacheDataRemover::ClearWASMCodeCache(int rv) {
// |rv| is the returned when clearing the code cache. We don't handle
// any errors here, so the result value is ignored.
void StoragePartitionCodeCacheDataRemover::DoneClearCodeCache(int rv) {
- // Notify the UI thread that we are done.
- base::PostTaskWithTraits(
- FROM_HERE, {BrowserThread::UI},
- base::BindOnce(&StoragePartitionCodeCacheDataRemover::ClearedCodeCache,
- base::Unretained(this)));
+ // Notify that we are done.
+ std::move(done_callback_).Run();
+ base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
}
} // namespace content
diff --git a/chromium/content/browser/browsing_data/storage_partition_code_cache_data_remover.h b/chromium/content/browser/browsing_data/storage_partition_code_cache_data_remover.h
index 989b596631f..113d31d5e5a 100644
--- a/chromium/content/browser/browsing_data/storage_partition_code_cache_data_remover.h
+++ b/chromium/content/browser/browsing_data/storage_partition_code_cache_data_remover.h
@@ -23,14 +23,7 @@ class StoragePartition;
class GeneratedCodeCacheContext;
// Helper to remove code cache data from a StoragePartition. This class is
-// created on the UI thread and calls the provided callback and destroys itself
-// on the UI thread after the code caches are cleared. This class also takes a
-// reference to the generated_code_cache_context and is used in read-only mode
-// on both the UI / IO thread. Since this isn't modified, it is OK to access it
-// on both threads. The caches are actually cleared on the IO threads. When the
-// Remove function is called, it posts tasks on the IO thread to clear the code
-// caches. Once the the caches are cleared, the callback is called on the UI
-// thread.
+// created on and acts on the UI thread.
class StoragePartitionCodeCacheDataRemover {
public:
// Creates a StoragePartitionCodeCacheDataRemover that deletes all cache
@@ -64,10 +57,6 @@ class StoragePartitionCodeCacheDataRemover {
~StoragePartitionCodeCacheDataRemover();
- // Executed on UI thread.
- void ClearedCodeCache();
-
- // Executed on IO thread.
void ClearJSCodeCache();
void ClearWASMCodeCache(int rv);
void ClearCache(net::CompletionOnceCallback callback,