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

Unified Diff: content/browser/renderer_host/media/video_capture_manager.h

Issue 2193213003: ImageCapture: Queue up requests while device not ready (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/video_capture_manager.h
diff --git a/content/browser/renderer_host/media/video_capture_manager.h b/content/browser/renderer_host/media/video_capture_manager.h
index 20be47fc6978e4da627e0388d2ce9385dac02cd3..467efa8dcac821eb97c99158bca9e8e61b9af545 100644
--- a/content/browser/renderer_host/media/video_capture_manager.h
+++ b/content/browser/renderer_host/media/video_capture_manager.h
@@ -165,6 +165,7 @@ class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider {
VideoCaptureDevice::SetPhotoOptionsCallback callback);
void TakePhoto(int session_id,
VideoCaptureDevice::TakePhotoCallback callback);
+
#if defined(OS_ANDROID)
// Some devices had troubles when stopped and restarted quickly, so the device
// is only stopped when Chrome is sent to background and not when, e.g., a tab
@@ -211,13 +212,10 @@ class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider {
// may be freed by this function.
void DestroyDeviceEntryIfNoClients(DeviceEntry* entry);
- // Retrieve the VideoCaptureDevice associated to |session_id|, or nullptr
- // if not found.
- VideoCaptureDevice* GetVideoCaptureDeviceBySessionId(int session_id);
-
- // Finds a DeviceEntry in different ways: by its |device_id| and |type| (if it
- // is already opened), by its |controller| or by its |serial_id|. In all
- // cases, if not found, nullptr is returned.
+ // Finds a DeviceEntry in different ways: by |session_id|, by its |device_id|
+ // and |type| (if it is already opened), by its |controller| or by its
+ // |serial_id|. In all cases, if not found, nullptr is returned.
+ DeviceEntry* GetDeviceEntryBySessionId(int session_id);
DeviceEntry* GetDeviceEntryByTypeAndId(MediaStreamType type,
const std::string& device_id) const;
DeviceEntry* GetDeviceEntryByController(
@@ -275,6 +273,17 @@ class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider {
media::VideoCaptureDevice* device,
gfx::NativeViewId window_id);
+ // Internal versions of the Image Capture public ones, for delayed execution.
+ void DoGetPhotoCapabilities(
+ VideoCaptureDevice::GetPhotoCapabilitiesCallback callback,
+ VideoCaptureDevice* device);
+ void DoSetPhotoOptions(
+ VideoCaptureDevice::SetPhotoOptionsCallback callback,
+ media::mojom::PhotoSettingsPtr settings,
+ VideoCaptureDevice* device);
+ void DoTakePhoto(VideoCaptureDevice::TakePhotoCallback callback,
+ VideoCaptureDevice* device);
+
#if defined(OS_MACOSX)
// Called on the IO thread after the device layer has been initialized on Mac.
// Sets |capture_device_api_initialized_| to true and then executes and_then.
@@ -324,6 +333,10 @@ class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider {
DeviceStartQueue device_start_queue_;
+ // Queue to keep photo-associated requests waiting for a device to initialize.
emircan 2016/08/03 21:55:54 Comment on what the pair is made of.
mcasas 2016/08/03 22:19:36 Done.
+ std::list<std::pair<int, base::Callback<void(media::VideoCaptureDevice*)>>>
+ photo_request_queue_;
+
// Device creation factory injected on construction from MediaStreamManager or
// from the test harness.
std::unique_ptr<media::VideoCaptureDeviceFactory>

Powered by Google App Engine
This is Rietveld 408576698