OLD | NEW |
| (Empty) |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_COPRESENCE_HANDLERS_AUDIO_TICK_CLOCK_REF_COUNTED_H_ | |
6 #define COMPONENTS_COPRESENCE_HANDLERS_AUDIO_TICK_CLOCK_REF_COUNTED_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "base/macros.h" | |
11 #include "base/memory/ref_counted.h" | |
12 | |
13 namespace base { | |
14 class TickClock; | |
15 class TimeTicks; | |
16 } | |
17 | |
18 namespace copresence { | |
19 | |
20 class TickClockRefCounted | |
21 : public base::RefCountedThreadSafe<TickClockRefCounted> { | |
22 public: | |
23 explicit TickClockRefCounted(std::unique_ptr<base::TickClock> clock); | |
24 | |
25 // Takes ownership of the clock. | |
26 explicit TickClockRefCounted(base::TickClock* clock); | |
27 | |
28 base::TimeTicks NowTicks() const; | |
29 | |
30 private: | |
31 friend class base::RefCountedThreadSafe<TickClockRefCounted>; | |
32 virtual ~TickClockRefCounted(); | |
33 | |
34 std::unique_ptr<base::TickClock> clock_; | |
35 | |
36 DISALLOW_COPY_AND_ASSIGN(TickClockRefCounted); | |
37 }; | |
38 | |
39 } // namespace copresence | |
40 | |
41 #endif // COMPONENTS_COPRESENCE_HANDLERS_AUDIO_TICK_CLOCK_REF_COUNTED_H_ | |
OLD | NEW |