Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef COMPONENTS_COPRESENCE_HANDLERS_AUDIO_TICK_CLOCK_REF_COUNTED_H_ | 5 #ifndef COMPONENTS_COPRESENCE_HANDLERS_AUDIO_TICK_CLOCK_REF_COUNTED_H_ |
| 6 #define COMPONENTS_COPRESENCE_HANDLERS_AUDIO_TICK_CLOCK_REF_COUNTED_H_ | 6 #define COMPONENTS_COPRESENCE_HANDLERS_AUDIO_TICK_CLOCK_REF_COUNTED_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/time/time.h" | |
| 12 | 11 |
| 13 namespace base { | 12 namespace base { |
| 14 class TickClock; | 13 class TickClock; |
| 14 class TimeTicks; | |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace copresence { | 17 namespace copresence { |
| 18 | 18 |
| 19 class TickClockRefCounted | 19 class TickClockRefCounted |
| 20 : public base::RefCountedThreadSafe<TickClockRefCounted> { | 20 : public base::RefCountedThreadSafe<TickClockRefCounted> { |
| 21 public: | 21 public: |
| 22 explicit TickClockRefCounted(scoped_ptr<base::TickClock> clock); | 22 explicit TickClockRefCounted(scoped_ptr<base::TickClock> clock); |
| 23 base::TimeTicks NowTicks(); | 23 |
| 24 // Takes ownership of the clock. | |
| 25 explicit TickClockRefCounted(base::TickClock* clock); | |
|
rkc
2014/11/03 20:14:43
Why do we need this?
Charlie
2014/11/03 22:45:13
There's already a lot of boilerplate to create one
rkc
2014/11/03 22:52:15
That does look pretty ugly.
| |
| 26 | |
| 27 base::TimeTicks NowTicks() const; | |
| 24 | 28 |
| 25 private: | 29 private: |
| 26 friend class base::RefCountedThreadSafe<TickClockRefCounted>; | 30 friend class base::RefCountedThreadSafe<TickClockRefCounted>; |
| 27 virtual ~TickClockRefCounted(); | 31 virtual ~TickClockRefCounted(); |
| 28 | 32 |
| 29 scoped_ptr<base::TickClock> clock_; | 33 scoped_ptr<base::TickClock> clock_; |
| 30 | 34 |
| 31 DISALLOW_COPY_AND_ASSIGN(TickClockRefCounted); | 35 DISALLOW_COPY_AND_ASSIGN(TickClockRefCounted); |
| 32 }; | 36 }; |
| 33 | 37 |
| 34 } // namespace copresence | 38 } // namespace copresence |
| 35 | 39 |
| 36 #endif // COMPONENTS_COPRESENCE_HANDLERS_AUDIO_TICK_CLOCK_REF_COUNTED_H_ | 40 #endif // COMPONENTS_COPRESENCE_HANDLERS_AUDIO_TICK_CLOCK_REF_COUNTED_H_ |
| OLD | NEW |