Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Side by Side Diff: trunk/src/media/cast/cast_thread.cc

Issue 25546003: Revert 226264 "Be able to build cast_unittest and related target..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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() {}
29
30 bool CastThread::PostTask(ThreadId identifier, 28 bool CastThread::PostTask(ThreadId identifier,
31 const tracked_objects::Location& from_here, 29 const tracked_objects::Location& from_here,
32 const base::Closure& task) { 30 const base::Closure& task) {
33 scoped_refptr<TaskRunner> task_runner = 31 scoped_refptr<TaskRunner> task_runner =
34 GetMessageTaskRunnerForThread(identifier); 32 GetMessageTaskRunnerForThread(identifier);
35 33
36 return task_runner->PostTask(from_here, task); 34 return task_runner->PostTask(from_here, task);
37 } 35 }
38 36
39 bool CastThread::PostDelayedTask(ThreadId identifier, 37 bool CastThread::PostDelayedTask(ThreadId identifier,
(...skipping 12 matching lines...) Expand all
52 case CastThread::MAIN: 50 case CastThread::MAIN:
53 return main_thread_proxy_; 51 return main_thread_proxy_;
54 case CastThread::AUDIO_ENCODER: 52 case CastThread::AUDIO_ENCODER:
55 return audio_encode_thread_proxy_; 53 return audio_encode_thread_proxy_;
56 case CastThread::AUDIO_DECODER: 54 case CastThread::AUDIO_DECODER:
57 return audio_decode_thread_proxy_; 55 return audio_decode_thread_proxy_;
58 case CastThread::VIDEO_ENCODER: 56 case CastThread::VIDEO_ENCODER:
59 return video_encode_thread_proxy_; 57 return video_encode_thread_proxy_;
60 case CastThread::VIDEO_DECODER: 58 case CastThread::VIDEO_DECODER:
61 return video_decode_thread_proxy_; 59 return video_decode_thread_proxy_;
62 default:
63 CHECK(false) << "Invalid Thread ID.";
64 return NULL;
65 } 60 }
66 } 61 }
67 62
68 bool CastThread::CurrentlyOn(ThreadId identifier) { 63 bool CastThread::CurrentlyOn(ThreadId identifier) {
69 switch (identifier) { 64 switch (identifier) {
70 case CastThread::MAIN: 65 case CastThread::MAIN:
71 return main_thread_proxy_->RunsTasksOnCurrentThread(); 66 return main_thread_proxy_->RunsTasksOnCurrentThread();
72 case CastThread::AUDIO_ENCODER: 67 case CastThread::AUDIO_ENCODER:
73 return audio_encode_thread_proxy_->RunsTasksOnCurrentThread(); 68 return audio_encode_thread_proxy_->RunsTasksOnCurrentThread();
74 case CastThread::AUDIO_DECODER: 69 case CastThread::AUDIO_DECODER:
75 return audio_decode_thread_proxy_->RunsTasksOnCurrentThread(); 70 return audio_decode_thread_proxy_->RunsTasksOnCurrentThread();
76 case CastThread::VIDEO_ENCODER: 71 case CastThread::VIDEO_ENCODER:
77 return video_encode_thread_proxy_->RunsTasksOnCurrentThread(); 72 return video_encode_thread_proxy_->RunsTasksOnCurrentThread();
78 case CastThread::VIDEO_DECODER: 73 case CastThread::VIDEO_DECODER:
79 return video_decode_thread_proxy_->RunsTasksOnCurrentThread(); 74 return video_decode_thread_proxy_->RunsTasksOnCurrentThread();
80 default: 75 default:
81 CHECK(false) << "Wrong thread identifier"; 76 DCHECK(false) << "Wrong thread identifier";
82 return false;
83 } 77 }
84 } 78 }
85 79
86 } // namespace cast 80 } // namespace cast
87 } // namespace media 81 } // namespace media
OLDNEW
« no previous file with comments | « trunk/src/media/cast/cast_thread.h ('k') | trunk/src/media/cast/congestion_control/congestion_control.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698