Commit 92581e47 authored by dschuyler's avatar dschuyler Committed by Commit bot

Revert of Use TaskScheduler instead of WorkerPool in cache_util.cc. (patchset...

Revert of Use TaskScheduler instead of WorkerPool in cache_util.cc. (patchset #3 id:40001 of https://codereview.chromium.org/2610503002/ )

Reason for revert:
It looks like this CL may be related to a unit test failure on this build:
https://build.chromium.org/p/chromium.win/builders/Win10%20Tests%20x64/builds/7492
- Sheriff

Original issue's description:
> Use TaskScheduler instead of WorkerPool in cache_util.cc.
>
> The following traits are used:
>
> Priority: BACKGROUND
>   User won't notice if this task takes an arbitrarily long time
>   to complete.
>
> Shutdown behavior: CONTINUE_ON_SHUTDOWN
>   Tasks posted with this mode which have not started executing before
>   shutdown is initiated will never run. Tasks with this mode running at
>   shutdown will be ignored (the worker will not be joined).
>
>   Note: Tasks that were previously posted to base::WorkerPool should
>   use this shutdown behavior because this is how base::WorkerPool
>   handles all its tasks.
>
> May Block:
>   Tasks posted with MayBlock() may block. This includes but is not
>   limited to tasks that wait on synchronous file I/O operations:
>   read or write a file from disk, interact with a pipe or a socket,
>   rename or delete a file, enumerate files in a directory, etc. This
>   trait isn't required for the mere use of locks.
>
> BUG=659191
>
> Review-Url: https://codereview.chromium.org/2610503002
> Cr-Commit-Position: refs/heads/master@{#442985}
> Committed: https://chromium.googlesource.com/chromium/src/+/8d1a5a1e352ee6b2aee40b42d9fdc4b6e0c97fed

TBR=gavinp@chromium.org,fdoray@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=659191

Review-Url: https://codereview.chromium.org/2626163002
Cr-Commit-Position: refs/heads/master@{#443009}
parent 273c31e1
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/test/mock_entropy_provider.h" #include "base/test/mock_entropy_provider.h"
#include "base/test/scoped_task_scheduler.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h" #include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "base/threading/platform_thread.h" #include "base/threading/platform_thread.h"
#include "base/threading/thread_restrictions.h" #include "base/threading/thread_restrictions.h"
...@@ -83,9 +82,6 @@ std::unique_ptr<disk_cache::BackendImpl> CreateExistingEntryCache( ...@@ -83,9 +82,6 @@ std::unique_ptr<disk_cache::BackendImpl> CreateExistingEntryCache(
// Tests that can run with different types of caches. // Tests that can run with different types of caches.
class DiskCacheBackendTest : public DiskCacheTestWithCache { class DiskCacheBackendTest : public DiskCacheTestWithCache {
protected: protected:
DiskCacheBackendTest()
: scoped_task_scheduler_(base::MessageLoop::current()) {}
// Some utility methods: // Some utility methods:
// Perform IO operations on the cache until there is pending IO. // Perform IO operations on the cache until there is pending IO.
...@@ -153,9 +149,6 @@ class DiskCacheBackendTest : public DiskCacheTestWithCache { ...@@ -153,9 +149,6 @@ class DiskCacheBackendTest : public DiskCacheTestWithCache {
void BackendDisabledAPI(); void BackendDisabledAPI();
void BackendEviction(); void BackendEviction();
private:
base::test::ScopedTaskScheduler scoped_task_scheduler_;
}; };
int DiskCacheBackendTest::GeneratePendingIO(net::TestCompletionCallback* cb) { int DiskCacheBackendTest::GeneratePendingIO(net::TestCompletionCallback* cb) {
...@@ -2054,8 +2047,6 @@ TEST_F(DiskCacheTest, WrongVersion) { ...@@ -2054,8 +2047,6 @@ TEST_F(DiskCacheTest, WrongVersion) {
// blockfile caches. // blockfile caches.
#if !defined(OS_ANDROID) #if !defined(OS_ANDROID)
TEST_F(DiskCacheTest, SimpleCacheControlJoin) { TEST_F(DiskCacheTest, SimpleCacheControlJoin) {
base::test::ScopedTaskScheduler scoped_task_scheduler(
base::MessageLoop::current());
base::Thread cache_thread("CacheThread"); base::Thread cache_thread("CacheThread");
ASSERT_TRUE(cache_thread.StartWithOptions( ASSERT_TRUE(cache_thread.StartWithOptions(
base::Thread::Options(base::MessageLoop::TYPE_IO, 0))); base::Thread::Options(base::MessageLoop::TYPE_IO, 0)));
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/task_scheduler/post_task.h"
#include "base/threading/thread_restrictions.h" #include "base/threading/thread_restrictions.h"
#include "base/threading/worker_pool.h"
namespace { namespace {
...@@ -136,13 +136,8 @@ bool DelayedCacheCleanup(const base::FilePath& full_path) { ...@@ -136,13 +136,8 @@ bool DelayedCacheCleanup(const base::FilePath& full_path) {
return false; return false;
} }
base::PostTaskWithTraits( base::WorkerPool::PostTask(
FROM_HERE, base::TaskTraits() FROM_HERE, base::Bind(&CleanupCallback, path, name_str), true);
.WithShutdownBehavior(
base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)
.WithPriority(base::TaskPriority::BACKGROUND)
.MayBlock(),
base::Bind(&CleanupCallback, path, name_str));
return true; return true;
} }
......
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