blob: b66c8208e91008346d8aa67ab91061f01dd3a9cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/scheduler/renderer/throttled_time_domain.h"
namespace scheduler {
ThrottledTimeDomain::ThrottledTimeDomain(TimeDomain::Observer* observer,
const char* tracing_category)
: RealTimeDomain(observer, tracing_category) {}
ThrottledTimeDomain::~ThrottledTimeDomain() {}
const char* ThrottledTimeDomain::GetName() const {
return "ThrottledTimeDomain";
}
void ThrottledTimeDomain::RequestWakeup(base::TimeTicks now,
base::TimeDelta delay) {
// We assume the owner (i.e. ThrottlingHelper) will manage wakeups on our
// behalf.
}
bool ThrottledTimeDomain::MaybeAdvanceTime() {
base::TimeTicks next_run_time;
if (!NextScheduledRunTime(&next_run_time))
return false;
base::TimeTicks now = Now();
if (now >= next_run_time)
return true; // Causes DoWork to post a continuation.
// Unlike RealTimeDomain::MaybeAdvanceTime we don't request a wake up here, we
// assume the owner (i.e. ThrottlingHelper) will manage wakeups on our behalf.
return false;
}
} // namespace scheduler
|