Commit b57f8242 authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Remove base::TestMockTimeTaskRunner::DeprecatedGetMockClock().

It is unused, and so are DeprecatedGetMockTickClock(),
LegacyMockTickClock and LegacyMockClock.

Fixed: 789079
Change-Id: Ic5c504a19dae5217c6e7971cecb3c3325d533c5a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2496506
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821556}
parent f4fb404d
......@@ -276,7 +276,6 @@ class TaskEnvironment {
// Only valid for instances using TimeSource::MOCK_TIME. Returns a
// TickClock whose time is updated by FastForward(By|UntilNoTasksRemain).
const TickClock* GetMockTickClock() const;
std::unique_ptr<TickClock> DeprecatedGetMockTickClock();
// Only valid for instances using TimeSource::MOCK_TIME. Returns a
// Clock whose time is updated by FastForward(By|UntilNoTasksRemain). The
......
......@@ -14,43 +14,6 @@
#include "base/threading/thread_task_runner_handle.h"
namespace base {
namespace {
// LegacyMockTickClock and LegacyMockClock are used by deprecated APIs of
// TestMockTimeTaskRunner. They will be removed after updating callers of
// GetMockClock() and GetMockTickClock() to GetMockClockPtr() and
// GetMockTickClockPtr().
class LegacyMockTickClock : public TickClock {
public:
explicit LegacyMockTickClock(
scoped_refptr<const TestMockTimeTaskRunner> task_runner)
: task_runner_(std::move(task_runner)) {}
// TickClock:
TimeTicks NowTicks() const override { return task_runner_->NowTicks(); }
private:
scoped_refptr<const TestMockTimeTaskRunner> task_runner_;
DISALLOW_COPY_AND_ASSIGN(LegacyMockTickClock);
};
class LegacyMockClock : public Clock {
public:
explicit LegacyMockClock(
scoped_refptr<const TestMockTimeTaskRunner> task_runner)
: task_runner_(std::move(task_runner)) {}
// Clock:
Time Now() const override { return task_runner_->Now(); }
private:
scoped_refptr<const TestMockTimeTaskRunner> task_runner_;
DISALLOW_COPY_AND_ASSIGN(LegacyMockClock);
};
} // namespace
// A SingleThreadTaskRunner which forwards everything to its |target_|. This
// serves two purposes:
......@@ -280,22 +243,11 @@ TimeTicks TestMockTimeTaskRunner::NowTicks() const {
return now_ticks_;
}
std::unique_ptr<Clock> TestMockTimeTaskRunner::DeprecatedGetMockClock() const {
DCHECK(thread_checker_.CalledOnValidThread());
return std::make_unique<LegacyMockClock>(this);
}
Clock* TestMockTimeTaskRunner::GetMockClock() const {
DCHECK(thread_checker_.CalledOnValidThread());
return &mock_clock_;
}
std::unique_ptr<TickClock> TestMockTimeTaskRunner::DeprecatedGetMockTickClock()
const {
DCHECK(thread_checker_.CalledOnValidThread());
return std::make_unique<LegacyMockTickClock>(this);
}
const TickClock* TestMockTimeTaskRunner::GetMockTickClock() const {
DCHECK(thread_checker_.CalledOnValidThread());
return &mock_clock_;
......
......@@ -174,16 +174,10 @@ class TestMockTimeTaskRunner : public SingleThreadTaskRunner,
// Returns a Clock that uses the virtual time of |this| as its time source.
// The returned Clock will hold a reference to |this|.
// TODO(tzik): Remove DeprecatedGetMockClock() after updating all callers to
// use non-owning Clock.
std::unique_ptr<Clock> DeprecatedGetMockClock() const;
Clock* GetMockClock() const;
// Returns a TickClock that uses the virtual time ticks of |this| as its tick
// source. The returned TickClock will hold a reference to |this|.
// TODO(tzik): Replace Remove DeprecatedGetMockTickClock() after updating all
// callers to use non-owning TickClock.
std::unique_ptr<TickClock> DeprecatedGetMockTickClock() const;
const TickClock* GetMockTickClock() const;
// Cancelled pending tasks get pruned automatically.
......
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