OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/media/video_capture_impl_manager.h" | 5 #include "content/renderer/media/video_capture_impl_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "content/renderer/media/video_capture_impl.h" | 9 #include "content/renderer/media/video_capture_impl.h" |
10 #include "content/renderer/media/video_capture_message_filter.h" | 10 #include "content/renderer/media/video_capture_message_filter.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 VideoCaptureImplManager::VideoCaptureImplManager() | 14 VideoCaptureImplManager::VideoCaptureImplManager() |
15 : thread_("VC manager") { | 15 : thread_("VC manager") { |
16 thread_.Start(); | 16 thread_.Start(); |
17 message_loop_proxy_ = thread_.message_loop_proxy(); | 17 message_loop_proxy_ = thread_.message_loop_proxy(); |
18 filter_ = new VideoCaptureMessageFilter(); | 18 filter_ = new VideoCaptureMessageFilter(); |
19 } | 19 } |
20 | 20 |
21 media::VideoCapture* VideoCaptureImplManager::AddDevice( | 21 media::VideoCapture* VideoCaptureImplManager::AddDevice( |
22 media::VideoCaptureSessionId id, | 22 media::VideoCaptureSessionId id, |
23 media::VideoCapture::EventHandler* handler) { | 23 media::VideoCapture::EventHandler* handler) { |
24 DCHECK(handler); | 24 DCHECK(handler); |
25 | 25 |
26 base::AutoLock auto_lock(lock_); | 26 base::AutoLock auto_lock(lock_); |
27 Devices::iterator it = devices_.find(id); | 27 Devices::iterator it = devices_.find(id); |
28 if (it == devices_.end()) { | 28 if (it == devices_.end()) { |
29 VideoCaptureImpl* vc = | 29 VideoCaptureImpl* vc = |
30 new VideoCaptureImpl(id, message_loop_proxy_, filter_); | 30 new VideoCaptureImpl(id, message_loop_proxy_.get(), filter_.get()); |
31 devices_[id] = new Device(vc, handler); | 31 devices_[id] = new Device(vc, handler); |
32 vc->Init(); | 32 vc->Init(); |
33 return vc; | 33 return vc; |
34 } | 34 } |
35 | 35 |
36 devices_[id]->clients.push_front(handler); | 36 devices_[id]->clients.push_front(handler); |
37 return it->second->vc; | 37 return it->second->vc; |
38 } | 38 } |
39 | 39 |
40 void VideoCaptureImplManager::SuspendDevices(bool suspend) { | 40 void VideoCaptureImplManager::SuspendDevices(bool suspend) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 VideoCaptureImplManager::Device::Device( | 79 VideoCaptureImplManager::Device::Device( |
80 VideoCaptureImpl* device, | 80 VideoCaptureImpl* device, |
81 media::VideoCapture::EventHandler* handler) | 81 media::VideoCapture::EventHandler* handler) |
82 : vc(device) { | 82 : vc(device) { |
83 clients.push_front(handler); | 83 clients.push_front(handler); |
84 } | 84 } |
85 | 85 |
86 VideoCaptureImplManager::Device::~Device() {} | 86 VideoCaptureImplManager::Device::~Device() {} |
87 | 87 |
88 } // namespace content | 88 } // namespace content |
OLD | NEW |