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

Side by Side Diff: content/browser/renderer_host/media/video_capture_host.cc

Issue 2824193002: Enable use_once_callback for //content/common/*.mojom (Closed)
Patch Set: rebase Created 3 years, 8 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
OLDNEW
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/browser/renderer_host/media/video_capture_host.h" 5 #include "content/browser/renderer_host/media/video_capture_host.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 const base::WeakPtr<VideoCaptureController>& controller = it->second; 227 const base::WeakPtr<VideoCaptureController>& controller = it->second;
228 if (controller) { 228 if (controller) {
229 controller->ReturnBuffer(controller_id, this, buffer_id, 229 controller->ReturnBuffer(controller_id, this, buffer_id,
230 consumer_resource_utilization); 230 consumer_resource_utilization);
231 } 231 }
232 } 232 }
233 233
234 void VideoCaptureHost::GetDeviceSupportedFormats( 234 void VideoCaptureHost::GetDeviceSupportedFormats(
235 int32_t device_id, 235 int32_t device_id,
236 int32_t session_id, 236 int32_t session_id,
237 const GetDeviceSupportedFormatsCallback& callback) { 237 GetDeviceSupportedFormatsCallback callback) {
238 DVLOG(1) << __func__ << " " << device_id; 238 DVLOG(1) << __func__ << " " << device_id;
239 DCHECK_CURRENTLY_ON(BrowserThread::IO); 239 DCHECK_CURRENTLY_ON(BrowserThread::IO);
240 media::VideoCaptureFormats supported_formats; 240 media::VideoCaptureFormats supported_formats;
241 if (!media_stream_manager_->video_capture_manager() 241 if (!media_stream_manager_->video_capture_manager()
242 ->GetDeviceSupportedFormats(session_id, &supported_formats)) { 242 ->GetDeviceSupportedFormats(session_id, &supported_formats)) {
243 DLOG(WARNING) << "Could not retrieve device supported formats"; 243 DLOG(WARNING) << "Could not retrieve device supported formats";
244 } 244 }
245 callback.Run(supported_formats); 245 std::move(callback).Run(supported_formats);
246 } 246 }
247 247
248 void VideoCaptureHost::GetDeviceFormatsInUse( 248 void VideoCaptureHost::GetDeviceFormatsInUse(
249 int32_t device_id, 249 int32_t device_id,
250 int32_t session_id, 250 int32_t session_id,
251 const GetDeviceFormatsInUseCallback& callback) { 251 GetDeviceFormatsInUseCallback callback) {
252 DVLOG(1) << __func__ << " " << device_id; 252 DVLOG(1) << __func__ << " " << device_id;
253 DCHECK_CURRENTLY_ON(BrowserThread::IO); 253 DCHECK_CURRENTLY_ON(BrowserThread::IO);
254 media::VideoCaptureFormats formats_in_use; 254 media::VideoCaptureFormats formats_in_use;
255 if (!media_stream_manager_->video_capture_manager()->GetDeviceFormatsInUse( 255 if (!media_stream_manager_->video_capture_manager()->GetDeviceFormatsInUse(
256 session_id, &formats_in_use)) { 256 session_id, &formats_in_use)) {
257 DLOG(WARNING) << "Could not retrieve device format(s) in use"; 257 DLOG(WARNING) << "Could not retrieve device format(s) in use";
258 } 258 }
259 callback.Run(formats_in_use); 259 std::move(callback).Run(formats_in_use);
260 } 260 }
261 261
262 void VideoCaptureHost::DoError(VideoCaptureControllerID controller_id) { 262 void VideoCaptureHost::DoError(VideoCaptureControllerID controller_id) {
263 DVLOG(1) << __func__; 263 DVLOG(1) << __func__;
264 DCHECK_CURRENTLY_ON(BrowserThread::IO); 264 DCHECK_CURRENTLY_ON(BrowserThread::IO);
265 if (controllers_.find(controller_id) == controllers_.end()) 265 if (controllers_.find(controller_id) == controllers_.end())
266 return; 266 return;
267 267
268 if (base::ContainsKey(device_id_to_observer_map_, controller_id)) { 268 if (base::ContainsKey(device_id_to_observer_map_, controller_id)) {
269 device_id_to_observer_map_[controller_id]->OnStateChanged( 269 device_id_to_observer_map_[controller_id]->OnStateChanged(
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 const base::WeakPtr<VideoCaptureController> controller = it->second; 325 const base::WeakPtr<VideoCaptureController> controller = it->second;
326 controllers_.erase(it); 326 controllers_.erase(it);
327 if (!controller) 327 if (!controller)
328 return; 328 return;
329 329
330 media_stream_manager_->video_capture_manager()->DisconnectClient( 330 media_stream_manager_->video_capture_manager()->DisconnectClient(
331 controller.get(), controller_id, this, on_error); 331 controller.get(), controller_id, this, on_error);
332 } 332 }
333 333
334 } // namespace content 334 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/video_capture_host.h ('k') | content/browser/renderer_host/render_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698