Upstream version 11.40.271.0
[platform/framework/web/crosswalk.git] / src / components / copresence / handlers / audio / tick_clock_ref_counted.h
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 "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11
12 namespace base {
13 class TickClock;
14 class TimeTicks;
15 }
16
17 namespace copresence {
18
19 class TickClockRefCounted
20     : public base::RefCountedThreadSafe<TickClockRefCounted> {
21  public:
22   explicit TickClockRefCounted(scoped_ptr<base::TickClock> clock);
23
24   // Takes ownership of the clock.
25   explicit TickClockRefCounted(base::TickClock* clock);
26
27   base::TimeTicks NowTicks() const;
28
29  private:
30   friend class base::RefCountedThreadSafe<TickClockRefCounted>;
31   virtual ~TickClockRefCounted();
32
33   scoped_ptr<base::TickClock> clock_;
34
35   DISALLOW_COPY_AND_ASSIGN(TickClockRefCounted);
36 };
37
38 }  // namespace copresence
39
40 #endif  // COMPONENTS_COPRESENCE_HANDLERS_AUDIO_TICK_CLOCK_REF_COUNTED_H_