Commit db344f5a authored by tzik's avatar tzik Committed by Commit Bot

Replace base::Timer with behavior-specific timers in tools/

This CL replaces base::Timer with its subclasses.
As base::Timer changes its behavior subject to its construction time
flags, that makes hard to see the actual timer behavior, especially
it's unclear when a timer is injected from other components.
Also, that OnceCallback support of base::Timer is hard to implement on
the dynamically determined invocation pattern.

Bug: 850247
Change-Id: I38b7d932304466a9d86bbd577f9918149914f8ea
Reviewed-on: https://chromium-review.googlesource.com/1128694Reviewed-by: default avatarMartin Barbella <mbarbella@chromium.org>
Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
Cr-Commit-Position: refs/heads/master@{#573522}
parent ddb2b533
...@@ -180,10 +180,9 @@ void ReplayProcess::SendNextMessage() { ...@@ -180,10 +180,9 @@ void ReplayProcess::SendNextMessage() {
} }
void ReplayProcess::Run() { void ReplayProcess::Run() {
timer_.reset(new base::Timer(false, true)); base::RepeatingTimer timer;
timer_->Start(FROM_HERE, timer.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(1),
base::TimeDelta::FromMilliseconds(1), base::BindRepeating(&ReplayProcess::SendNextMessage,
base::Bind(&ReplayProcess::SendNextMessage,
base::Unretained(this))); base::Unretained(this)));
base::RunLoop().Run(); base::RunLoop().Run();
} }
......
...@@ -66,7 +66,6 @@ class ReplayProcess : public IPC::Listener { ...@@ -66,7 +66,6 @@ class ReplayProcess : public IPC::Listener {
base::MessageLoop main_loop_; base::MessageLoop main_loop_;
base::Thread io_thread_; base::Thread io_thread_;
base::WaitableEvent shutdown_event_; base::WaitableEvent shutdown_event_;
std::unique_ptr<base::Timer> timer_;
MessageVector messages_; MessageVector messages_;
size_t message_index_; size_t message_index_;
......
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