OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 MEDIA_CAST_CAST_ENVIRONMENT_H_ | 5 #ifndef MEDIA_CAST_CAST_ENVIRONMENT_H_ |
6 #define MEDIA_CAST_CAST_ENVIRONMENT_H_ | 6 #define MEDIA_CAST_CAST_ENVIRONMENT_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.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" |
(...skipping 14 matching lines...) Expand all Loading... |
25 // and network IO is performed. | 25 // and network IO is performed. |
26 MAIN, | 26 MAIN, |
27 // The audio thread is where all send side audio processing is done, | 27 // The audio thread is where all send side audio processing is done, |
28 // primarily encoding / decoding but also re-sampling. | 28 // primarily encoding / decoding but also re-sampling. |
29 AUDIO, | 29 AUDIO, |
30 // The video encoder thread is where the video processing is done. | 30 // The video encoder thread is where the video processing is done. |
31 VIDEO, | 31 VIDEO, |
32 }; | 32 }; |
33 | 33 |
34 CastEnvironment( | 34 CastEnvironment( |
35 scoped_ptr<base::TickClock> clock, | 35 scoped_refptr<base::TickClock> clock, |
36 scoped_refptr<base::SingleThreadTaskRunner> main_thread_proxy, | 36 scoped_refptr<base::SingleThreadTaskRunner> main_thread_proxy, |
37 scoped_refptr<base::SingleThreadTaskRunner> audio_thread_proxy, | 37 scoped_refptr<base::SingleThreadTaskRunner> audio_thread_proxy, |
38 scoped_refptr<base::SingleThreadTaskRunner> video_thread_proxy); | 38 scoped_refptr<base::SingleThreadTaskRunner> video_thread_proxy); |
39 | 39 |
40 // These are the same methods in message_loop.h, but are guaranteed to either | 40 // These are the same methods in message_loop.h, but are guaranteed to either |
41 // get posted to the MessageLoop if it's still alive, or be deleted otherwise. | 41 // get posted to the MessageLoop if it's still alive, or be deleted otherwise. |
42 // They return true iff the thread existed and the task was posted. Note that | 42 // They return true if the thread existed and the task was posted. Note that |
43 // even if the task is posted, there's no guarantee that it will run, since | 43 // even if the task is posted, there's no guarantee that it will run, since |
44 // the target thread may already have a Quit message in its queue. | 44 // the target thread may already have a Quit message in its queue. |
45 bool PostTask(ThreadId identifier, | 45 bool PostTask(ThreadId identifier, |
46 const tracked_objects::Location& from_here, | 46 const tracked_objects::Location& from_here, |
47 const base::Closure& task); | 47 const base::Closure& task); |
48 | 48 |
49 bool PostDelayedTask(ThreadId identifier, | 49 bool PostDelayedTask(ThreadId identifier, |
50 const tracked_objects::Location& from_here, | 50 const tracked_objects::Location& from_here, |
51 const base::Closure& task, | 51 const base::Closure& task, |
52 base::TimeDelta delay); | 52 base::TimeDelta delay); |
(...skipping 15 matching lines...) Expand all Loading... |
68 | 68 |
69 bool HasVideoThread() { return video_thread_proxy_.get() ? true : false; } | 69 bool HasVideoThread() { return video_thread_proxy_.get() ? true : false; } |
70 | 70 |
71 protected: | 71 protected: |
72 virtual ~CastEnvironment(); | 72 virtual ~CastEnvironment(); |
73 | 73 |
74 // Subclasses may override these. | 74 // Subclasses may override these. |
75 scoped_refptr<base::SingleThreadTaskRunner> main_thread_proxy_; | 75 scoped_refptr<base::SingleThreadTaskRunner> main_thread_proxy_; |
76 scoped_refptr<base::SingleThreadTaskRunner> audio_thread_proxy_; | 76 scoped_refptr<base::SingleThreadTaskRunner> audio_thread_proxy_; |
77 scoped_refptr<base::SingleThreadTaskRunner> video_thread_proxy_; | 77 scoped_refptr<base::SingleThreadTaskRunner> video_thread_proxy_; |
78 scoped_ptr<base::TickClock> clock_; | 78 scoped_refptr<base::TickClock> clock_; |
79 scoped_ptr<LoggingImpl> logging_; | 79 scoped_ptr<LoggingImpl> logging_; |
80 | 80 |
81 private: | 81 private: |
82 friend class base::RefCountedThreadSafe<CastEnvironment>; | 82 friend class base::RefCountedThreadSafe<CastEnvironment>; |
83 | 83 |
84 DISALLOW_COPY_AND_ASSIGN(CastEnvironment); | 84 DISALLOW_COPY_AND_ASSIGN(CastEnvironment); |
85 }; | 85 }; |
86 | 86 |
87 } // namespace cast | 87 } // namespace cast |
88 } // namespace media | 88 } // namespace media |
89 | 89 |
90 #endif // MEDIA_CAST_CAST_ENVIRONMENT_H_ | 90 #endif // MEDIA_CAST_CAST_ENVIRONMENT_H_ |
OLD | NEW |