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 CHROMECAST_MEDIA_CMA_BASE_MEDIA_TASK_RUNNER_H_ | 5 #ifndef CHROMECAST_MEDIA_CMA_BASE_MEDIA_TASK_RUNNER_H_ |
6 #define CHROMECAST_MEDIA_CMA_BASE_MEDIA_TASK_RUNNER_H_ | 6 #define CHROMECAST_MEDIA_CMA_BASE_MEDIA_TASK_RUNNER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 | 13 |
14 namespace chromecast { | 14 namespace chromecast { |
15 namespace media { | 15 namespace media { |
16 | 16 |
17 class MediaTaskRunner | 17 class MediaTaskRunner |
18 : public base::RefCountedThreadSafe<MediaTaskRunner> { | 18 : public base::RefCountedThreadSafe<MediaTaskRunner> { |
19 public: | 19 public: |
20 MediaTaskRunner(); | 20 MediaTaskRunner(); |
21 | 21 |
22 // Post a task with the given media |timestamp|. If |timestamp| is equal to | 22 // Post a task with the given media |timestamp|. If |timestamp| is equal to |
23 // |kNoTimestamp()|, the task is scheduled right away. | 23 // |kNoTimestamp|, the task is scheduled right away. |
24 // How the media timestamp is used to schedule the task is an implementation | 24 // How the media timestamp is used to schedule the task is an implementation |
25 // detail of derived classes. | 25 // detail of derived classes. |
26 // Returns true if the task may be run at some point in the future, and false | 26 // Returns true if the task may be run at some point in the future, and false |
27 // if the task definitely will not be run. | 27 // if the task definitely will not be run. |
28 virtual bool PostMediaTask( | 28 virtual bool PostMediaTask( |
29 const tracked_objects::Location& from_here, | 29 const tracked_objects::Location& from_here, |
30 const base::Closure& task, | 30 const base::Closure& task, |
31 base::TimeDelta timestamp) = 0; | 31 base::TimeDelta timestamp) = 0; |
32 | 32 |
33 protected: | 33 protected: |
34 virtual ~MediaTaskRunner(); | 34 virtual ~MediaTaskRunner(); |
35 friend class base::RefCountedThreadSafe<MediaTaskRunner>; | 35 friend class base::RefCountedThreadSafe<MediaTaskRunner>; |
36 | 36 |
37 private: | 37 private: |
38 DISALLOW_COPY_AND_ASSIGN(MediaTaskRunner); | 38 DISALLOW_COPY_AND_ASSIGN(MediaTaskRunner); |
39 }; | 39 }; |
40 | 40 |
41 } // namespace media | 41 } // namespace media |
42 } // namespace chromecast | 42 } // namespace chromecast |
43 | 43 |
44 #endif // CHROMECAST_MEDIA_CMA_BASE_MEDIA_TASK_RUNNER_H_ | 44 #endif // CHROMECAST_MEDIA_CMA_BASE_MEDIA_TASK_RUNNER_H_ |
OLD | NEW |