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

Unified Diff: content/renderer/media/user_media_client_impl.h

Issue 2380793002: Migrate MediaDevices.enumerateDevices to Mojo (Closed)
Patch Set: rebase Created 4 years, 2 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/renderer/media/user_media_client_impl.h
diff --git a/content/renderer/media/user_media_client_impl.h b/content/renderer/media/user_media_client_impl.h
index 02c9ef1ecaa84e0ac6d65bea9d7667fa9cbb02b2..111c932931bc734534897fdadc7405fc8aecedfb 100644
--- a/content/renderer/media/user_media_client_impl.h
+++ b/content/renderer/media/user_media_client_impl.h
@@ -16,9 +16,12 @@
#include "base/memory/weak_ptr.h"
#include "base/threading/non_thread_safe.h"
#include "content/common/content_export.h"
+#include "content/common/media/media_devices.h"
+#include "content/common/media/media_devices.mojom.h"
#include "content/public/renderer/render_frame_observer.h"
#include "content/renderer/media/media_stream_dispatcher_eventhandler.h"
#include "content/renderer/media/media_stream_source.h"
+#include "services/shell/public/cpp/interface_provider.h"
#include "third_party/WebKit/public/platform/WebMediaStream.h"
#include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
#include "third_party/WebKit/public/platform/WebSourceInfo.h"
@@ -89,6 +92,9 @@ class CONTENT_EXPORT UserMediaClientImpl
// RenderFrameObserver override
void WillCommitProvisionalLoad() override;
+ void SetMediaDevicesDispatcherForTesting(
+ ::mojom::MediaDevicesDispatcherHostPtr media_devices_dispatcher);
+
protected:
// Called when |source| has been stopped from JavaScript.
void OnLocalSourceStopped(const blink::WebMediaStreamSource& source);
@@ -190,8 +196,6 @@ class CONTENT_EXPORT UserMediaClientImpl
private:
typedef std::vector<blink::WebMediaStreamSource> LocalStreamSources;
- struct MediaDevicesRequestInfo;
- typedef ScopedVector<MediaDevicesRequestInfo> MediaDevicesRequests;
// RenderFrameObserver implementation.
void OnDestruct() override;
@@ -227,16 +231,14 @@ class CONTENT_EXPORT UserMediaClientImpl
const StreamDeviceInfoArray& audio_array,
const StreamDeviceInfoArray& video_array);
- void FinalizeEnumerateDevices(MediaDevicesRequestInfo* request);
- void FinalizeEnumerateSources(MediaDevicesRequestInfo* request);
+ using EnumerationResult = std::vector<std::vector<MediaDeviceInfo>>;
+ void FinalizeEnumerateDevices(blink::WebMediaDevicesRequest request,
+ const EnumerationResult& result);
+ void FinalizeGetSources(blink::WebMediaStreamTrackSourcesRequest request,
+ const EnumerationResult& result);
void DeleteAllUserMediaRequests();
- MediaDevicesRequestInfo* FindMediaDevicesRequestInfo(int request_id);
- MediaDevicesRequestInfo* FindMediaDevicesRequestInfo(
- const blink::WebMediaDevicesRequest& request);
- void CancelAndDeleteMediaDevicesRequest(MediaDevicesRequestInfo* request);
-
// Returns the source that use a device with |device.session_id|
// and |device.device.id|. NULL if such source doesn't exist.
const blink::WebMediaStreamSource* FindLocalSource(
@@ -249,6 +251,8 @@ class CONTENT_EXPORT UserMediaClientImpl
void StopLocalSource(const blink::WebMediaStreamSource& source,
bool notify_dispatcher);
+ const ::mojom::MediaDevicesDispatcherHostPtr& GetMediaDevicesDispatcher();
+
// Weak ref to a PeerConnectionDependencyFactory, owned by the RenderThread.
// It's valid for the lifetime of RenderThread.
// TODO(xians): Remove this dependency once audio do not need it for local
@@ -259,13 +263,12 @@ class CONTENT_EXPORT UserMediaClientImpl
// (or RenderFrameObserver) to ensure tear-down occurs in the right order.
const std::unique_ptr<MediaStreamDispatcher> media_stream_dispatcher_;
+ ::mojom::MediaDevicesDispatcherHostPtr media_devices_dispatcher_;
+
LocalStreamSources local_sources_;
UserMediaRequests user_media_requests_;
- // Requests to enumerate media devices.
- MediaDevicesRequests media_devices_requests_;
-
blink::WebMediaDeviceChangeObserver media_device_change_observer_;
// Note: This member must be the last to ensure all outstanding weak pointers
« no previous file with comments | « content/renderer/media/mock_media_stream_dispatcher.cc ('k') | content/renderer/media/user_media_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698