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 #include "media/cast/cast_thread.h" | 5 #include "media/cast/cast_thread.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 using base::TaskRunner; | 9 using base::TaskRunner; |
10 | 10 |
11 namespace media { | 11 namespace media { |
12 namespace cast { | 12 namespace cast { |
13 | 13 |
14 CastThread::CastThread( | 14 CastThread::CastThread( |
15 scoped_refptr<TaskRunner> main_thread_proxy, | 15 scoped_refptr<TaskRunner> main_thread_proxy, |
16 scoped_refptr<TaskRunner> audio_encode_thread_proxy, | 16 scoped_refptr<TaskRunner> audio_encode_thread_proxy, |
17 scoped_refptr<TaskRunner> audio_decode_thread_proxy, | 17 scoped_refptr<TaskRunner> audio_decode_thread_proxy, |
18 scoped_refptr<TaskRunner> video_encode_thread_proxy, | 18 scoped_refptr<TaskRunner> video_encode_thread_proxy, |
19 scoped_refptr<TaskRunner> video_decode_thread_proxy) | 19 scoped_refptr<TaskRunner> video_decode_thread_proxy) |
20 : main_thread_proxy_(main_thread_proxy), | 20 : main_thread_proxy_(main_thread_proxy), |
21 audio_encode_thread_proxy_(audio_encode_thread_proxy), | 21 audio_encode_thread_proxy_(audio_encode_thread_proxy), |
22 audio_decode_thread_proxy_(audio_decode_thread_proxy), | 22 audio_decode_thread_proxy_(audio_decode_thread_proxy), |
23 video_encode_thread_proxy_(video_encode_thread_proxy), | 23 video_encode_thread_proxy_(video_encode_thread_proxy), |
24 video_decode_thread_proxy_(video_decode_thread_proxy) { | 24 video_decode_thread_proxy_(video_decode_thread_proxy) { |
25 DCHECK(main_thread_proxy) << "Main thread required"; | 25 DCHECK(main_thread_proxy) << "Main thread required"; |
26 } | 26 } |
27 | 27 |
28 CastThread::~CastThread() { | |
pwestin
2013/09/26 23:20:23
nit: {} on same line
Alpha Left Google
2013/09/27 00:45:13
Done.
| |
29 } | |
30 | |
28 bool CastThread::PostTask(ThreadId identifier, | 31 bool CastThread::PostTask(ThreadId identifier, |
29 const tracked_objects::Location& from_here, | 32 const tracked_objects::Location& from_here, |
30 const base::Closure& task) { | 33 const base::Closure& task) { |
31 scoped_refptr<TaskRunner> task_runner = | 34 scoped_refptr<TaskRunner> task_runner = |
32 GetMessageTaskRunnerForThread(identifier); | 35 GetMessageTaskRunnerForThread(identifier); |
33 | 36 |
34 return task_runner->PostTask(from_here, task); | 37 return task_runner->PostTask(from_here, task); |
35 } | 38 } |
36 | 39 |
37 bool CastThread::PostDelayedTask(ThreadId identifier, | 40 bool CastThread::PostDelayedTask(ThreadId identifier, |
(...skipping 12 matching lines...) Expand all Loading... | |
50 case CastThread::MAIN: | 53 case CastThread::MAIN: |
51 return main_thread_proxy_; | 54 return main_thread_proxy_; |
52 case CastThread::AUDIO_ENCODER: | 55 case CastThread::AUDIO_ENCODER: |
53 return audio_encode_thread_proxy_; | 56 return audio_encode_thread_proxy_; |
54 case CastThread::AUDIO_DECODER: | 57 case CastThread::AUDIO_DECODER: |
55 return audio_decode_thread_proxy_; | 58 return audio_decode_thread_proxy_; |
56 case CastThread::VIDEO_ENCODER: | 59 case CastThread::VIDEO_ENCODER: |
57 return video_encode_thread_proxy_; | 60 return video_encode_thread_proxy_; |
58 case CastThread::VIDEO_DECODER: | 61 case CastThread::VIDEO_DECODER: |
59 return video_decode_thread_proxy_; | 62 return video_decode_thread_proxy_; |
63 default: | |
64 CHECK(false) << "Invalid Thread ID."; | |
65 return NULL; | |
pwestin
2013/09/26 23:20:23
Why add this? it's much better to get a compilatio
Alpha Left Google
2013/09/27 00:45:13
VC++ complains without this case.
| |
60 } | 66 } |
61 } | 67 } |
62 | 68 |
63 } // namespace cast | 69 } // namespace cast |
64 } // namespace media | 70 } // namespace media |
OLD | NEW |