Changeset 209864 in webkit
- Timestamp:
- Dec 15, 2016 9:25:53 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 2 deleted
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r209861 r209864 1 2016-12-15 Darin Adler <darin@apple.com> 2 3 Remove custom binding for MediaDevices 4 https://bugs.webkit.org/show_bug.cgi?id=165894 5 6 Reviewed by Eric Carlson. 7 8 * fast/mediastream/MediaDevices-getUserMedia-expected.txt: Expect the exception the 9 generated bindings code throws, rather than the different one the hand-written binding 10 was throwing before. 11 1 12 2016-12-15 Youenn Fablet <youennf@gmail.com> 2 13 -
trunk/LayoutTests/fast/mediastream/MediaDevices-getUserMedia-expected.txt
r209082 r209864 6 6 PASS typeof navigator.mediaDevices.webkitGetUserMedia is 'undefined' 7 7 PASS navigator.mediaDevices.getUserMedia({audio:true}).then(gotStream1); did not throw exception. 8 PASS navigator.mediaDevices.getUserMedia() rejected with error: TypeError: Not enough arguments8 PASS navigator.mediaDevices.getUserMedia() rejected with error: TypeError: Type error 9 9 PASS navigator.mediaDevices.getUserMedia({}) rejected with error: TypeError: Type error 10 10 PASS navigator.mediaDevices.getUserMedia.apply(undefined) rejected with error: TypeError: Can only call MediaDevices.getUserMedia on instances of MediaDevices -
trunk/Source/WebCore/CMakeLists.txt
r209856 r209864 220 220 Modules/mediastream/MediaStreamTrack.idl 221 221 Modules/mediastream/MediaStreamTrackEvent.idl 222 Modules/mediastream/MediaTrackConstraints.idl 222 223 Modules/mediastream/MediaTrackSupportedConstraints.idl 223 224 Modules/mediastream/NavigatorMediaDevices.idl … … 908 909 Modules/mediastream/MediaStreamTrack.cpp 909 910 Modules/mediastream/MediaStreamTrackEvent.cpp 911 Modules/mediastream/MediaTrackConstraints.cpp 910 912 Modules/mediastream/NavigatorMediaDevices.cpp 911 913 Modules/mediastream/PeerConnectionBackend.cpp … … 1163 1165 bindings/js/JSLocationCustom.cpp 1164 1166 bindings/js/JSMainThreadExecState.cpp 1165 bindings/js/JSMediaDevicesCustom.cpp1166 1167 bindings/js/JSMediaKeySessionCustom.cpp 1167 1168 bindings/js/JSMediaKeySystemAccessCustom.cpp -
trunk/Source/WebCore/ChangeLog
r209862 r209864 1 2016-12-15 Darin Adler <darin@apple.com> 2 3 Remove custom binding for MediaDevices 4 https://bugs.webkit.org/show_bug.cgi?id=165894 5 6 Reviewed by Eric Carlson. 7 8 Removes the explicit code to parse the MediaStreamConstraints and 9 MediaTrackConstraints. Next step could be to change the internal 10 code to use the structs from bindings directly so we don't need 11 code to convert to an internal format. 12 13 * CMakeLists.txt: Added MediaTrackConstraints.idl and MediaTrackConstraints.cpp, 14 removed JSMediaDevicesCustom.cpp. 15 16 * DerivedSources.make: Added MediaTrackConstraints.idl. 17 Also sorted list of IDL files and fixed use of tabs. 18 19 * Modules/mediastream/MediaDevices.cpp: 20 (WebCore::createMediaConstraintsImpl): Added. 21 (WebCore::MediaDevices::getUserMedia): Changed this function to take arguments that 22 are generated by the bindings script, and call createMediaConstraintsImpl to convert 23 into the internal data structure. 24 * Modules/mediastream/MediaDevices.h: Added StreamConstraints struct and changed 25 getUserMedia to take that as specified in the IDL. 26 * Modules/mediastream/MediaDevices.idl: Added definition of the MediaStreamConstraints 27 dictionary. Removed [Custom] from getUserMedia. 28 29 * Modules/mediastream/MediaStream.cpp: 30 (WebCore::MediaStream::MediaStream): Pass a reference to addObserver. 31 (WebCore::MediaStream::~MediaStream): Pass a rference to removeObserver. 32 (WebCore::MediaStream::internalAddTrack): Ditto. 33 (WebCore::MediaStream::internalRemoveTrack): Ditto. 34 35 * Modules/mediastream/MediaStreamTrack.cpp: 36 (WebCore::createMediaConstraintsImpl): Added. 37 (WebCore::MediaStreamTrack::applyConstraints): Changed to take an optional 38 MediaTrackConstraints argument and call createMediaConstraintsImpl to convert 39 into the internal data structure. Also merged the multiple overloads of this 40 all into a single function, used auto to make the code easier to read, and 41 moved the code that stores new constrains into the success handling, since the 42 specification says that's the only case where we should store it. 43 (WebCore::MediaStreamTrack::addObserver): Take a reference instead of a pointer. 44 (WebCore::MediaStreamTrack::removeObserver): Ditto. 45 * Modules/mediastream/MediaStreamTrack.h: Removed many unneeded includes. 46 Changed getConstraints to return const MediaTrackConstraints&, applyConstraints 47 to take an optional MediaTrackConstraints, add/removeObserver to take a reference 48 rather than a pointer, and changed m_constraints to be a MediaTrackConstraints 49 instead of a RefPtr<MediaConstraints>. 50 * Modules/mediastream/MediaStreamTrack.idl: Removed [Custom] from getConstraints 51 and applyConstraints. 52 53 * Modules/mediastream/MediaTrackConstraints.cpp: Added. 54 (WebCore::set): Overloaded function to set constriaints in a 55 MediaTrackConstraintSetMap. 56 (WebCore::convertToInternalForm): Helper function that takes a 57 MediaTrackConstraintSet and turns it into a MediaTrackConstraintSetMap. 58 (WebCore::convertAdvancedToInternalForm): More of the same, but for vectors. 59 (WebCore::createMediaConstraintsImpl): Top level function. Calls the other 60 functions and then MediaConstraintsImpl::create. 61 * Modules/mediastream/MediaTrackConstraints.h: Added. Contains all the structures 62 and type definitions for the dictionaries defined in the IDL file, and also the 63 createMediaConstraintsImpl function declaration. 64 * Modules/mediastream/MediaTrackConstraints.idl: Added. Contains the 65 MediaTrackConstraints and all the other dictionaries and typedefs that are needed 66 to define that dictionary. 67 * Modules/mediastream/UserMediaRequest.cpp: 68 (WebCore::UserMediaRequest::start): Changed to not depend on MediaDevices::Promise. 69 (WebCore::UserMediaRequest::UserMediaRequest): Ditto. 70 (WebCore::isSecure): Rearranged to be easier to understand. 71 (WebCore::UserMediaRequest::start): Removed a local variable for simplicity. 72 (WebCore::UserMediaRequest::document): Removed a redundant null check. 73 * Modules/mediastream/UserMediaRequest.h: Reduced includes, changed to not depend 74 on MediaDevices::Promise, removing the reason to include MediaDevices.h. 75 76 * WebCore.xcodeproj/project.pbxproj: Updated to remove old files and add new ones. 77 78 * bindings/js/JSBindingsAllInOne.cpp: Removed JSMediaDevicesCustom.cpp. 79 80 * bindings/js/JSMediaDevicesCustom.cpp: Removed. 81 * bindings/js/JSMediaDevicesCustom.h: Removed. 82 83 * bindings/js/JSMediaStreamTrackCustom.cpp: 84 (WebCore::JSMediaStreamTrack::applyConstraints): Deleted. 85 (WebCore::JSMediaStreamTrack::getConstraints): Deleted. 86 87 * bindings/scripts/CodeGenerator.pm: 88 (ProcessDocument): Updated to allow multiple standalone dictionaries, as long as 89 the name of one of the dictionaries matches the name of the file. 90 91 * bindings/scripts/CodeGeneratorJS.pm: 92 (GenerateDictionary): Added "other dictionaries" argument so we can support 93 files with multiple dictionaries in them. 94 (GenerateDictionariesHeaderContent): Completed support for dictionaries that 95 are not named after a top level interface by added one more check for a missing 96 $interface in a place that otherwise would not handle it correctly. 97 (GenerateImplementation): Removed code that set $currentCachedAttribute and 98 $cacheIndex, since no was reading the value of either any longer. 99 (GenerateDictionaryHeader): Added "other dictionaries". 100 (GenerateDictionaryImplementation): Ditto. 101 (WriteData): Removed unnnecessarily indirect code that was using FileNamePrefix 102 and a local variable named $prefix instead of just writing "JS". 103 104 * bindings/scripts/generate-bindings.pl: Corrected the use of the fileparse 105 function from the Path::Basename module; after reading the documentation for 106 this it is clear that there is no need to first call basename, and fileparse 107 should also be used instead of basename. 108 109 * platform/mediastream/MediaConstraints.h: Removed unneeded includes. 110 (WebCore::StringConstraint::appendExact): Removed an incorrect use of clear 111 here that would mess up cases where there is supposed to be more than one 112 exact value. 113 114 * platform/mediastream/MediaStreamTrackPrivate.cpp: Remvoed unneeded includes. 115 (WebCore::MediaStreamTrackPrivate::clone): Removed code to copy m_constraints. 116 (WebCore::MediaStreamTrackPrivate::constraints): Deleted. 117 * platform/mediastream/MediaStreamTrackPrivate.h: Removed the constraints 118 function member and the m_constraints data member. 119 1 120 2016-12-15 Dave Hyatt <hyatt@apple.com> 2 121 -
trunk/Source/WebCore/DerivedSources.make
r209805 r209864 153 153 $(WebCore)/Modules/mediastream/MediaStreamTrack.idl \ 154 154 $(WebCore)/Modules/mediastream/MediaStreamTrackEvent.idl \ 155 $(WebCore)/Modules/mediastream/MediaTrackConstraints.idl \ 155 156 $(WebCore)/Modules/mediastream/MediaTrackSupportedConstraints.idl \ 156 157 $(WebCore)/Modules/mediastream/NavigatorMediaDevices.idl \ … … 255 256 $(WebCore)/crypto/CryptoKeyUsage.idl \ 256 257 $(WebCore)/crypto/JsonWebKey.idl \ 258 $(WebCore)/crypto/RsaOtherPrimesInfo.idl \ 259 $(WebCore)/crypto/SubtleCrypto.idl \ 260 $(WebCore)/crypto/WebKitSubtleCrypto.idl \ 257 261 $(WebCore)/crypto/parameters/AesCbcParams.idl \ 258 262 $(WebCore)/crypto/parameters/AesKeyGenParams.idl \ … … 262 266 $(WebCore)/crypto/parameters/RsaKeyGenParams.idl \ 263 267 $(WebCore)/crypto/parameters/RsaOaepParams.idl \ 264 $(WebCore)/crypto/RsaOtherPrimesInfo.idl \265 $(WebCore)/crypto/SubtleCrypto.idl \266 $(WebCore)/crypto/WebKitSubtleCrypto.idl \267 268 $(WebCore)/css/CSSFontFaceLoadEvent.idl \ 268 269 $(WebCore)/css/CSSFontFaceRule.idl \ … … 271 272 $(WebCore)/css/CSSKeyframesRule.idl \ 272 273 $(WebCore)/css/CSSMediaRule.idl \ 273 274 $(WebCore)/css/CSSNamespaceRule.idl \ 274 275 $(WebCore)/css/CSSPageRule.idl \ 275 276 $(WebCore)/css/CSSPrimitiveValue.idl \ … … 308 309 $(WebCore)/dom/ClientRect.idl \ 309 310 $(WebCore)/dom/ClientRectList.idl \ 311 $(WebCore)/dom/ClipboardEvent.idl \ 310 312 $(WebCore)/dom/Comment.idl \ 311 $(WebCore)/dom/ClipboardEvent.idl \312 313 $(WebCore)/dom/CompositionEvent.idl \ 313 314 $(WebCore)/dom/CustomElementRegistry.idl \ -
trunk/Source/WebCore/Modules/mediastream/MediaDevices.cpp
r208663 r209864 35 35 36 36 #include "Document.h" 37 #include "MediaConstraintsImpl.h" 37 38 #include "MediaDevicesRequest.h" 38 39 #include "MediaTrackSupportedConstraints.h" … … 57 58 } 58 59 59 ExceptionOr<void> MediaDevices::getUserMedia(Ref<MediaConstraintsImpl>&& audioConstraints, Ref<MediaConstraintsImpl>&& videoConstraints, Promise&& promise) const 60 static Ref<MediaConstraintsImpl> createMediaConstraintsImpl(const Variant<bool, MediaTrackConstraints>& constraints) 61 { 62 return WTF::switchOn(constraints, 63 [&] (bool constraints) { 64 return MediaConstraintsImpl::create({ }, { }, constraints); 65 }, 66 [&] (const MediaTrackConstraints& constraints) { 67 return createMediaConstraintsImpl(constraints); 68 } 69 ); 70 } 71 72 ExceptionOr<void> MediaDevices::getUserMedia(const StreamConstraints& constraints, Promise&& promise) const 60 73 { 61 74 auto* document = this->document(); 62 75 if (!document) 63 76 return Exception { INVALID_STATE_ERR }; 64 return UserMediaRequest::start(*document, WTFMove(audioConstraints), WTFMove(videoConstraints), WTFMove(promise));77 return UserMediaRequest::start(*document, createMediaConstraintsImpl(constraints.audio), createMediaConstraintsImpl(constraints.video), WTFMove(promise)); 65 78 } 66 79 -
trunk/Source/WebCore/Modules/mediastream/MediaDevices.h
r209390 r209864 1 1 /* 2 2 * Copyright (C) 2015 Ericsson AB. All rights reserved. 3 * Copyright (C) 2016 Apple Inc. All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 35 36 #include "ExceptionOr.h" 36 37 #include "JSDOMPromise.h" 37 #include "Media DeviceInfo.h"38 #include "MediaTrackConstraints.h" 38 39 39 40 namespace WebCore { 40 41 41 42 class Document; 42 class Media ConstraintsImpl;43 class MediaDeviceInfo; 43 44 class MediaStream; 44 45 class MediaTrackSupportedConstraints; … … 53 54 using EnumerateDevicesPromise = DOMPromise<IDLSequence<IDLInterface<MediaDeviceInfo>>>; 54 55 55 ExceptionOr<void> getUserMedia(Ref<MediaConstraintsImpl>&& audioConstraints, Ref<MediaConstraintsImpl>&& videoConstraints, Promise&&) const; 56 struct StreamConstraints { 57 Variant<bool, MediaTrackConstraints> video; 58 Variant<bool, MediaTrackConstraints> audio; 59 }; 60 ExceptionOr<void> getUserMedia(const StreamConstraints&, Promise&&) const; 56 61 void enumerateDevices(EnumerateDevicesPromise&&) const; 57 62 RefPtr<MediaTrackSupportedConstraints> getSupportedConstraints(); -
trunk/Source/WebCore/Modules/mediastream/MediaDevices.idl
r209752 r209864 30 30 31 31 [ 32 Conditional=MEDIA_STREAM, 32 33 NoInterfaceObject, 33 Conditional=MEDIA_STREAM34 34 ] interface MediaDevices { 35 35 MediaTrackSupportedConstraints getSupportedConstraints(); 36 36 37 [ Custom,MayThrowException, PrivateIdentifier, PublicIdentifier] Promise<MediaStream> getUserMedia(optional MediaStreamConstraints constraints);37 [MayThrowException, PrivateIdentifier, PublicIdentifier] Promise<MediaStream> getUserMedia(optional MediaStreamConstraints constraints); 38 38 Promise<sequence<MediaDeviceInfo>> enumerateDevices(); 39 39 }; 40 41 dictionary MediaStreamConstraints { 42 (boolean or MediaTrackConstraints) video = false; 43 (boolean or MediaTrackConstraints) audio = false; 44 }; -
trunk/Source/WebCore/Modules/mediastream/MediaStream.cpp
r208778 r209864 73 73 74 74 for (auto& track : tracks) { 75 track->addObserver( this);75 track->addObserver(*this); 76 76 m_trackSet.add(track->id(), track); 77 77 trackPrivates.append(&track->privateTrack()); … … 97 97 for (auto& trackPrivate : m_private->tracks()) { 98 98 auto track = MediaStreamTrack::create(context, *trackPrivate); 99 track->addObserver( this);99 track->addObserver(*this); 100 100 m_trackSet.add(track->id(), WTFMove(track)); 101 101 } … … 111 111 m_private->removeObserver(*this); 112 112 for (auto& track : m_trackSet.values()) 113 track->removeObserver( this);113 track->removeObserver(*this); 114 114 if (Document* document = this->document()) { 115 115 document->removeAudioProducer(this); … … 216 216 ASSERT(result.iterator->value); 217 217 auto& track = *result.iterator->value; 218 track.addObserver( this);218 track.addObserver(*this); 219 219 220 220 if (streamModifier == StreamModifier::DomAPI) … … 232 232 return false; 233 233 234 track->removeObserver( this);234 track->removeObserver(*this); 235 235 236 236 if (streamModifier == StreamModifier::DomAPI) -
trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp
r209446 r209864 159 159 } 160 160 161 void MediaStreamTrack::applyConstraints(Ref<MediaConstraints>&& constraints, DOMPromise<void>&& promise) 162 { 163 if (!constraints->isValid()) { 164 promise.reject(TypeError); 165 return; 166 } 167 168 m_constraints = WTFMove(constraints); 161 static Ref<MediaConstraintsImpl> createMediaConstraintsImpl(const std::optional<MediaTrackConstraints>& constraints) 162 { 163 if (!constraints) 164 return MediaConstraintsImpl::create({ }, { }, true); 165 return createMediaConstraintsImpl(constraints.value()); 166 } 167 168 void MediaStreamTrack::applyConstraints(const std::optional<MediaTrackConstraints>& constraints, DOMPromise<void>&& promise) 169 { 169 170 m_promise = WTFMove(promise); 170 171 171 applyConstraints(*m_constraints);172 }173 174 void MediaStreamTrack::applyConstraints(const MediaConstraints& constraints)175 {176 172 auto weakThis = createWeakPtr(); 177 std::function<void(const String&, const String&)> failureHandler = [weakThis](const String& failedConstraint, const String& message) {173 auto failureHandler = [weakThis] (const String& failedConstraint, const String& message) { 178 174 if (!weakThis || !weakThis->m_promise) 179 175 return; 180 181 176 weakThis->m_promise->rejectType<IDLInterface<OverconstrainedError>>(OverconstrainedError::create(failedConstraint, message).get()); 182 177 }; 183 184 std::function<void()> successHandler = [weakThis]() { 178 auto successHandler = [weakThis, constraints] () { 185 179 if (!weakThis || !weakThis->m_promise) 186 180 return; 187 188 181 weakThis->m_promise->resolve(); 182 weakThis->m_constraints = constraints.value_or(MediaTrackConstraints { }); 189 183 }; 190 191 m_private->applyConstraints(constraints, successHandler, failureHandler); 192 } 193 194 void MediaStreamTrack::addObserver(MediaStreamTrack::Observer* observer) 195 { 196 m_observers.append(observer); 197 } 198 199 void MediaStreamTrack::removeObserver(MediaStreamTrack::Observer* observer) 200 { 201 size_t pos = m_observers.find(observer); 202 if (pos != notFound) 203 m_observers.remove(pos); 184 m_private->applyConstraints(createMediaConstraintsImpl(constraints), successHandler, failureHandler); 185 } 186 187 void MediaStreamTrack::addObserver(Observer& observer) 188 { 189 m_observers.append(&observer); 190 } 191 192 void MediaStreamTrack::removeObserver(Observer& observer) 193 { 194 m_observers.removeFirst(&observer); 204 195 } 205 196 -
trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.h
r209446 r209864 34 34 #include "JSDOMPromise.h" 35 35 #include "MediaStreamTrackPrivate.h" 36 #include "RealtimeMediaSource.h" 37 #include "ScriptWrappable.h" 38 #include <wtf/Optional.h> 39 #include <wtf/RefPtr.h> 40 #include <wtf/Vector.h> 41 #include <wtf/WeakPtr.h> 42 #include <wtf/text/WTFString.h> 36 #include "MediaTrackConstraints.h" 43 37 44 38 namespace WebCore { … … 47 41 class MediaConstraints; 48 42 class MediaSourceSettings; 43 44 struct MediaTrackConstraints; 49 45 50 46 class MediaStreamTrack final : public RefCounted<MediaStreamTrack>, public ActiveDOMObject, public EventTargetWithInlineData, private MediaStreamTrackPrivate::Observer { … … 81 77 RefPtr<RealtimeMediaSourceCapabilities> getCapabilities() const; 82 78 83 void applyConstraints(Ref<MediaConstraints>&&, DOMPromise<void>&&);84 void applyConstraints(const MediaConstraints&);79 const MediaTrackConstraints& getConstraints() const { return m_constraints; } 80 void applyConstraints(const std::optional<MediaTrackConstraints>&, DOMPromise<void>&&); 85 81 86 82 RealtimeMediaSource& source() { return m_private->source(); } … … 89 85 AudioSourceProvider* audioSourceProvider(); 90 86 91 void addObserver(Observer *);92 void removeObserver(Observer *);87 void addObserver(Observer&); 88 void removeObserver(Observer&); 93 89 94 // EventTarget 95 EventTargetInterface eventTargetInterface() const final { return MediaStreamTrackEventTargetInterfaceType; } 96 ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); } 97 98 using RefCounted<MediaStreamTrack>::ref; 99 using RefCounted<MediaStreamTrack>::deref; 90 using RefCounted::ref; 91 using RefCounted::deref; 100 92 101 93 private: … … 113 105 void refEventTarget() final { ref(); } 114 106 void derefEventTarget() final { deref(); } 107 EventTargetInterface eventTargetInterface() const final { return MediaStreamTrackEventTargetInterfaceType; } 108 ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); } 115 109 116 110 // MediaStreamTrackPrivate::Observer … … 125 119 Ref<MediaStreamTrackPrivate> m_private; 126 120 127 RefPtr<MediaConstraints>m_constraints;121 MediaTrackConstraints m_constraints; 128 122 std::optional<DOMPromise<void>> m_promise; 129 123 WeakPtrFactory<MediaStreamTrack> m_weakPtrFactory; -
trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.idl
r208474 r209864 48 48 [ImplementedAs=stopProducingData] void stop(); 49 49 50 [Custom]MediaTrackConstraints getConstraints();50 MediaTrackConstraints getConstraints(); 51 51 [Custom] MediaSourceSettings getSettings(); 52 52 [Custom] MediaTrackCapabilities getCapabilities(); 53 [Custom]Promise<void> applyConstraints(optional MediaTrackConstraints constraints);53 Promise<void> applyConstraints(optional MediaTrackConstraints constraints); 54 54 55 55 attribute EventHandler onoverconstrained; 56 56 }; 57 -
trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp
r209390 r209864 37 37 #if ENABLE(MEDIA_STREAM) 38 38 39 #include "Document.h" 39 40 #include "DocumentLoader.h" 40 41 #include "ExceptionCode.h" 41 #include "Frame.h"42 42 #include "JSMediaStream.h" 43 43 #include "JSOverconstrainedError.h" 44 44 #include "MainFrame.h" 45 #include "MediaStream.h" 46 #include "MediaStreamPrivate.h" 47 #include "OverconstrainedError.h" 45 #include "MediaConstraintsImpl.h" 48 46 #include "RealtimeMediaSourceCenter.h" 49 #include "SecurityOrigin.h"50 47 #include "Settings.h" 51 48 #include "UserMediaController.h" 52 #include <wtf/MainThread.h>53 49 54 50 namespace WebCore { 55 51 56 ExceptionOr<void> UserMediaRequest::start(Document& document, Ref<MediaConstraintsImpl>&& audioConstraints, Ref<MediaConstraintsImpl>&& videoConstraints, MediaDevices::Promise&& promise)52 ExceptionOr<void> UserMediaRequest::start(Document& document, Ref<MediaConstraintsImpl>&& audioConstraints, Ref<MediaConstraintsImpl>&& videoConstraints, DOMPromise<IDLInterface<MediaStream>>&& promise) 57 53 { 58 54 auto* userMedia = UserMediaController::from(document.page()); … … 69 65 } 70 66 71 UserMediaRequest::UserMediaRequest(Document& document, UserMediaController& controller, Ref<MediaConstraintsImpl>&& audioConstraints, Ref<MediaConstraintsImpl>&& videoConstraints, MediaDevices::Promise&& promise)67 UserMediaRequest::UserMediaRequest(Document& document, UserMediaController& controller, Ref<MediaConstraintsImpl>&& audioConstraints, Ref<MediaConstraintsImpl>&& videoConstraints, DOMPromise<IDLInterface<MediaStream>>&& promise) 72 68 : ContextDestructionObserver(&document) 73 69 , m_audioConstraints(WTFMove(audioConstraints)) … … 86 82 if (!m_scriptExecutionContext) 87 83 return nullptr; 88 89 84 return m_scriptExecutionContext->securityOrigin(); 90 85 } … … 94 89 if (!m_scriptExecutionContext) 95 90 return nullptr; 96 97 91 return m_scriptExecutionContext->topOrigin(); 98 92 } … … 100 94 static bool isSecure(DocumentLoader& documentLoader) 101 95 { 102 if (!documentLoader.response().url().protocolIs("https")) 103 return false; 104 105 if (!documentLoader.response().certificateInfo() || documentLoader.response().certificateInfo()->containsNonRootSHA1SignedCertificate()) 106 return false; 107 108 return true; 96 auto& response = documentLoader.response(); 97 return response.url().protocolIs("https") 98 && response.certificateInfo() 99 && !response.certificateInfo()->containsNonRootSHA1SignedCertificate(); 109 100 } 110 101 … … 150 141 151 142 Document& document = downcast<Document>(*m_scriptExecutionContext); 152 DOMWindow& window = *document.domWindow();153 143 154 144 // 10.2 - 6.3 Optionally, e.g., based on a previously-established user preference, for security reasons, … … 157 147 if (!canCallGetUserMedia(document, errorMessage)) { 158 148 deny(MediaAccessDenialReason::PermissionDenied, emptyString()); 159 window.printErrorMessage(errorMessage);149 document.domWindow()->printErrorMessage(errorMessage); 160 150 return; 161 151 } … … 231 221 ContextDestructionObserver::contextDestroyed(); 232 222 Ref<UserMediaRequest> protectedThis(*this); 233 234 223 if (m_controller) { 235 224 m_controller->cancelUserMediaAccessRequest(*this); … … 240 229 Document* UserMediaRequest::document() const 241 230 { 242 if (!m_scriptExecutionContext)243 return nullptr;244 245 231 return downcast<Document>(m_scriptExecutionContext); 246 232 } -
trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.h
r208730 r209864 36 36 37 37 #include "ActiveDOMObject.h" 38 #include "Document.h" 39 #include "MediaConstraintsImpl.h" 40 #include "MediaDevices.h" 38 #include "JSDOMPromise.h" 41 39 42 40 namespace WebCore { 43 41 44 class MediaConstraints; 45 class MediaStreamPrivate; 42 class MediaConstraintsImpl; 43 class MediaStream; 44 class SecurityOrigin; 46 45 class UserMediaController; 47 class SecurityOrigin;48 46 49 47 class UserMediaRequest : public RefCounted<UserMediaRequest>, private ContextDestructionObserver { 50 48 public: 51 static ExceptionOr<void> start(Document&, Ref<MediaConstraintsImpl>&& audioConstraints, Ref<MediaConstraintsImpl>&& videoConstraints, MediaDevices::Promise&&);49 static ExceptionOr<void> start(Document&, Ref<MediaConstraintsImpl>&& audioConstraints, Ref<MediaConstraintsImpl>&& videoConstraints, DOMPromise<IDLInterface<MediaStream>>&&); 52 50 53 51 virtual ~UserMediaRequest(); … … 75 73 76 74 private: 77 UserMediaRequest(Document&, UserMediaController&, Ref<MediaConstraintsImpl>&& audioConstraints, Ref<MediaConstraintsImpl>&& videoConstraints, MediaDevices::Promise&&);75 UserMediaRequest(Document&, UserMediaController&, Ref<MediaConstraintsImpl>&& audioConstraints, Ref<MediaConstraintsImpl>&& videoConstraints, DOMPromise<IDLInterface<MediaStream>>&&); 78 76 79 77 void contextDestroyed() final; … … 89 87 90 88 UserMediaController* m_controller; 91 MediaDevices::Promisem_promise;89 DOMPromise<IDLInterface<MediaStream>> m_promise; 92 90 RefPtr<UserMediaRequest> m_protector; 93 91 }; -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r209826 r209864 126 126 07277E5517D018CC0015534D /* JSMediaStreamTrackEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 07277E4917D018CC0015534D /* JSMediaStreamTrackEvent.h */; }; 127 127 072A70401D6E8F6200DF0AFC /* OverconstrainedErrorEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 072A703E1D6E8F6200DF0AFC /* OverconstrainedErrorEvent.h */; }; 128 072A70431D7396B300DF0AFC /* JSMediaDevicesCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 072A70421D7396B200DF0AFC /* JSMediaDevicesCustom.h */; };129 128 072AE1E5183C0741000A5988 /* PluginReplacement.h in Headers */ = {isa = PBXBuildFile; fileRef = 072AE1DF183C0741000A5988 /* PluginReplacement.h */; settings = {ATTRIBUTES = (Private, ); }; }; 130 129 072AE1E6183C0741000A5988 /* QuickTimePluginReplacement.mm in Sources */ = {isa = PBXBuildFile; fileRef = 072AE1E0183C0741000A5988 /* QuickTimePluginReplacement.mm */; }; … … 990 989 1B124D8D1D380B7000ECDFB0 /* MediaSampleAVFObjC.h in Headers */ = {isa = PBXBuildFile; fileRef = 1B124D8C1D380B7000ECDFB0 /* MediaSampleAVFObjC.h */; }; 991 990 1B124D8F1D380BB600ECDFB0 /* MediaSampleAVFObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1B124D8E1D380BB600ECDFB0 /* MediaSampleAVFObjC.mm */; }; 992 1B88DD131D5B9E5000E3B7A4 /* JSMediaDevicesCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1B88DD121D5AD3B200E3B7A4 /* JSMediaDevicesCustom.cpp */; };993 991 1BE5BFC21D515715001666D9 /* MediaConstraints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1BE5BFC11D515715001666D9 /* MediaConstraints.cpp */; }; 994 992 1BF9DB3C1D3973AD0026AEB7 /* MediaSample.h in Headers */ = {isa = PBXBuildFile; fileRef = CD641EC7181ED60100EE4C41 /* MediaSample.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 3262 3260 932AD70517EFA2C30038F8FF /* MainFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 932AD70317EFA2C30038F8FF /* MainFrame.cpp */; }; 3263 3261 932AD70617EFA2C40038F8FF /* MainFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 932AD70417EFA2C30038F8FF /* MainFrame.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3262 932CC0B71DFFD158004C0F9F /* MediaTrackConstraints.h in Headers */ = {isa = PBXBuildFile; fileRef = 932CC0B61DFFD158004C0F9F /* MediaTrackConstraints.h */; }; 3263 932CC0D41DFFD667004C0F9F /* JSMediaTrackConstraints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 932CC0D01DFFD667004C0F9F /* JSMediaTrackConstraints.cpp */; }; 3264 932CC0D51DFFD667004C0F9F /* JSMediaTrackConstraints.h in Headers */ = {isa = PBXBuildFile; fileRef = 932CC0D11DFFD667004C0F9F /* JSMediaTrackConstraints.h */; }; 3265 932CC0F71DFFDA1F004C0F9F /* MediaTrackConstraints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 932CC0F61DFFDA1F004C0F9F /* MediaTrackConstraints.cpp */; }; 3264 3266 932E16090AF578340025F408 /* FrameLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 932E16080AF578340025F408 /* FrameLoader.cpp */; }; 3265 3267 93309DD6099E64920056E581 /* AppendNodeCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93309D87099E64910056E581 /* AppendNodeCommand.cpp */; }; … … 7116 7118 072A703E1D6E8F6200DF0AFC /* OverconstrainedErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OverconstrainedErrorEvent.h; sourceTree = "<group>"; }; 7117 7119 072A703F1D6E8F6200DF0AFC /* OverconstrainedErrorEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = OverconstrainedErrorEvent.idl; sourceTree = "<group>"; }; 7118 072A70421D7396B200DF0AFC /* JSMediaDevicesCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaDevicesCustom.h; sourceTree = "<group>"; };7119 7120 072AE1DF183C0741000A5988 /* PluginReplacement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginReplacement.h; sourceTree = "<group>"; }; 7120 7121 072AE1E0183C0741000A5988 /* QuickTimePluginReplacement.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = QuickTimePluginReplacement.mm; sourceTree = "<group>"; }; … … 8041 8042 1B124D8C1D380B7000ECDFB0 /* MediaSampleAVFObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MediaSampleAVFObjC.h; path = ../MediaSampleAVFObjC.h; sourceTree = "<group>"; }; 8042 8043 1B124D8E1D380BB600ECDFB0 /* MediaSampleAVFObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MediaSampleAVFObjC.mm; sourceTree = "<group>"; }; 8043 1B88DD121D5AD3B200E3B7A4 /* JSMediaDevicesCustom.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaDevicesCustom.cpp; sourceTree = "<group>"; };8044 8044 1BE5BFC11D515715001666D9 /* MediaConstraints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaConstraints.cpp; sourceTree = "<group>"; }; 8045 8045 1C0106FE192594DF008A4201 /* InlineTextBoxStyle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InlineTextBoxStyle.cpp; sourceTree = "<group>"; }; … … 10815 10815 932AD70317EFA2C30038F8FF /* MainFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MainFrame.cpp; sourceTree = "<group>"; }; 10816 10816 932AD70417EFA2C30038F8FF /* MainFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainFrame.h; sourceTree = "<group>"; }; 10817 932CC0B61DFFD158004C0F9F /* MediaTrackConstraints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaTrackConstraints.h; sourceTree = "<group>"; }; 10818 932CC0D01DFFD667004C0F9F /* JSMediaTrackConstraints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaTrackConstraints.cpp; sourceTree = "<group>"; }; 10819 932CC0D11DFFD667004C0F9F /* JSMediaTrackConstraints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaTrackConstraints.h; sourceTree = "<group>"; }; 10820 932CC0F01DFFD8D4004C0F9F /* MediaTrackConstraints.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MediaTrackConstraints.idl; sourceTree = "<group>"; }; 10821 932CC0F61DFFDA1F004C0F9F /* MediaTrackConstraints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaTrackConstraints.cpp; sourceTree = "<group>"; }; 10817 10822 932E16080AF578340025F408 /* FrameLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrameLoader.cpp; sourceTree = "<group>"; }; 10818 10823 93309D87099E64910056E581 /* AppendNodeCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppendNodeCommand.cpp; sourceTree = "<group>"; }; … … 15027 15032 07221B5817CEC32700848E51 /* MediaStreamTrackEvent.h */, 15028 15033 07221B5917CEC32700848E51 /* MediaStreamTrackEvent.idl */, 15034 932CC0F61DFFDA1F004C0F9F /* MediaTrackConstraints.cpp */, 15035 932CC0B61DFFD158004C0F9F /* MediaTrackConstraints.h */, 15036 932CC0F01DFFD8D4004C0F9F /* MediaTrackConstraints.idl */, 15029 15037 07C1C0E01BFB600100BD2256 /* MediaTrackSupportedConstraints.h */, 15030 15038 07C1C0E11BFB600100BD2256 /* MediaTrackSupportedConstraints.idl */, … … 15239 15247 07277E4817D018CC0015534D /* JSMediaStreamTrackEvent.cpp */, 15240 15248 07277E4917D018CC0015534D /* JSMediaStreamTrackEvent.h */, 15249 932CC0D01DFFD667004C0F9F /* JSMediaTrackConstraints.cpp */, 15250 932CC0D11DFFD667004C0F9F /* JSMediaTrackConstraints.h */, 15241 15251 0787C4671BFBDF6F006DCD7F /* JSMediaTrackSupportedConstraints.cpp */, 15242 15252 0787C4681BFBDF6F006DCD7F /* JSMediaTrackSupportedConstraints.h */, … … 22025 22035 7A74ECBC101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp */, 22026 22036 BCE1C43F0D9830F4003B02F2 /* JSLocationCustom.cpp */, 22027 1B88DD121D5AD3B200E3B7A4 /* JSMediaDevicesCustom.cpp */,22028 072A70421D7396B200DF0AFC /* JSMediaDevicesCustom.h */,22029 22037 AD726FE716D9F204003A4E6D /* JSMediaListCustom.h */, 22030 22038 07C59B6D17F794F6000FBCBB /* JSMediaStreamTrackCustom.cpp */, … … 25523 25531 B6D9D23514EABD260090D75E /* FocusEvent.h in Headers */, 25524 25532 B2C3DA650D006CD600EF6F26 /* Font.h in Headers */, 25533 932CC0B71DFFD158004C0F9F /* MediaTrackConstraints.h in Headers */, 25525 25534 1AC2D89D1B1E291F00D52E87 /* FontAntialiasingStateSaver.h in Headers */, 25526 25535 BCB92D4F1293550B00C8387F /* FontBaseline.h in Headers */, … … 26214 26223 159741DB1B7D140100201C92 /* JSMediaDeviceInfo.h in Headers */, 26215 26224 15739BBB1B42012D00D258C1 /* JSMediaDevices.h in Headers */, 26216 072A70431D7396B300DF0AFC /* JSMediaDevicesCustom.h in Headers */,26217 26225 FD23A12613F5FA5900F67001 /* JSMediaElementAudioSourceNode.h in Headers */, 26218 26226 2D9BF7121DBFD914007A7D99 /* JSMediaEncryptedEvent.h in Headers */, … … 28246 28254 14476AA815DC4BB100305DB2 /* WritingMode.h in Headers */, 28247 28255 6565820209D1508D000E61D7 /* XLinkNames.h in Headers */, 28256 932CC0D51DFFD667004C0F9F /* JSMediaTrackConstraints.h in Headers */, 28248 28257 830784B21C52EE2C00104D1D /* XMLDocument.h in Headers */, 28249 28258 00B9318813BA8DBA0035A948 /* XMLDocumentParser.h in Headers */, … … 28936 28945 CAE9F90F146441F000C245B0 /* CSSAspectRatioValue.cpp in Sources */, 28937 28946 94DE5C811D7F3A1400164F2A /* CSSAtRuleID.cpp in Sources */, 28947 932CC0F71DFFDA1F004C0F9F /* MediaTrackConstraints.cpp in Sources */, 28938 28948 FBD6AF8B15EF25E5008B7110 /* CSSBasicShapes.cpp in Sources */, 28939 28949 E16A84F914C85CCC002977DF /* CSSBorderImage.cpp in Sources */, … … 29842 29852 BCE7B1930D4E86960075A539 /* JSHistoryCustom.cpp in Sources */, 29843 29853 57E233691DCAB24300F28D01 /* JSHmacKeyParams.cpp in Sources */, 29854 932CC0D41DFFD667004C0F9F /* JSMediaTrackConstraints.cpp in Sources */, 29844 29855 BC97E412109154FA0010D361 /* JSHTMLAllCollection.cpp in Sources */, 29845 29856 BC97E42C10915B060010D361 /* JSHTMLAllCollectionCustom.cpp in Sources */, … … 29976 29987 159741DA1B7D13F900201C92 /* JSMediaDeviceInfo.cpp in Sources */, 29977 29988 15739BBA1B42012A00D258C1 /* JSMediaDevices.cpp in Sources */, 29978 1B88DD131D5B9E5000E3B7A4 /* JSMediaDevicesCustom.cpp in Sources */,29979 29989 FD23A12513F5FA5900F67001 /* JSMediaElementAudioSourceNode.cpp in Sources */, 29980 29990 2D9BF7101DBFD8CE007A7D99 /* JSMediaEncryptedEvent.cpp in Sources */, -
trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
r209674 r209864 100 100 #include "JSLocationCustom.cpp" 101 101 #include "JSMainThreadExecState.cpp" 102 #include "JSMediaDevicesCustom.cpp"103 102 #include "JSMessageChannelCustom.cpp" 104 103 #include "JSMessageEventCustom.cpp" -
trunk/Source/WebCore/bindings/js/JSMediaStreamTrackCustom.cpp
r208124 r209864 32 32 #include "ExceptionCode.h" 33 33 #include "JSDOMBinding.h" 34 #include "JSMediaDevicesCustom.h"35 #include "MediaConstraintsImpl.h"36 34 #include "MediaSourceSettings.h" 37 35 #include "MediaStreamTrack.h" … … 167 165 } 168 166 169 JSValue JSMediaStreamTrack::applyConstraints(ExecState& state)170 {171 MediaTrackConstraintSetMap mandatoryConstraints;172 Vector<MediaTrackConstraintSetMap> advancedConstraints;173 bool valid = false;174 175 if (state.argumentCount() >= 1) {176 JSValue argument = state.uncheckedArgument(0);177 178 JSVMClientData& clientData = *static_cast<JSVMClientData*>(state.vm().clientData);179 putDirect(state.vm(), clientData.builtinNames().mediaStreamTrackConstraintsPrivateName(), argument, DontEnum);180 181 auto constraintsDictionary = Dictionary(&state, argument);182 if (!constraintsDictionary.isUndefinedOrNull())183 parseMediaConstraintsDictionary(constraintsDictionary, mandatoryConstraints, advancedConstraints);184 valid = !advancedConstraints.isEmpty() || !mandatoryConstraints.isEmpty();185 }186 187 auto deferredPromise = createDeferredPromise(state, domWindow());188 auto promise = deferredPromise->promise();189 190 auto constraints = MediaConstraintsImpl::create(WTFMove(mandatoryConstraints), WTFMove(advancedConstraints), valid);191 wrapped().applyConstraints(WTFMove(constraints), WTFMove(deferredPromise));192 193 return promise;194 }195 196 JSValue JSMediaStreamTrack::getConstraints(ExecState& state)197 {198 JSVMClientData& clientData = *static_cast<JSVMClientData*>(state.vm().clientData);199 JSValue result = getDirect(state.vm(), clientData.builtinNames().mediaStreamTrackConstraintsPrivateName());200 return !result.isEmpty() ? result : jsUndefined();201 }202 203 167 } // namespace WebCore 204 168 -
trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm
r209752 r209864 29 29 use strict; 30 30 31 use File::Basename; 31 32 use File::Find; 32 33 use Carp qw<longmess>; … … 204 205 my $dictionaries = $useDocument->dictionaries; 205 206 if (@$dictionaries) { 206 die "Multiple standalone dictionaries per document are not supported" if @$dictionaries > 1; 207 208 my $dictionary = @$dictionaries[0]; 207 my $dictionary; 208 my $otherDictionaries; 209 if (@$dictionaries == 1) { 210 $dictionary = @$dictionaries[0]; 211 } else { 212 my $primaryDictionaryName = fileparse($targetIdlFilePath, ".idl"); 213 for my $candidate (@$dictionaries) { 214 if ($candidate->type->name eq $primaryDictionaryName) { 215 $dictionary = $candidate; 216 } else { 217 push @$otherDictionaries, $candidate; 218 } 219 } 220 die "Multiple dictionaries per document are only supported if one matches the filename" unless $dictionary; 221 } 222 209 223 print "Generating $useGenerator bindings code for IDL dictionary \"" . $dictionary->type->name . "\"...\n" if $verbose; 210 $codeGenerator->GenerateDictionary($dictionary, $useDocument->enumerations );224 $codeGenerator->GenerateDictionary($dictionary, $useDocument->enumerations, $otherDictionaries); 211 225 $codeGenerator->WriteData($dictionary, $useOutputDir, $useOutputHeadersDir); 212 226 return; -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r209752 r209864 51 51 my @depsContent = (); 52 52 my $numCachedAttributes = 0; 53 my $currentCachedAttribute = 0;54 53 55 54 my $beginAppleCopyrightForHeaderFiles = <<END; … … 144 143 sub GenerateDictionary 145 144 { 146 my ($object, $dictionary, $enumerations ) = @_;145 my ($object, $dictionary, $enumerations, $otherDictionaries) = @_; 147 146 148 147 my $className = GetDictionaryClassName($dictionary->type); 149 $object->GenerateDictionaryHeader($dictionary, $className, $enumerations );150 $object->GenerateDictionaryImplementation($dictionary, $className, $enumerations );148 $object->GenerateDictionaryHeader($dictionary, $className, $enumerations, $otherDictionaries); 149 $object->GenerateDictionaryImplementation($dictionary, $className, $enumerations, $otherDictionaries); 151 150 } 152 151 … … 1225 1224 my $result = ""; 1226 1225 foreach my $dictionary (@$allDictionaries) { 1227 $headerIncludes{$interface->type->name . ".h"} = 1 ;1226 $headerIncludes{$interface->type->name . ".h"} = 1 if $interface; 1228 1227 my $className = GetDictionaryClassName($dictionary->type, $interface); 1229 1228 my $conditionalString = $codeGenerator->GenerateConditionalString($dictionary); … … 3399 3398 } 3400 3399 } else { 3401 my $cacheIndex = 0;3402 3400 if ($attribute->extendedAttributes->{CachedAttribute}) { 3403 $cacheIndex = $currentCachedAttribute;3404 $currentCachedAttribute++;3405 3401 push(@implContent, " if (JSValue cachedValue = thisObject.m_" . $attribute->name . ".get())\n"); 3406 3402 push(@implContent, " return cachedValue;\n"); … … 4538 4534 sub GenerateDictionaryHeader 4539 4535 { 4540 my ($object, $dictionary, $className, $enumerations ) = @_;4536 my ($object, $dictionary, $className, $enumerations, $otherDictionaries) = @_; 4541 4537 4542 4538 # - Add default header template and header protection. … … 4549 4545 push(@headerContent, GenerateDictionaryHeaderContent($dictionary, $className)); 4550 4546 push(@headerContent, GenerateEnumerationsHeaderContent($dictionary, $enumerations)); 4547 push(@headerContent, GenerateDictionariesHeaderContent(undef, $otherDictionaries)) if $otherDictionaries; 4551 4548 push(@headerContent, "} // namespace WebCore\n"); 4552 4549 … … 4571 4568 sub GenerateDictionaryImplementation 4572 4569 { 4573 my ($object, $dictionary, $className, $enumerations ) = @_;4570 my ($object, $dictionary, $className, $enumerations, $otherDictionaries) = @_; 4574 4571 4575 4572 # - Add default header template … … 4578 4575 push(@implContent, "\nusing namespace JSC;\n\n"); 4579 4576 push(@implContent, "namespace WebCore {\n\n"); 4577 push(@implContent, GenerateDictionaryImplementationContent($dictionary, $className)); 4580 4578 push(@implContent, GenerateEnumerationsImplementationContent($dictionary, $enumerations)); 4581 push(@implContent, GenerateDictionar yImplementationContent($dictionary, $className));4579 push(@implContent, GenerateDictionariesImplementationContent(undef, $otherDictionaries)) if $otherDictionaries; 4582 4580 push(@implContent, "} // namespace WebCore\n"); 4583 4581 … … 5604 5602 5605 5603 my $name = $interface->type->name; 5606 my $prefix = FileNamePrefix; 5607 my $headerFileName = "$outputDir/$prefix$name.h"; 5608 my $implFileName = "$outputDir/$prefix$name.cpp"; 5609 my $depsFileName = "$outputDir/$prefix$name.dep"; 5604 my $headerFileName = "$outputDir/JS$name.h"; 5605 my $implFileName = "$outputDir/JS$name.cpp"; 5606 my $depsFileName = "$outputDir/JS$name.dep"; 5610 5607 5611 5608 # Update a .cpp file if the contents are changed. … … 5660 5657 foreach my $include (sort @includes) { 5661 5658 # "JSClassName.h" is already included right after config.h. 5662 next if $include eq "\" $prefix$name.h\"";5659 next if $include eq "\"JS$name.h\""; 5663 5660 $contents .= "#include $include\n"; 5664 5661 } -
trunk/Source/WebCore/bindings/scripts/generate-bindings.pl
r208134 r209864 83 83 print "$generator: $targetIdlFile\n"; 84 84 } 85 my $targetInterfaceName = fileparse( basename($targetIdlFile), ".idl");85 my $targetInterfaceName = fileparse($targetIdlFile, ".idl"); 86 86 87 87 my $idlFound = 0; … … 101 101 while (my $line = <FH>) { 102 102 my ($idlFile, @followingIdlFiles) = split(/\s+/, $line); 103 if ($idlFile and basename($idlFile) eq basename($targetIdlFile)) {103 if ($idlFile and fileparse($idlFile) eq fileparse($targetIdlFile)) { 104 104 $idlFound = 1; 105 105 @supplementedIdlFiles = sort @followingIdlFiles; … … 113 113 if (!$idlFound and $additionalIdlFiles) { 114 114 my @idlFiles = shellwords($additionalIdlFiles); 115 $idlFound = grep { $_ and basename($_) eq basename($targetIdlFile) } @idlFiles;115 $idlFound = grep { $_ and fileparse($_) eq fileparse($targetIdlFile) } @idlFiles; 116 116 } 117 117 … … 131 131 if ($idlAttributesFile) { 132 132 my $idlAttributes = loadIDLAttributes($idlAttributesFile); 133 checkIDLAttributes($idlAttributes, $targetDocument, basename($targetIdlFile));133 checkIDLAttributes($idlAttributes, $targetDocument, fileparse($targetIdlFile)); 134 134 } 135 135 … … 137 137 next if $idlFile eq $targetIdlFile; 138 138 139 my $interfaceName = fileparse( basename($idlFile), ".idl");139 my $interfaceName = fileparse($idlFile, ".idl"); 140 140 my $parser = IDLParser->new(!$verbose); 141 141 my $document = $parser->Parse($idlFile, $defines, $preprocessor); … … 272 272 } 273 273 } else { 274 die "The format of " . basename($idlAttributesFile) . " is wrong: line $.\n";274 die "The format of " . fileparse($idlAttributesFile) . " is wrong: line $.\n"; 275 275 } 276 276 } -
trunk/Source/WebCore/platform/mediastream/MediaConstraints.h
r208985 r209864 30 30 */ 31 31 32 #ifndef MediaConstraints_h 33 #define MediaConstraints_h 32 #pragma once 34 33 35 34 #if ENABLE(MEDIA_STREAM) … … 37 36 #include "RealtimeMediaSourceSupportedConstraints.h" 38 37 #include <cstdlib> 39 #include <wtf/HashMap.h>40 #include <wtf/RefCounted.h>41 #include <wtf/Variant.h>42 #include <wtf/text/StringHash.h>43 #include <wtf/text/WTFString.h>44 38 45 39 namespace WebCore { … … 496 490 void appendExact(const String& value) 497 491 { 498 m_exact.clear();499 492 m_exact.append(value); 500 493 } … … 814 807 815 808 #endif // ENABLE(MEDIA_STREAM) 816 817 #endif // MediaConstraints_h -
trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp
r208851 r209864 131 131 clonedMediaStreamTrackPrivate->m_isEnabled = this->m_isEnabled; 132 132 clonedMediaStreamTrackPrivate->m_isEnded = this->m_isEnded; 133 clonedMediaStreamTrackPrivate->m_constraints = this->m_constraints;134 133 135 134 return clonedMediaStreamTrackPrivate; … … 139 138 { 140 139 return m_source->type(); 141 }142 143 RefPtr<MediaConstraints> MediaStreamTrackPrivate::constraints() const144 {145 return m_constraints;146 140 } 147 141 -
trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.h
r208851 r209864 25 25 */ 26 26 27 #ifndef MediaStreamTrackPrivate_h 28 #define MediaStreamTrackPrivate_h 27 #pragma once 29 28 30 29 #if ENABLE(MEDIA_STREAM) 31 30 32 31 #include "RealtimeMediaSource.h" 33 #include <wtf/RefCounted.h>34 #include <wtf/text/AtomicString.h>35 32 36 33 namespace WebCore { … … 91 88 RefPtr<RealtimeMediaSourceCapabilities> capabilities() const; 92 89 93 RefPtr<MediaConstraints> constraints() const;94 90 void applyConstraints(const MediaConstraints&, RealtimeMediaSource::SuccessHandler, RealtimeMediaSource::FailureHandler); 95 91 … … 111 107 Vector<Observer*> m_observers; 112 108 Ref<RealtimeMediaSource> m_source; 113 RefPtr<MediaConstraints> m_constraints;114 109 RefPtr<RealtimeMediaSourcePreview> m_preview; 115 110 … … 124 119 125 120 #endif // ENABLE(MEDIA_STREAM) 126 127 #endif // MediaStreamTrackPrivate_h -
trunk/Source/WebKit2/ChangeLog
r209862 r209864 1 2016-12-15 Darin Adler <darin@apple.com> 2 3 Remove custom binding for MediaDevices 4 https://bugs.webkit.org/show_bug.cgi?id=165894 5 6 Reviewed by Eric Carlson. 7 8 * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp: 9 Added include of MediaConstraintsImpl.h, now needed because we 10 removed some unneeded includes from the WebCore headers. 11 1 12 2016-12-15 Dave Hyatt <hyatt@apple.com> 2 13 -
trunk/Source/WebKit2/WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp
r209512 r209864 30 30 #include <WebCore/Frame.h> 31 31 #include <WebCore/FrameLoader.h> 32 #include <WebCore/MediaConstraintsImpl.h> 32 33 #include <WebCore/SecurityOrigin.h> 33 34 #include <WebCore/SecurityOriginData.h>
Note: See TracChangeset
for help on using the changeset viewer.