Commit 95c5b287 authored by Karolina Soltys's avatar Karolina Soltys Committed by Commit Bot

[scheduler] Moving SetTimerSlack API from MessageLoop to SequenceManager.

In preparation for removing MessageLoop, we are making ThreadMain invoke SetTimerSlack on the SequenceManager as well as the MessageLoop.

Bug: 891670
Change-Id: I5e4fc8af654a62d543e3965603ee15c206a31d93
Reviewed-on: https://chromium-review.googlesource.com/c/1310433Reviewed-by: default avatarAlexander Timin <altimin@chromium.org>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Commit-Queue: Karolina Soltys <ksolt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605702}
parent fc2b5a00
...@@ -97,7 +97,7 @@ bool Thread::StartWithOptions(const Options& options) { ...@@ -97,7 +97,7 @@ bool Thread::StartWithOptions(const Options& options) {
if (!options.message_pump_factory.is_null()) if (!options.message_pump_factory.is_null())
type = MessageLoop::TYPE_CUSTOM; type = MessageLoop::TYPE_CUSTOM;
message_loop_timer_slack_ = options.timer_slack; timer_slack_ = options.timer_slack;
std::unique_ptr<MessageLoop> message_loop_owned = std::unique_ptr<MessageLoop> message_loop_owned =
MessageLoop::CreateUnbound(type, options.message_pump_factory); MessageLoop::CreateUnbound(type, options.message_pump_factory);
message_loop_ = message_loop_owned.get(); message_loop_ = message_loop_owned.get();
...@@ -313,9 +313,10 @@ void Thread::ThreadMain() { ...@@ -313,9 +313,10 @@ void Thread::ThreadMain() {
DCHECK(message_loop_); DCHECK(message_loop_);
std::unique_ptr<MessageLoop> message_loop(message_loop_); std::unique_ptr<MessageLoop> message_loop(message_loop_);
message_loop_->BindToCurrentThread(); message_loop_->BindToCurrentThread();
message_loop_->SetTimerSlack(message_loop_timer_slack_); message_loop_->SetTimerSlack(timer_slack_);
if (sequence_manager_) { if (sequence_manager_) {
sequence_manager_->SetTimerSlack(timer_slack_);
sequence_manager_->CompleteInitializationOnBoundThread(); sequence_manager_->CompleteInitializationOnBoundThread();
} }
......
...@@ -344,9 +344,9 @@ class BASE_EXPORT Thread : PlatformThread::Delegate { ...@@ -344,9 +344,9 @@ class BASE_EXPORT Thread : PlatformThread::Delegate {
// Optionally stores a SequenceManager that manages Tasks on the MessageLoop. // Optionally stores a SequenceManager that manages Tasks on the MessageLoop.
std::unique_ptr<sequence_manager::SequenceManager> sequence_manager_; std::unique_ptr<sequence_manager::SequenceManager> sequence_manager_;
// Stores Options::timer_slack_ until the message loop has been bound to // Stores Options::timer_slack_ until the sequence manager has been bound to
// a thread. // a thread.
TimerSlack message_loop_timer_slack_ = TIMER_SLACK_NONE; TimerSlack timer_slack_ = TIMER_SLACK_NONE;
// The name of the thread. Used for debugging purposes. // The name of the thread. Used for debugging purposes.
const std::string name_; const std::string name_;
......
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