WebRTC: Add support for Promise-based MediaDevices.getUserMedia()
authoradam.bergkvist@ericsson.com <adam.bergkvist@ericsson.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Apr 2015 17:37:20 +0000 (17:37 +0000)
committeradam.bergkvist@ericsson.com <adam.bergkvist@ericsson.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Apr 2015 17:37:20 +0000 (17:37 +0000)
commit9918f5ca414d76c7c5a301c4d590097418f6527b
tree8a597e8bfe09530f1ce849d44919a8780432008f
parent20f2187cb2056fbb350cdcc17b8f6025b0e45b29
WebRTC: Add support for Promise-based MediaDevices.getUserMedia()
https://bugs.webkit.org/show_bug.cgi?id=143255

Reviewed by Eric Carlson.

Source/WebCore:

The MediaDevices object collects functionality related to local media
devices. This patch adds the Promise-based version of getUserMedia()
(unprefixed). Other functionality, like enumerateDevices(), will be
added in later patches.

The old callback-based webkitGetUserMedia() (on Navigator) is kept for
legacy purposes (according to the Media Capture and Streams API spec [1]).
Both versions of getUserMedia are backed up by UserMediaRequest where
the callbacks from the callback-based version are wrapped inside c++
lambda functions. The new Promise-based getUserMedia() uses the lambda
functions directly as created by the Promise bindings.

[1] http://w3c.github.io/mediacapture-main/archives/20150324/getusermedia.html#navigatorusermedia-interface-extensions

Test: fast/mediastream/MediaDevices-getUserMedia.html

* CMakeLists.txt:
* DerivedSources.make:
* Modules/mediastream/MediaDevices.cpp: Added.
(WebCore::MediaDevices::create):
(WebCore::MediaDevices::MediaDevices):
(WebCore::MediaDevices::~MediaDevices):
(WebCore::MediaDevices::document):
(WebCore::MediaDevices::getUserMedia):
* Modules/mediastream/MediaDevices.h: Added.
* Modules/mediastream/MediaDevices.idl: Added.
* Modules/mediastream/NavigatorMediaDevices.cpp: Added.
(WebCore::NavigatorMediaDevices::NavigatorMediaDevices):
(WebCore::NavigatorMediaDevices::~NavigatorMediaDevices):
(WebCore::NavigatorMediaDevices::from):
(WebCore::NavigatorMediaDevices::mediaDevices):
(WebCore::NavigatorMediaDevices::supplementName):
* Modules/mediastream/NavigatorMediaDevices.h: Added.
* Modules/mediastream/NavigatorMediaDevices.idl: Added.
* Modules/mediastream/UserMediaRequest.cpp:
(WebCore::UserMediaRequest::create):
(WebCore::UserMediaRequest::UserMediaRequest):
(WebCore::UserMediaRequest::didCreateStream):
(WebCore::UserMediaRequest::failedToCreateStreamWithConstraintsError):
(WebCore::UserMediaRequest::failedToCreateStreamWithPermissionError):
* Modules/mediastream/UserMediaRequest.h:
* PlatformGTK.cmake:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSMediaDevicesCustom.cpp: Added.
(WebCore::JSMediaDevices::getUserMedia):

LayoutTests:

Added test for new Promise-based getUserMedia() (on MediaDevices).

* fast/dom/navigator-detached-no-crash.html:
* fast/mediastream/MediaDevices-getUserMedia-expected.txt: Added.
* fast/mediastream/MediaDevices-getUserMedia.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@182275 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/navigator-detached-no-crash.html
LayoutTests/fast/mediastream/MediaDevices-getUserMedia-expected.txt [new file with mode: 0644]
LayoutTests/fast/mediastream/MediaDevices-getUserMedia.html [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/Modules/mediastream/MediaDevices.cpp [new file with mode: 0644]
Source/WebCore/Modules/mediastream/MediaDevices.h [new file with mode: 0644]
Source/WebCore/Modules/mediastream/MediaDevices.idl [new file with mode: 0644]
Source/WebCore/Modules/mediastream/NavigatorMediaDevices.cpp [new file with mode: 0644]
Source/WebCore/Modules/mediastream/NavigatorMediaDevices.h [new file with mode: 0644]
Source/WebCore/Modules/mediastream/NavigatorMediaDevices.idl [new file with mode: 0644]
Source/WebCore/Modules/mediastream/UserMediaRequest.cpp
Source/WebCore/Modules/mediastream/UserMediaRequest.h
Source/WebCore/PlatformGTK.cmake
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSMediaDevicesCustom.cpp [new file with mode: 0644]