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

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

Issue 1083883003: Move BindToCurrentLoop from media/base/ to base/ Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix media/base/callback_holder.h compile Created 5 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_manager.h" 5 #include "content/browser/renderer_host/media/video_capture_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/bind_to_current_loop.h"
12 #include "base/logging.h" 13 #include "base/logging.h"
13 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
14 #include "base/metrics/histogram_macros.h" 15 #include "base/metrics/histogram_macros.h"
15 #include "base/stl_util.h" 16 #include "base/stl_util.h"
16 #include "base/task_runner_util.h" 17 #include "base/task_runner_util.h"
17 #include "base/threading/sequenced_worker_pool.h" 18 #include "base/threading/sequenced_worker_pool.h"
18 #include "content/browser/media/capture/web_contents_video_capture_device.h" 19 #include "content/browser/media/capture/web_contents_video_capture_device.h"
19 #include "content/browser/media/media_internals.h" 20 #include "content/browser/media/media_internals.h"
20 #include "content/browser/renderer_host/media/video_capture_controller.h" 21 #include "content/browser/renderer_host/media/video_capture_controller.h"
21 #include "content/browser/renderer_host/media/video_capture_controller_event_han dler.h" 22 #include "content/browser/renderer_host/media/video_capture_controller_event_han dler.h"
22 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
23 #include "content/public/browser/desktop_media_id.h" 24 #include "content/public/browser/desktop_media_id.h"
24 #include "content/public/common/media_stream_request.h" 25 #include "content/public/common/media_stream_request.h"
25 #include "media/base/bind_to_current_loop.h"
26 #include "media/video/capture/video_capture_device.h" 26 #include "media/video/capture/video_capture_device.h"
27 #include "media/video/capture/video_capture_device_factory.h" 27 #include "media/video/capture/video_capture_device_factory.h"
28 28
29 #if defined(ENABLE_SCREEN_CAPTURE) 29 #if defined(ENABLE_SCREEN_CAPTURE)
30 #include "content/browser/media/capture/desktop_capture_device.h" 30 #include "content/browser/media/capture/desktop_capture_device.h"
31 #if defined(USE_AURA) 31 #if defined(USE_AURA)
32 #include "content/browser/media/capture/desktop_capture_device_aura.h" 32 #include "content/browser/media/capture/desktop_capture_device_aura.h"
33 #endif 33 #endif
34 #endif 34 #endif
35 35
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 DCHECK(listener_); 185 DCHECK(listener_);
186 DCHECK_EQ(stream_type, MEDIA_DEVICE_VIDEO_CAPTURE); 186 DCHECK_EQ(stream_type, MEDIA_DEVICE_VIDEO_CAPTURE);
187 187
188 // Bind a callback to ConsolidateDevicesInfoOnDeviceThread() with an argument 188 // Bind a callback to ConsolidateDevicesInfoOnDeviceThread() with an argument
189 // for another callback to OnDevicesInfoEnumerated() to be run in the current 189 // for another callback to OnDevicesInfoEnumerated() to be run in the current
190 // loop, i.e. IO loop. Pass a timer for UMA histogram collection. 190 // loop, i.e. IO loop. Pass a timer for UMA histogram collection.
191 base::Callback<void(scoped_ptr<media::VideoCaptureDevice::Names>)> 191 base::Callback<void(scoped_ptr<media::VideoCaptureDevice::Names>)>
192 devices_enumerated_callback = 192 devices_enumerated_callback =
193 base::Bind(&VideoCaptureManager::ConsolidateDevicesInfoOnDeviceThread, 193 base::Bind(&VideoCaptureManager::ConsolidateDevicesInfoOnDeviceThread,
194 this, 194 this,
195 media::BindToCurrentLoop(base::Bind( 195 base::BindToCurrentLoop(base::Bind(
196 &VideoCaptureManager::OnDevicesInfoEnumerated, 196 &VideoCaptureManager::OnDevicesInfoEnumerated,
197 this, 197 this,
198 stream_type, 198 stream_type,
199 base::Owned(new base::ElapsedTimer()))), 199 base::Owned(new base::ElapsedTimer()))),
200 stream_type, 200 stream_type,
201 devices_info_cache_); 201 devices_info_cache_);
202 // OK to use base::Unretained() since we own the VCDFactory and |this| is 202 // OK to use base::Unretained() since we own the VCDFactory and |this| is
203 // bound in |devices_enumerated_callback|. 203 // bound in |devices_enumerated_callback|.
204 device_task_runner_->PostTask(FROM_HERE, 204 device_task_runner_->PostTask(FROM_HERE,
205 base::Bind(&media::VideoCaptureDeviceFactory::EnumerateDeviceNames, 205 base::Bind(&media::VideoCaptureDeviceFactory::EnumerateDeviceNames,
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 DCHECK(IsOnDeviceThread()); 857 DCHECK(IsOnDeviceThread());
858 #if defined(ENABLE_SCREEN_CAPTURE) 858 #if defined(ENABLE_SCREEN_CAPTURE)
859 DesktopCaptureDevice* desktop_device = 859 DesktopCaptureDevice* desktop_device =
860 static_cast<DesktopCaptureDevice*>(device); 860 static_cast<DesktopCaptureDevice*>(device);
861 desktop_device->SetNotificationWindowId(window_id); 861 desktop_device->SetNotificationWindowId(window_id);
862 VLOG(2) << "Screen capture notification window passed on device thread."; 862 VLOG(2) << "Screen capture notification window passed on device thread.";
863 #endif 863 #endif
864 } 864 }
865 865
866 } // namespace content 866 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698