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

Unified Diff: base/threading/sequenced_worker_pool.cc

Issue 2177373005: Revert "Allow SequencedTaskRunnerHandle::Get() while running unsequenced tasks." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge up to r408965 Created 4 years, 5 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 | « base/threading/sequenced_worker_pool.h ('k') | base/threading/sequenced_worker_pool_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/sequenced_worker_pool.cc
diff --git a/base/threading/sequenced_worker_pool.cc b/base/threading/sequenced_worker_pool.cc
index 0f2eac4cc45fb1751f5d882175e248e2691b7054..d8d10f34e9f2998d79ba601a46fa6dfe0a4fdab4 100644
--- a/base/threading/sequenced_worker_pool.cc
+++ b/base/threading/sequenced_worker_pool.cc
@@ -326,11 +326,6 @@ class SequencedWorkerPool::Inner {
bool IsRunningSequenceOnCurrentThread(SequenceToken sequence_token) const;
- bool IsRunningSequence(SequenceToken sequence_token) const;
-
- void SetRunningTaskInfoForCurrentThread(SequenceToken sequence_token,
- WorkerShutdown shutdown_behavior);
-
void CleanupForTesting();
void SignalHasWorkForTesting();
@@ -706,28 +701,6 @@ bool SequencedWorkerPool::Inner::IsRunningSequenceOnCurrentThread(
sequence_token.Equals(found->second->task_sequence_token());
}
-bool SequencedWorkerPool::Inner::IsRunningSequence(
- SequenceToken sequence_token) const {
- DCHECK(sequence_token.IsValid());
- AutoLock lock(lock_);
- return !IsSequenceTokenRunnable(sequence_token.id_);
-}
-
-void SequencedWorkerPool::Inner::SetRunningTaskInfoForCurrentThread(
- SequenceToken sequence_token,
- WorkerShutdown shutdown_behavior) {
- AutoLock lock(lock_);
- ThreadMap::const_iterator found = threads_.find(PlatformThread::CurrentId());
- DCHECK(found != threads_.end());
- DCHECK(found->second->is_processing_task());
- DCHECK(!found->second->task_sequence_token().IsValid());
- found->second->set_running_task_info(sequence_token, shutdown_behavior);
-
- // Mark the sequence token as in use.
- bool success = current_sequences_.insert(sequence_token.id_).second;
- DCHECK(success);
-}
-
// See https://code.google.com/p/chromium/issues/detail?id=168415
void SequencedWorkerPool::Inner::CleanupForTesting() {
DCHECK(!RunsTasksOnCurrentThread());
@@ -853,11 +826,6 @@ void SequencedWorkerPool::Inner::ThreadLoop(Worker* this_worker) {
tracked_objects::ThreadData::TallyRunOnNamedThreadIfTracking(
task, stopwatch);
- // Update the sequence token in case it has been set from within the
- // task, so it can be removed from the set of currently running
- // sequences in DidRunWorkerTask() below.
- task.sequence_token_id = this_worker->task_sequence_token().id_;
-
// Make sure our task is erased outside the lock for the
// same reason we do this with delete_these_oustide_lock.
// Also, do it before calling reset_running_task_info() so
@@ -1241,33 +1209,6 @@ SequencedWorkerPool::GetWorkerPoolForCurrentThread() {
return worker->worker_pool();
}
-// static
-scoped_refptr<SequencedTaskRunner>
-SequencedWorkerPool::GetSequencedTaskRunnerForCurrentThread() {
- Worker* worker = Worker::GetForCurrentThread();
-
- // If there is no worker, this thread is not a worker thread. Otherwise, it is
- // currently running a task (sequenced or unsequenced).
- if (!worker)
- return nullptr;
-
- scoped_refptr<SequencedWorkerPool> pool = worker->worker_pool();
- SequenceToken sequence_token = worker->task_sequence_token();
- WorkerShutdown shutdown_behavior = worker->task_shutdown_behavior();
- if (!sequence_token.IsValid()) {
- // Create a new sequence token and bind this thread to it, to make sure that
- // a task posted to the SequencedTaskRunner we are going to return is not
- // immediately going to run on a different thread.
- sequence_token = Inner::GetSequenceToken();
- pool->inner_->SetRunningTaskInfoForCurrentThread(sequence_token,
- shutdown_behavior);
- }
-
- DCHECK(pool->IsRunningSequenceOnCurrentThread(sequence_token));
- return new SequencedWorkerPoolSequencedTaskRunner(
- std::move(pool), sequence_token, shutdown_behavior);
-}
-
SequencedWorkerPool::SequencedWorkerPool(size_t max_threads,
const std::string& thread_name_prefix,
base::TaskPriority task_priority)
@@ -1412,11 +1353,6 @@ bool SequencedWorkerPool::IsRunningSequenceOnCurrentThread(
return inner_->IsRunningSequenceOnCurrentThread(sequence_token);
}
-bool SequencedWorkerPool::IsRunningSequence(
- SequenceToken sequence_token) const {
- return inner_->IsRunningSequence(sequence_token);
-}
-
void SequencedWorkerPool::FlushForTesting() {
inner_->CleanupForTesting();
}
« no previous file with comments | « base/threading/sequenced_worker_pool.h ('k') | base/threading/sequenced_worker_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698