| 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 // Implementation notes about interactions with VideoCaptureImpl. | 5 // Implementation notes about interactions with VideoCaptureImpl. | 
| 6 // | 6 // | 
| 7 // How is VideoCaptureImpl used: | 7 // How is VideoCaptureImpl used: | 
| 8 // | 8 // | 
| 9 // VideoCaptureImpl is an IO thread object while VideoCaptureImplManager | 9 // VideoCaptureImpl is an IO thread object while VideoCaptureImplManager | 
| 10 // lives only on the render thread. It is only possible to access an | 10 // lives only on the render thread. It is only possible to access an | 
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 89   const int client_id = ++next_client_id_; | 89   const int client_id = ++next_client_id_; | 
| 90 | 90 | 
| 91   ChildProcess::current()->io_task_runner()->PostTask( | 91   ChildProcess::current()->io_task_runner()->PostTask( | 
| 92       FROM_HERE, | 92       FROM_HERE, | 
| 93       base::Bind(&VideoCaptureImpl::StartCapture, base::Unretained(impl), | 93       base::Bind(&VideoCaptureImpl::StartCapture, base::Unretained(impl), | 
| 94                  client_id, params, state_update_cb, deliver_frame_cb)); | 94                  client_id, params, state_update_cb, deliver_frame_cb)); | 
| 95   return base::Bind(&VideoCaptureImplManager::StopCapture, | 95   return base::Bind(&VideoCaptureImplManager::StopCapture, | 
| 96                     weak_factory_.GetWeakPtr(), client_id, id); | 96                     weak_factory_.GetWeakPtr(), client_id, id); | 
| 97 } | 97 } | 
| 98 | 98 | 
|  | 99 void VideoCaptureImplManager::RequestRefreshFrame( | 
|  | 100     media::VideoCaptureSessionId id) { | 
|  | 101   DCHECK(render_main_task_runner_->BelongsToCurrentThread()); | 
|  | 102   const VideoCaptureDeviceMap::const_iterator it = devices_.find(id); | 
|  | 103   DCHECK(it != devices_.end()); | 
|  | 104   VideoCaptureImpl* const impl = it->second.second; | 
|  | 105   ChildProcess::current()->io_task_runner()->PostTask( | 
|  | 106       FROM_HERE, | 
|  | 107       base::Bind(&VideoCaptureImpl::RequestRefreshFrame, | 
|  | 108                  base::Unretained(impl))); | 
|  | 109 } | 
|  | 110 | 
|  | 111 | 
| 99 void VideoCaptureImplManager::GetDeviceSupportedFormats( | 112 void VideoCaptureImplManager::GetDeviceSupportedFormats( | 
| 100     media::VideoCaptureSessionId id, | 113     media::VideoCaptureSessionId id, | 
| 101     const VideoCaptureDeviceFormatsCB& callback) { | 114     const VideoCaptureDeviceFormatsCB& callback) { | 
| 102   DCHECK(render_main_task_runner_->BelongsToCurrentThread()); | 115   DCHECK(render_main_task_runner_->BelongsToCurrentThread()); | 
| 103   const VideoCaptureDeviceMap::const_iterator it = devices_.find(id); | 116   const VideoCaptureDeviceMap::const_iterator it = devices_.find(id); | 
| 104   DCHECK(it != devices_.end()); | 117   DCHECK(it != devices_.end()); | 
| 105   VideoCaptureImpl* const impl = it->second.second; | 118   VideoCaptureImpl* const impl = it->second.second; | 
| 106   ChildProcess::current()->io_task_runner()->PostTask( | 119   ChildProcess::current()->io_task_runner()->PostTask( | 
| 107       FROM_HERE, base::Bind(&VideoCaptureImpl::GetDeviceSupportedFormats, | 120       FROM_HERE, base::Bind(&VideoCaptureImpl::GetDeviceSupportedFormats, | 
| 108                             base::Unretained(impl), callback)); | 121                             base::Unretained(impl), callback)); | 
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 161   DCHECK(render_main_task_runner_->BelongsToCurrentThread()); | 174   DCHECK(render_main_task_runner_->BelongsToCurrentThread()); | 
| 162   for (const auto& device : devices_) { | 175   for (const auto& device : devices_) { | 
| 163     VideoCaptureImpl* const impl = device.second.second; | 176     VideoCaptureImpl* const impl = device.second.second; | 
| 164     ChildProcess::current()->io_task_runner()->PostTask( | 177     ChildProcess::current()->io_task_runner()->PostTask( | 
| 165         FROM_HERE, base::Bind(&VideoCaptureImpl::SuspendCapture, | 178         FROM_HERE, base::Bind(&VideoCaptureImpl::SuspendCapture, | 
| 166                               base::Unretained(impl), suspend)); | 179                               base::Unretained(impl), suspend)); | 
| 167   } | 180   } | 
| 168 } | 181 } | 
| 169 | 182 | 
| 170 }  // namespace content | 183 }  // namespace content | 
| OLD | NEW | 
|---|