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

Side by Side Diff: base/threading/sequenced_worker_pool.cc

Issue 2882523002: Remove SequencedWorkerPool::PostDelayedWorkerTask(). (Closed)
Patch Set: CR-gab-12 Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/threading/sequenced_worker_pool.h" 5 #include "base/threading/sequenced_worker_pool.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 166 }
167 167
168 bool SequencedWorkerPoolTaskRunner::PostDelayedTask( 168 bool SequencedWorkerPoolTaskRunner::PostDelayedTask(
169 const tracked_objects::Location& from_here, 169 const tracked_objects::Location& from_here,
170 OnceClosure task, 170 OnceClosure task,
171 TimeDelta delay) { 171 TimeDelta delay) {
172 if (delay.is_zero()) { 172 if (delay.is_zero()) {
173 return pool_->PostWorkerTaskWithShutdownBehavior(from_here, std::move(task), 173 return pool_->PostWorkerTaskWithShutdownBehavior(from_here, std::move(task),
174 shutdown_behavior_); 174 shutdown_behavior_);
175 } 175 }
176 return pool_->PostDelayedWorkerTask(from_here, std::move(task), delay); 176 return pool_->PostDelayedTask(from_here, std::move(task), delay);
177 } 177 }
178 178
179 bool SequencedWorkerPoolTaskRunner::RunsTasksInCurrentSequence() const { 179 bool SequencedWorkerPoolTaskRunner::RunsTasksInCurrentSequence() const {
180 return pool_->RunsTasksInCurrentSequence(); 180 return pool_->RunsTasksInCurrentSequence();
181 } 181 }
182 182
183 } // namespace 183 } // namespace
184 184
185 // SequencedWorkerPool::PoolSequencedTaskRunner ------------------------------ 185 // SequencedWorkerPool::PoolSequencedTaskRunner ------------------------------
186 // A SequencedTaskRunner which posts tasks to a SequencedWorkerPool with a 186 // A SequencedTaskRunner which posts tasks to a SequencedWorkerPool with a
(...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 return new SequencedWorkerPoolTaskRunner(this, shutdown_behavior); 1545 return new SequencedWorkerPoolTaskRunner(this, shutdown_behavior);
1546 } 1546 }
1547 1547
1548 bool SequencedWorkerPool::PostWorkerTask( 1548 bool SequencedWorkerPool::PostWorkerTask(
1549 const tracked_objects::Location& from_here, 1549 const tracked_objects::Location& from_here,
1550 OnceClosure task) { 1550 OnceClosure task) {
1551 return inner_->PostTask(NULL, SequenceToken(), BLOCK_SHUTDOWN, from_here, 1551 return inner_->PostTask(NULL, SequenceToken(), BLOCK_SHUTDOWN, from_here,
1552 std::move(task), TimeDelta()); 1552 std::move(task), TimeDelta());
1553 } 1553 }
1554 1554
1555 bool SequencedWorkerPool::PostDelayedWorkerTask(
1556 const tracked_objects::Location& from_here,
1557 OnceClosure task,
1558 TimeDelta delay) {
1559 WorkerShutdown shutdown_behavior =
1560 delay.is_zero() ? BLOCK_SHUTDOWN : SKIP_ON_SHUTDOWN;
1561 return inner_->PostTask(NULL, SequenceToken(), shutdown_behavior, from_here,
1562 std::move(task), delay);
1563 }
1564
1565 bool SequencedWorkerPool::PostWorkerTaskWithShutdownBehavior( 1555 bool SequencedWorkerPool::PostWorkerTaskWithShutdownBehavior(
1566 const tracked_objects::Location& from_here, 1556 const tracked_objects::Location& from_here,
1567 OnceClosure task, 1557 OnceClosure task,
1568 WorkerShutdown shutdown_behavior) { 1558 WorkerShutdown shutdown_behavior) {
1569 return inner_->PostTask(NULL, SequenceToken(), shutdown_behavior, from_here, 1559 return inner_->PostTask(NULL, SequenceToken(), shutdown_behavior, from_here,
1570 std::move(task), TimeDelta()); 1560 std::move(task), TimeDelta());
1571 } 1561 }
1572 1562
1573 bool SequencedWorkerPool::PostSequencedWorkerTask( 1563 bool SequencedWorkerPool::PostSequencedWorkerTask(
1574 SequenceToken sequence_token, 1564 SequenceToken sequence_token,
(...skipping 29 matching lines...) Expand all
1604 OnceClosure task, 1594 OnceClosure task,
1605 WorkerShutdown shutdown_behavior) { 1595 WorkerShutdown shutdown_behavior) {
1606 return inner_->PostTask(NULL, sequence_token, shutdown_behavior, from_here, 1596 return inner_->PostTask(NULL, sequence_token, shutdown_behavior, from_here,
1607 std::move(task), TimeDelta()); 1597 std::move(task), TimeDelta());
1608 } 1598 }
1609 1599
1610 bool SequencedWorkerPool::PostDelayedTask( 1600 bool SequencedWorkerPool::PostDelayedTask(
1611 const tracked_objects::Location& from_here, 1601 const tracked_objects::Location& from_here,
1612 OnceClosure task, 1602 OnceClosure task,
1613 TimeDelta delay) { 1603 TimeDelta delay) {
1614 return PostDelayedWorkerTask(from_here, std::move(task), delay); 1604 WorkerShutdown shutdown_behavior =
1605 delay.is_zero() ? BLOCK_SHUTDOWN : SKIP_ON_SHUTDOWN;
1606 return inner_->PostTask(nullptr, SequenceToken(), shutdown_behavior,
1607 from_here, std::move(task), delay);
1615 } 1608 }
1616 1609
1617 bool SequencedWorkerPool::RunsTasksInCurrentSequence() const { 1610 bool SequencedWorkerPool::RunsTasksInCurrentSequence() const {
1618 return inner_->RunsTasksOnCurrentThread(); 1611 return inner_->RunsTasksOnCurrentThread();
1619 } 1612 }
1620 1613
1621 void SequencedWorkerPool::FlushForTesting() { 1614 void SequencedWorkerPool::FlushForTesting() {
1622 DCHECK(!RunsTasksOnCurrentThread()); 1615 DCHECK(!RunsTasksOnCurrentThread());
1623 base::ThreadRestrictions::ScopedAllowWait allow_wait; 1616 base::ThreadRestrictions::ScopedAllowWait allow_wait;
1624 if (g_all_pools_state == AllPoolsState::REDIRECTED_TO_TASK_SCHEDULER) { 1617 if (g_all_pools_state == AllPoolsState::REDIRECTED_TO_TASK_SCHEDULER) {
(...skipping 16 matching lines...) Expand all
1641 bool SequencedWorkerPool::IsShutdownInProgress() { 1634 bool SequencedWorkerPool::IsShutdownInProgress() {
1642 return inner_->IsShutdownInProgress(); 1635 return inner_->IsShutdownInProgress();
1643 } 1636 }
1644 1637
1645 bool SequencedWorkerPool::IsRunningSequenceOnCurrentThread( 1638 bool SequencedWorkerPool::IsRunningSequenceOnCurrentThread(
1646 SequenceToken sequence_token) const { 1639 SequenceToken sequence_token) const {
1647 return inner_->IsRunningSequenceOnCurrentThread(sequence_token); 1640 return inner_->IsRunningSequenceOnCurrentThread(sequence_token);
1648 } 1641 }
1649 1642
1650 } // namespace base 1643 } // namespace base
OLDNEW
« 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