OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/policy/core/common/remote_commands/remote_commands_queue.h" | 5 #include "components/policy/core/common/remote_commands/remote_commands_queue.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
9 #include "base/location.h" | 11 #include "base/location.h" |
10 #include "base/logging.h" | 12 #include "base/logging.h" |
11 #include "base/time/default_tick_clock.h" | 13 #include "base/time/default_tick_clock.h" |
12 #include "base/time/tick_clock.h" | 14 #include "base/time/tick_clock.h" |
13 #include "components/policy/core/common/remote_commands/remote_command_job.h" | 15 #include "components/policy/core/common/remote_commands/remote_command_job.h" |
14 | 16 |
15 namespace policy { | 17 namespace policy { |
16 | 18 |
(...skipping 18 matching lines...) Expand all Loading... |
35 | 37 |
36 void RemoteCommandsQueue::AddJob(scoped_ptr<RemoteCommandJob> job) { | 38 void RemoteCommandsQueue::AddJob(scoped_ptr<RemoteCommandJob> job) { |
37 incoming_commands_.push(linked_ptr<RemoteCommandJob>(job.release())); | 39 incoming_commands_.push(linked_ptr<RemoteCommandJob>(job.release())); |
38 | 40 |
39 if (!running_command_) | 41 if (!running_command_) |
40 ScheduleNextJob(); | 42 ScheduleNextJob(); |
41 } | 43 } |
42 | 44 |
43 void RemoteCommandsQueue::SetClockForTesting( | 45 void RemoteCommandsQueue::SetClockForTesting( |
44 scoped_ptr<base::TickClock> clock) { | 46 scoped_ptr<base::TickClock> clock) { |
45 clock_ = clock.Pass(); | 47 clock_ = std::move(clock); |
46 } | 48 } |
47 | 49 |
48 base::TimeTicks RemoteCommandsQueue::GetNowTicks() { | 50 base::TimeTicks RemoteCommandsQueue::GetNowTicks() { |
49 return clock_->NowTicks(); | 51 return clock_->NowTicks(); |
50 } | 52 } |
51 | 53 |
52 void RemoteCommandsQueue::OnCommandTimeout() { | 54 void RemoteCommandsQueue::OnCommandTimeout() { |
53 DCHECK(running_command_); | 55 DCHECK(running_command_); |
54 | 56 |
55 // Calling Terminate() will also trigger CurrentJobFinished() below. | 57 // Calling Terminate() will also trigger CurrentJobFinished() below. |
(...skipping 29 matching lines...) Expand all Loading... |
85 base::Bind(&RemoteCommandsQueue::CurrentJobFinished, | 87 base::Bind(&RemoteCommandsQueue::CurrentJobFinished, |
86 base::Unretained(this)))) { | 88 base::Unretained(this)))) { |
87 FOR_EACH_OBSERVER(Observer, observer_list_, | 89 FOR_EACH_OBSERVER(Observer, observer_list_, |
88 OnJobStarted(running_command_.get())); | 90 OnJobStarted(running_command_.get())); |
89 } else { | 91 } else { |
90 CurrentJobFinished(); | 92 CurrentJobFinished(); |
91 } | 93 } |
92 } | 94 } |
93 | 95 |
94 } // namespace policy | 96 } // namespace policy |
OLD | NEW |