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 #include "chromecast/browser/media/cma_message_loop.h" | 5 #include "chromecast/browser/media/cma_message_loop.h" |
6 | 6 |
7 #include "base/threading/thread.h" | 7 #include "base/threading/thread.h" |
8 | 8 |
9 namespace chromecast { | 9 namespace chromecast { |
10 namespace media { | 10 namespace media { |
11 | 11 |
12 // static | 12 // static |
13 scoped_refptr<base::MessageLoopProxy> CmaMessageLoop::GetMessageLoopProxy() { | 13 scoped_refptr<base::MessageLoopProxy> CmaMessageLoop::GetMessageLoopProxy() { |
14 return GetInstance()->thread_->message_loop_proxy(); | 14 return GetInstance()->thread_->message_loop_proxy(); |
15 } | 15 } |
16 | 16 |
17 // static | 17 // static |
| 18 scoped_refptr<base::SingleThreadTaskRunner> CmaMessageLoop::GetTaskRunner() { |
| 19 return GetInstance()->thread_->task_runner(); |
| 20 } |
| 21 |
| 22 // static |
18 CmaMessageLoop* CmaMessageLoop::GetInstance() { | 23 CmaMessageLoop* CmaMessageLoop::GetInstance() { |
19 return Singleton<CmaMessageLoop>::get(); | 24 return Singleton<CmaMessageLoop>::get(); |
20 } | 25 } |
21 | 26 |
22 CmaMessageLoop::CmaMessageLoop() | 27 CmaMessageLoop::CmaMessageLoop() |
23 : thread_(new base::Thread("CmaThread")) { | 28 : thread_(new base::Thread("CmaThread")) { |
24 thread_->Start(); | 29 thread_->Start(); |
25 } | 30 } |
26 | 31 |
27 CmaMessageLoop::~CmaMessageLoop() { | 32 CmaMessageLoop::~CmaMessageLoop() { |
28 // This will automatically shutdown the thread. | 33 // This will automatically shutdown the thread. |
29 } | 34 } |
30 | 35 |
31 } // namespace media | 36 } // namespace media |
32 } // namespace chromecast | 37 } // namespace chromecast |
OLD | NEW |