Commit eed66837 authored by Etienne Pierre-doray's avatar Etienne Pierre-doray Committed by Commit Bot

[ThreadPool]: Rename SequenceSortKey/TaskSourceSortKey.

Since it's used more generally for TaskSource. Coming CL will make use of
TaskSourceSortKey to schedule jobs more fairly.

Change-Id: I2084f56bf7082e39ed16a4afb19a9356f0390295
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2377995Reviewed-by: default avatarFrançois Doray <fdoray@chromium.org>
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#803730}
parent ec6c569f
...@@ -683,14 +683,14 @@ component("base") { ...@@ -683,14 +683,14 @@ component("base") {
"task/thread_pool/priority_queue.h", "task/thread_pool/priority_queue.h",
"task/thread_pool/sequence.cc", "task/thread_pool/sequence.cc",
"task/thread_pool/sequence.h", "task/thread_pool/sequence.h",
"task/thread_pool/sequence_sort_key.cc",
"task/thread_pool/sequence_sort_key.h",
"task/thread_pool/service_thread.cc", "task/thread_pool/service_thread.cc",
"task/thread_pool/service_thread.h", "task/thread_pool/service_thread.h",
"task/thread_pool/task.cc", "task/thread_pool/task.cc",
"task/thread_pool/task.h", "task/thread_pool/task.h",
"task/thread_pool/task_source.cc", "task/thread_pool/task_source.cc",
"task/thread_pool/task_source.h", "task/thread_pool/task_source.h",
"task/thread_pool/task_source_sort_key.cc",
"task/thread_pool/task_source_sort_key.h",
"task/thread_pool/task_tracker.cc", "task/thread_pool/task_tracker.cc",
"task/thread_pool/task_tracker.h", "task/thread_pool/task_tracker.h",
"task/thread_pool/thread_group.cc", "task/thread_pool/thread_group.cc",
...@@ -2859,9 +2859,9 @@ test("base_unittests") { ...@@ -2859,9 +2859,9 @@ test("base_unittests") {
"task/thread_pool/job_task_source_unittest.cc", "task/thread_pool/job_task_source_unittest.cc",
"task/thread_pool/pooled_single_thread_task_runner_manager_unittest.cc", "task/thread_pool/pooled_single_thread_task_runner_manager_unittest.cc",
"task/thread_pool/priority_queue_unittest.cc", "task/thread_pool/priority_queue_unittest.cc",
"task/thread_pool/sequence_sort_key_unittest.cc",
"task/thread_pool/sequence_unittest.cc", "task/thread_pool/sequence_unittest.cc",
"task/thread_pool/service_thread_unittest.cc", "task/thread_pool/service_thread_unittest.cc",
"task/thread_pool/task_source_sort_key_unittest.cc",
"task/thread_pool/task_tracker_unittest.cc", "task/thread_pool/task_tracker_unittest.cc",
"task/thread_pool/test_task_factory.cc", "task/thread_pool/test_task_factory.cc",
"task/thread_pool/test_task_factory.h", "task/thread_pool/test_task_factory.h",
......
...@@ -343,8 +343,8 @@ bool JobTaskSource::DidProcessTask(TaskSource::Transaction* /*transaction*/) { ...@@ -343,8 +343,8 @@ bool JobTaskSource::DidProcessTask(TaskSource::Transaction* /*transaction*/) {
GetMaxConcurrency(state_before_sub.worker_count() - 1); GetMaxConcurrency(state_before_sub.worker_count() - 1);
} }
SequenceSortKey JobTaskSource::GetSortKey() const { TaskSourceSortKey JobTaskSource::GetSortKey() const {
return SequenceSortKey(traits_.priority(), queue_time_); return TaskSourceSortKey(traits_.priority(), queue_time_);
} }
Task JobTaskSource::Clear(TaskSource::Transaction* transaction) { Task JobTaskSource::Clear(TaskSource::Transaction* transaction) {
......
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
#include "base/task/common/checked_lock.h" #include "base/task/common/checked_lock.h"
#include "base/task/post_job.h" #include "base/task/post_job.h"
#include "base/task/task_traits.h" #include "base/task/task_traits.h"
#include "base/task/thread_pool/sequence_sort_key.h"
#include "base/task/thread_pool/task.h" #include "base/task/thread_pool/task.h"
#include "base/task/thread_pool/task_source.h" #include "base/task/thread_pool/task_source.h"
#include "base/task/thread_pool/task_source_sort_key.h"
namespace base { namespace base {
namespace internal { namespace internal {
...@@ -182,7 +182,7 @@ class BASE_EXPORT JobTaskSource : public TaskSource { ...@@ -182,7 +182,7 @@ class BASE_EXPORT JobTaskSource : public TaskSource {
Task TakeTask(TaskSource::Transaction* transaction) override; Task TakeTask(TaskSource::Transaction* transaction) override;
Task Clear(TaskSource::Transaction* transaction) override; Task Clear(TaskSource::Transaction* transaction) override;
bool DidProcessTask(TaskSource::Transaction* transaction) override; bool DidProcessTask(TaskSource::Transaction* transaction) override;
SequenceSortKey GetSortKey() const override; TaskSourceSortKey GetSortKey() const override;
// Synchronizes access to workers state. // Synchronizes access to workers state.
mutable CheckedLock worker_lock_{UniversalSuccessor()}; mutable CheckedLock worker_lock_{UniversalSuccessor()};
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
namespace base { namespace base {
namespace internal { namespace internal {
// A class combining a TaskSource and the SequenceSortKey that determines its // A class combining a TaskSource and the TaskSourceSortKey that determines its
// position in a PriorityQueue. Instances are only mutable via // position in a PriorityQueue. Instances are only mutable via
// take_task_source() which can only be called once and renders its instance // take_task_source() which can only be called once and renders its instance
// invalid after the call. // invalid after the call.
...@@ -21,7 +21,7 @@ class PriorityQueue::TaskSourceAndSortKey { ...@@ -21,7 +21,7 @@ class PriorityQueue::TaskSourceAndSortKey {
public: public:
TaskSourceAndSortKey() = default; TaskSourceAndSortKey() = default;
TaskSourceAndSortKey(RegisteredTaskSource task_source, TaskSourceAndSortKey(RegisteredTaskSource task_source,
const SequenceSortKey& sort_key) const TaskSourceSortKey& sort_key)
: task_source_(std::move(task_source)), sort_key_(sort_key) { : task_source_(std::move(task_source)), sort_key_(sort_key) {
DCHECK(task_source_); DCHECK(task_source_);
} }
...@@ -73,11 +73,11 @@ class PriorityQueue::TaskSourceAndSortKey { ...@@ -73,11 +73,11 @@ class PriorityQueue::TaskSourceAndSortKey {
const RegisteredTaskSource& task_source() const { return task_source_; } const RegisteredTaskSource& task_source() const { return task_source_; }
RegisteredTaskSource& task_source() { return task_source_; } RegisteredTaskSource& task_source() { return task_source_; }
const SequenceSortKey& sort_key() const { return sort_key_; } const TaskSourceSortKey& sort_key() const { return sort_key_; }
private: private:
RegisteredTaskSource task_source_; RegisteredTaskSource task_source_;
SequenceSortKey sort_key_; TaskSourceSortKey sort_key_;
DISALLOW_COPY_AND_ASSIGN(TaskSourceAndSortKey); DISALLOW_COPY_AND_ASSIGN(TaskSourceAndSortKey);
}; };
...@@ -99,14 +99,15 @@ PriorityQueue& PriorityQueue::operator=(PriorityQueue&& other) = default; ...@@ -99,14 +99,15 @@ PriorityQueue& PriorityQueue::operator=(PriorityQueue&& other) = default;
void PriorityQueue::Push( void PriorityQueue::Push(
TransactionWithRegisteredTaskSource transaction_with_task_source) { TransactionWithRegisteredTaskSource transaction_with_task_source) {
auto sequence_sort_key = auto task_source_sort_key =
transaction_with_task_source.transaction.GetSortKey(); transaction_with_task_source.transaction.GetSortKey();
container_.insert(TaskSourceAndSortKey( container_.insert(
std::move(transaction_with_task_source.task_source), sequence_sort_key)); TaskSourceAndSortKey(std::move(transaction_with_task_source.task_source),
IncrementNumTaskSourcesForPriority(sequence_sort_key.priority()); task_source_sort_key));
IncrementNumTaskSourcesForPriority(task_source_sort_key.priority());
} }
const SequenceSortKey& PriorityQueue::PeekSortKey() const { const TaskSourceSortKey& PriorityQueue::PeekSortKey() const {
DCHECK(!IsEmpty()); DCHECK(!IsEmpty());
return container_.Min().sort_key(); return container_.Min().sort_key();
} }
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/task/common/checked_lock.h" #include "base/task/common/checked_lock.h"
#include "base/task/common/intrusive_heap.h" #include "base/task/common/intrusive_heap.h"
#include "base/task/thread_pool/sequence_sort_key.h"
#include "base/task/thread_pool/task_source.h" #include "base/task/thread_pool/task_source.h"
#include "base/task/thread_pool/task_source_sort_key.h"
namespace base { namespace base {
namespace internal { namespace internal {
...@@ -27,14 +27,14 @@ class BASE_EXPORT PriorityQueue { ...@@ -27,14 +27,14 @@ class BASE_EXPORT PriorityQueue {
PriorityQueue& operator=(PriorityQueue&& other); PriorityQueue& operator=(PriorityQueue&& other);
// Inserts |task_source| in the PriorityQueue with |sequence_sort_key|. // Inserts |task_source| in the PriorityQueue with |task_source_sort_key|.
void Push(TransactionWithRegisteredTaskSource transaction_with_task_source); void Push(TransactionWithRegisteredTaskSource transaction_with_task_source);
// Returns a reference to the SequenceSortKey representing the priority of // Returns a reference to the TaskSourceSortKey representing the priority of
// the highest pending task in this PriorityQueue. The reference becomes // the highest pending task in this PriorityQueue. The reference becomes
// invalid the next time that this PriorityQueue is modified. // invalid the next time that this PriorityQueue is modified.
// Cannot be called on an empty PriorityQueue. // Cannot be called on an empty PriorityQueue.
const SequenceSortKey& PeekSortKey() const; const TaskSourceSortKey& PeekSortKey() const;
// Returns a reference to the highest priority TaskSource in this // Returns a reference to the highest priority TaskSource in this
// PriorityQueue. Cannot be called on an empty PriorityQueue. The returned // PriorityQueue. Cannot be called on an empty PriorityQueue. The returned
...@@ -73,8 +73,8 @@ class BASE_EXPORT PriorityQueue { ...@@ -73,8 +73,8 @@ class BASE_EXPORT PriorityQueue {
void EnableFlushTaskSourcesOnDestroyForTesting(); void EnableFlushTaskSourcesOnDestroyForTesting();
private: private:
// A class combining a TaskSource and the SequenceSortKey that determines its // A class combining a TaskSource and the TaskSourceSortKey that determines
// position in a PriorityQueue. // its position in a PriorityQueue.
class TaskSourceAndSortKey; class TaskSourceAndSortKey;
using ContainerType = IntrusiveHeap<TaskSourceAndSortKey>; using ContainerType = IntrusiveHeap<TaskSourceAndSortKey>;
......
...@@ -59,19 +59,19 @@ class PriorityQueueWithSequencesTest : public testing::Test { ...@@ -59,19 +59,19 @@ class PriorityQueueWithSequencesTest : public testing::Test {
scoped_refptr<TaskSource> sequence_a = scoped_refptr<TaskSource> sequence_a =
MakeSequenceWithTraitsAndTask(TaskTraits(TaskPriority::USER_VISIBLE)); MakeSequenceWithTraitsAndTask(TaskTraits(TaskPriority::USER_VISIBLE));
SequenceSortKey sort_key_a = sequence_a->BeginTransaction().GetSortKey(); TaskSourceSortKey sort_key_a = sequence_a->BeginTransaction().GetSortKey();
scoped_refptr<TaskSource> sequence_b = scoped_refptr<TaskSource> sequence_b =
MakeSequenceWithTraitsAndTask(TaskTraits(TaskPriority::USER_BLOCKING)); MakeSequenceWithTraitsAndTask(TaskTraits(TaskPriority::USER_BLOCKING));
SequenceSortKey sort_key_b = sequence_b->BeginTransaction().GetSortKey(); TaskSourceSortKey sort_key_b = sequence_b->BeginTransaction().GetSortKey();
scoped_refptr<TaskSource> sequence_c = scoped_refptr<TaskSource> sequence_c =
MakeSequenceWithTraitsAndTask(TaskTraits(TaskPriority::USER_BLOCKING)); MakeSequenceWithTraitsAndTask(TaskTraits(TaskPriority::USER_BLOCKING));
SequenceSortKey sort_key_c = sequence_c->BeginTransaction().GetSortKey(); TaskSourceSortKey sort_key_c = sequence_c->BeginTransaction().GetSortKey();
scoped_refptr<TaskSource> sequence_d = scoped_refptr<TaskSource> sequence_d =
MakeSequenceWithTraitsAndTask(TaskTraits(TaskPriority::BEST_EFFORT)); MakeSequenceWithTraitsAndTask(TaskTraits(TaskPriority::BEST_EFFORT));
SequenceSortKey sort_key_d = sequence_d->BeginTransaction().GetSortKey(); TaskSourceSortKey sort_key_d = sequence_d->BeginTransaction().GetSortKey();
PriorityQueue pq; PriorityQueue pq;
}; };
......
...@@ -103,9 +103,9 @@ bool Sequence::DidProcessTask(TaskSource::Transaction* transaction) { ...@@ -103,9 +103,9 @@ bool Sequence::DidProcessTask(TaskSource::Transaction* transaction) {
return true; return true;
} }
SequenceSortKey Sequence::GetSortKey() const { TaskSourceSortKey Sequence::GetSortKey() const {
DCHECK(!queue_.empty()); DCHECK(!queue_.empty());
return SequenceSortKey(traits_.priority(), queue_.front().queue_time); return TaskSourceSortKey(traits_.priority(), queue_.front().queue_time);
} }
Task Sequence::Clear(TaskSource::Transaction* transaction) { Task Sequence::Clear(TaskSource::Transaction* transaction) {
......
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
#include "base/sequence_token.h" #include "base/sequence_token.h"
#include "base/task/task_traits.h" #include "base/task/task_traits.h"
#include "base/task/thread_pool/pooled_parallel_task_runner.h" #include "base/task/thread_pool/pooled_parallel_task_runner.h"
#include "base/task/thread_pool/sequence_sort_key.h"
#include "base/task/thread_pool/task.h" #include "base/task/thread_pool/task.h"
#include "base/task/thread_pool/task_source.h" #include "base/task/thread_pool/task_source.h"
#include "base/task/thread_pool/task_source_sort_key.h"
#include "base/threading/sequence_local_storage_map.h" #include "base/threading/sequence_local_storage_map.h"
namespace base { namespace base {
...@@ -102,7 +102,7 @@ class BASE_EXPORT Sequence : public TaskSource { ...@@ -102,7 +102,7 @@ class BASE_EXPORT Sequence : public TaskSource {
Task TakeTask(TaskSource::Transaction* transaction) override; Task TakeTask(TaskSource::Transaction* transaction) override;
Task Clear(TaskSource::Transaction* transaction) override; Task Clear(TaskSource::Transaction* transaction) override;
bool DidProcessTask(TaskSource::Transaction* transaction) override; bool DidProcessTask(TaskSource::Transaction* transaction) override;
SequenceSortKey GetSortKey() const override; TaskSourceSortKey GetSortKey() const override;
// Releases reference to TaskRunner. // Releases reference to TaskRunner.
void ReleaseTaskRunner(); void ReleaseTaskRunner();
......
...@@ -127,7 +127,7 @@ TEST(ThreadPoolSequenceTest, GetSortKeyBestEffort) { ...@@ -127,7 +127,7 @@ TEST(ThreadPoolSequenceTest, GetSortKeyBestEffort) {
best_effort_sequence_transaction.PushTask(std::move(best_effort_task)); best_effort_sequence_transaction.PushTask(std::move(best_effort_task));
// Get the sort key. // Get the sort key.
const SequenceSortKey best_effort_sort_key = const TaskSourceSortKey best_effort_sort_key =
best_effort_sequence_transaction.GetSortKey(); best_effort_sequence_transaction.GetSortKey();
// Take the task from the sequence, so that its sequenced time is available // Take the task from the sequence, so that its sequenced time is available
...@@ -161,7 +161,7 @@ TEST(ThreadPoolSequenceTest, GetSortKeyForeground) { ...@@ -161,7 +161,7 @@ TEST(ThreadPoolSequenceTest, GetSortKeyForeground) {
foreground_sequence_transaction.PushTask(std::move(foreground_task)); foreground_sequence_transaction.PushTask(std::move(foreground_task));
// Get the sort key. // Get the sort key.
const SequenceSortKey foreground_sort_key = const TaskSourceSortKey foreground_sort_key =
foreground_sequence_transaction.GetSortKey(); foreground_sequence_transaction.GetSortKey();
// Take the task from the sequence, so that its sequenced time is available // Take the task from the sequence, so that its sequenced time is available
......
...@@ -32,7 +32,7 @@ TaskSource::Transaction::~Transaction() { ...@@ -32,7 +32,7 @@ TaskSource::Transaction::~Transaction() {
} }
} }
SequenceSortKey TaskSource::Transaction::GetSortKey() const { TaskSourceSortKey TaskSource::Transaction::GetSortKey() const {
return task_source_->GetSortKey(); return task_source_->GetSortKey();
} }
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
#include "base/task/common/checked_lock.h" #include "base/task/common/checked_lock.h"
#include "base/task/common/intrusive_heap.h" #include "base/task/common/intrusive_heap.h"
#include "base/task/task_traits.h" #include "base/task/task_traits.h"
#include "base/task/thread_pool/sequence_sort_key.h"
#include "base/task/thread_pool/task.h" #include "base/task/thread_pool/task.h"
#include "base/task/thread_pool/task_source_sort_key.h"
#include "base/threading/sequence_local_storage_map.h" #include "base/threading/sequence_local_storage_map.h"
namespace base { namespace base {
...@@ -105,9 +105,9 @@ class BASE_EXPORT TaskSource : public RefCountedThreadSafe<TaskSource> { ...@@ -105,9 +105,9 @@ class BASE_EXPORT TaskSource : public RefCountedThreadSafe<TaskSource> {
operator bool() const { return !!task_source_; } operator bool() const { return !!task_source_; }
// Returns a SequenceSortKey representing the priority of the TaskSource. // Returns a TaskSourceSortKey representing the priority of the TaskSource.
// Cannot be called on an empty TaskSource. // Cannot be called on an empty TaskSource.
SequenceSortKey GetSortKey() const; TaskSourceSortKey GetSortKey() const;
// Sets TaskSource priority to |priority|. // Sets TaskSource priority to |priority|.
void UpdatePriority(TaskPriority priority); void UpdatePriority(TaskPriority priority);
...@@ -193,7 +193,7 @@ class BASE_EXPORT TaskSource : public RefCountedThreadSafe<TaskSource> { ...@@ -193,7 +193,7 @@ class BASE_EXPORT TaskSource : public RefCountedThreadSafe<TaskSource> {
// are concurrently ready. // are concurrently ready.
virtual Task Clear(TaskSource::Transaction* transaction) = 0; virtual Task Clear(TaskSource::Transaction* transaction) = 0;
virtual SequenceSortKey GetSortKey() const = 0; virtual TaskSourceSortKey GetSortKey() const = 0;
// Sets TaskSource priority to |priority|. // Sets TaskSource priority to |priority|.
void UpdatePriority(TaskPriority priority); void UpdatePriority(TaskPriority priority);
......
...@@ -2,19 +2,19 @@ ...@@ -2,19 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "base/task/thread_pool/sequence_sort_key.h" #include "base/task/thread_pool/task_source_sort_key.h"
namespace base { namespace base {
namespace internal { namespace internal {
SequenceSortKey::SequenceSortKey(TaskPriority priority, TaskSourceSortKey::TaskSourceSortKey(TaskPriority priority,
TimeTicks next_task_sequenced_time) TimeTicks next_task_sequenced_time)
: priority_(priority), : priority_(priority),
next_task_sequenced_time_(next_task_sequenced_time) {} next_task_sequenced_time_(next_task_sequenced_time) {}
bool SequenceSortKey::operator<=(const SequenceSortKey& other) const { bool TaskSourceSortKey::operator<=(const TaskSourceSortKey& other) const {
// This SequenceSortKey is considered more important than |other| if it has a // This TaskSourceSortKey is considered more important than |other| if it has
// higher priority or if it has the same priority but its next task was // a higher priority or if it has the same priority but its next task was
// posted sooner than |other|'s. // posted sooner than |other|'s.
const int priority_diff = const int priority_diff =
static_cast<int>(priority_) - static_cast<int>(other.priority_); static_cast<int>(priority_) - static_cast<int>(other.priority_);
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef BASE_TASK_THREAD_POOL_SEQUENCE_SORT_KEY_H_ #ifndef BASE_TASK_THREAD_POOL_TASK_SOURCE_SORT_KEY_H_
#define BASE_TASK_THREAD_POOL_SEQUENCE_SORT_KEY_H_ #define BASE_TASK_THREAD_POOL_TASK_SOURCE_SORT_KEY_H_
#include "base/base_export.h" #include "base/base_export.h"
#include "base/task/task_traits.h" #include "base/task/task_traits.h"
...@@ -13,10 +13,10 @@ namespace base { ...@@ -13,10 +13,10 @@ namespace base {
namespace internal { namespace internal {
// An immutable but assignable representation of the priority of a Sequence. // An immutable but assignable representation of the priority of a Sequence.
class BASE_EXPORT SequenceSortKey final { class BASE_EXPORT TaskSourceSortKey final {
public: public:
SequenceSortKey() = default; TaskSourceSortKey() = default;
SequenceSortKey(TaskPriority priority, TimeTicks next_task_sequenced_time); TaskSourceSortKey(TaskPriority priority, TimeTicks next_task_sequenced_time);
TaskPriority priority() const { return priority_; } TaskPriority priority() const { return priority_; }
TimeTicks next_task_sequenced_time() const { TimeTicks next_task_sequenced_time() const {
...@@ -24,13 +24,13 @@ class BASE_EXPORT SequenceSortKey final { ...@@ -24,13 +24,13 @@ class BASE_EXPORT SequenceSortKey final {
} }
// Lower sort key means more important. // Lower sort key means more important.
bool operator<=(const SequenceSortKey& other) const; bool operator<=(const TaskSourceSortKey& other) const;
bool operator==(const SequenceSortKey& other) const { bool operator==(const TaskSourceSortKey& other) const {
return priority_ == other.priority_ && return priority_ == other.priority_ &&
next_task_sequenced_time_ == other.next_task_sequenced_time_; next_task_sequenced_time_ == other.next_task_sequenced_time_;
} }
bool operator!=(const SequenceSortKey& other) const { bool operator!=(const TaskSourceSortKey& other) const {
return !(other == *this); return !(other == *this);
} }
...@@ -50,4 +50,4 @@ class BASE_EXPORT SequenceSortKey final { ...@@ -50,4 +50,4 @@ class BASE_EXPORT SequenceSortKey final {
} // namespace internal } // namespace internal
} // namespace base } // namespace base
#endif // BASE_TASK_THREAD_POOL_SEQUENCE_SORT_KEY_H_ #endif // BASE_TASK_THREAD_POOL_TASK_SOURCE_SORT_KEY_H_
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "base/task/thread_pool/sequence_sort_key.h" #include "base/task/thread_pool/task_source_sort_key.h"
#include "base/task/task_traits.h" #include "base/task/task_traits.h"
#include "base/time/time.h" #include "base/time/time.h"
...@@ -11,18 +11,18 @@ ...@@ -11,18 +11,18 @@
namespace base { namespace base {
namespace internal { namespace internal {
TEST(SequenceSortKeyTest, OperatorLessThanOrEqual) { TEST(TaskSourceSortKeyTest, OperatorLessThanOrEqual) {
SequenceSortKey key_a(TaskPriority::USER_BLOCKING, TaskSourceSortKey key_a(TaskPriority::USER_BLOCKING,
TimeTicks::FromInternalValue(1000)); TimeTicks::FromInternalValue(1000));
SequenceSortKey key_b(TaskPriority::USER_BLOCKING, TaskSourceSortKey key_b(TaskPriority::USER_BLOCKING,
TimeTicks::FromInternalValue(2000)); TimeTicks::FromInternalValue(2000));
SequenceSortKey key_c(TaskPriority::USER_VISIBLE, TaskSourceSortKey key_c(TaskPriority::USER_VISIBLE,
TimeTicks::FromInternalValue(1000)); TimeTicks::FromInternalValue(1000));
SequenceSortKey key_d(TaskPriority::USER_VISIBLE, TaskSourceSortKey key_d(TaskPriority::USER_VISIBLE,
TimeTicks::FromInternalValue(2000)); TimeTicks::FromInternalValue(2000));
SequenceSortKey key_e(TaskPriority::BEST_EFFORT, TaskSourceSortKey key_e(TaskPriority::BEST_EFFORT,
TimeTicks::FromInternalValue(1000)); TimeTicks::FromInternalValue(1000));
SequenceSortKey key_f(TaskPriority::BEST_EFFORT, TaskSourceSortKey key_f(TaskPriority::BEST_EFFORT,
TimeTicks::FromInternalValue(2000)); TimeTicks::FromInternalValue(2000));
EXPECT_LE(key_a, key_a); EXPECT_LE(key_a, key_a);
...@@ -68,18 +68,18 @@ TEST(SequenceSortKeyTest, OperatorLessThanOrEqual) { ...@@ -68,18 +68,18 @@ TEST(SequenceSortKeyTest, OperatorLessThanOrEqual) {
EXPECT_LE(key_f, key_f); EXPECT_LE(key_f, key_f);
} }
TEST(SequenceSortKeyTest, OperatorEqual) { TEST(TaskSourceSortKeyTest, OperatorEqual) {
SequenceSortKey key_a(TaskPriority::USER_BLOCKING, TaskSourceSortKey key_a(TaskPriority::USER_BLOCKING,
TimeTicks::FromInternalValue(1000)); TimeTicks::FromInternalValue(1000));
SequenceSortKey key_b(TaskPriority::USER_BLOCKING, TaskSourceSortKey key_b(TaskPriority::USER_BLOCKING,
TimeTicks::FromInternalValue(2000)); TimeTicks::FromInternalValue(2000));
SequenceSortKey key_c(TaskPriority::USER_VISIBLE, TaskSourceSortKey key_c(TaskPriority::USER_VISIBLE,
TimeTicks::FromInternalValue(1000)); TimeTicks::FromInternalValue(1000));
SequenceSortKey key_d(TaskPriority::USER_VISIBLE, TaskSourceSortKey key_d(TaskPriority::USER_VISIBLE,
TimeTicks::FromInternalValue(2000)); TimeTicks::FromInternalValue(2000));
SequenceSortKey key_e(TaskPriority::BEST_EFFORT, TaskSourceSortKey key_e(TaskPriority::BEST_EFFORT,
TimeTicks::FromInternalValue(1000)); TimeTicks::FromInternalValue(1000));
SequenceSortKey key_f(TaskPriority::BEST_EFFORT, TaskSourceSortKey key_f(TaskPriority::BEST_EFFORT,
TimeTicks::FromInternalValue(2000)); TimeTicks::FromInternalValue(2000));
EXPECT_EQ(key_a, key_a); EXPECT_EQ(key_a, key_a);
...@@ -125,18 +125,18 @@ TEST(SequenceSortKeyTest, OperatorEqual) { ...@@ -125,18 +125,18 @@ TEST(SequenceSortKeyTest, OperatorEqual) {
EXPECT_EQ(key_f, key_f); EXPECT_EQ(key_f, key_f);
} }
TEST(SequenceSortKeyTest, OperatorNotEqual) { TEST(TaskSourceSortKeyTest, OperatorNotEqual) {
SequenceSortKey key_a(TaskPriority::USER_BLOCKING, TaskSourceSortKey key_a(TaskPriority::USER_BLOCKING,
TimeTicks::FromInternalValue(1000)); TimeTicks::FromInternalValue(1000));
SequenceSortKey key_b(TaskPriority::USER_BLOCKING, TaskSourceSortKey key_b(TaskPriority::USER_BLOCKING,
TimeTicks::FromInternalValue(2000)); TimeTicks::FromInternalValue(2000));
SequenceSortKey key_c(TaskPriority::USER_VISIBLE, TaskSourceSortKey key_c(TaskPriority::USER_VISIBLE,
TimeTicks::FromInternalValue(1000)); TimeTicks::FromInternalValue(1000));
SequenceSortKey key_d(TaskPriority::USER_VISIBLE, TaskSourceSortKey key_d(TaskPriority::USER_VISIBLE,
TimeTicks::FromInternalValue(2000)); TimeTicks::FromInternalValue(2000));
SequenceSortKey key_e(TaskPriority::BEST_EFFORT, TaskSourceSortKey key_e(TaskPriority::BEST_EFFORT,
TimeTicks::FromInternalValue(1000)); TimeTicks::FromInternalValue(1000));
SequenceSortKey key_f(TaskPriority::BEST_EFFORT, TaskSourceSortKey key_f(TaskPriority::BEST_EFFORT,
TimeTicks::FromInternalValue(2000)); TimeTicks::FromInternalValue(2000));
EXPECT_FALSE(key_a != key_a); EXPECT_FALSE(key_a != key_a);
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "base/task/thread_pool/delayed_task_manager.h" #include "base/task/thread_pool/delayed_task_manager.h"
#include "base/task/thread_pool/pooled_task_runner_delegate.h" #include "base/task/thread_pool/pooled_task_runner_delegate.h"
#include "base/task/thread_pool/sequence.h" #include "base/task/thread_pool/sequence.h"
#include "base/task/thread_pool/sequence_sort_key.h" #include "base/task/thread_pool/task_source_sort_key.h"
#include "base/task/thread_pool/task_tracker.h" #include "base/task/thread_pool/task_tracker.h"
#include "base/task/thread_pool/test_task_factory.h" #include "base/task/thread_pool/test_task_factory.h"
#include "base/task/thread_pool/test_utils.h" #include "base/task/thread_pool/test_utils.h"
......
...@@ -23,10 +23,10 @@ ...@@ -23,10 +23,10 @@
#include "base/task/task_features.h" #include "base/task/task_features.h"
#include "base/task/thread_pool/pooled_parallel_task_runner.h" #include "base/task/thread_pool/pooled_parallel_task_runner.h"
#include "base/task/thread_pool/pooled_sequenced_task_runner.h" #include "base/task/thread_pool/pooled_sequenced_task_runner.h"
#include "base/task/thread_pool/sequence_sort_key.h"
#include "base/task/thread_pool/service_thread.h" #include "base/task/thread_pool/service_thread.h"
#include "base/task/thread_pool/task.h" #include "base/task/thread_pool/task.h"
#include "base/task/thread_pool/task_source.h" #include "base/task/thread_pool/task_source.h"
#include "base/task/thread_pool/task_source_sort_key.h"
#include "base/task/thread_pool/thread_group_impl.h" #include "base/task/thread_pool/thread_group_impl.h"
#include "base/task/thread_pool/worker_thread.h" #include "base/task/thread_pool/worker_thread.h"
#include "base/threading/platform_thread.h" #include "base/threading/platform_thread.h"
......
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