WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch 5
usermedia_simple_client_5.patch (text/plain), 53.61 KB, created by
Adam Bergkvist
on 2011-11-16 11:12:52 PST
(
hide
)
Description:
Patch 5
Filename:
MIME Type:
Creator:
Adam Bergkvist
Created:
2011-11-16 11:12:52 PST
Size:
53.61 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 942462e..d5323ca 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,57 @@ >+2011-11-16 Adam Bergkvist <adam.bergkvist@ericsson.com> >+ >+ Use a simple page client for user consent in getUserMedia() >+ https://bugs.webkit.org/show_bug.cgi?id=70897 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This is one in a series of patches that update the MediaStream feature >+ to use WebCore platform interfaces. >+ >+ Covered by existing tests. >+ >+ * GNUmakefile.list.am: >+ * WebCore.gypi: >+ * mediastream/MediaStreamClient.h: Removed. >+ * mediastream/MediaStreamController.cpp: Removed. >+ * mediastream/MediaStreamController.h: Removed. >+ * mediastream/MediaStreamFrameController.cpp: Removed. >+ * mediastream/MediaStreamFrameController.h: Removed. >+ * mediastream/UserMediaClient.h: Added. >+ (WebCore::UserMediaClient::~UserMediaClient): >+ * mediastream/UserMediaRequest.cpp: Added. >+ (WebCore::UserMediaRequest::create): >+ (WebCore::UserMediaRequest::UserMediaRequest): >+ (WebCore::UserMediaRequest::~UserMediaRequest): >+ (WebCore::UserMediaRequest::start): >+ (WebCore::UserMediaRequest::mediaStreamSourcesQueryCompleted): >+ (WebCore::UserMediaRequest::succeed): >+ (WebCore::UserMediaRequest::fail): >+ (WebCore::UserMediaRequest::contextDestroyed): >+ (WebCore::UserMediaRequest::parseOptions): >+ * mediastream/UserMediaRequest.h: Added. >+ (WebCore::UserMediaRequest::audio): >+ (WebCore::UserMediaRequest::video): >+ (WebCore::UserMediaRequest::cameraPreferenceUser): >+ (WebCore::UserMediaRequest::cameraPreferenceEnvironment): >+ (WebCore::UserMediaRequest::successCallback): >+ (WebCore::UserMediaRequest::errorCallback): >+ * page/CallbackTask.h: Removed. >+ * page/Frame.cpp: >+ (WebCore::Frame::Frame): >+ (WebCore::Frame::~Frame): >+ (WebCore::Frame::pageDestroyed): >+ (WebCore::Frame::transferChildFrameToNewDocument): >+ * page/Frame.h: >+ * page/Navigator.cpp: >+ (WebCore::Navigator::webkitGetUserMedia): >+ * page/NavigatorUserMediaErrorCallback.h: >+ * page/Page.cpp: >+ (WebCore::Page::Page): >+ (WebCore::Page::PageClients::PageClients): >+ * page/Page.h: >+ (WebCore::Page::userMediaClient): >+ > 2011-11-16 Vsevolod Vlasov <vsevik@chromium.org> > > Web Inspector: Application cache status should be updated after swapCache(). >diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am >index 347e963..1616738 100644 >--- a/Source/WebCore/GNUmakefile.list.am >+++ b/Source/WebCore/GNUmakefile.list.am >@@ -2280,13 +2280,8 @@ webcore_sources += \ > Source/WebCore/mediastream/LocalMediaStream.h \ > Source/WebCore/mediastream/MediaStream.cpp \ > Source/WebCore/mediastream/MediaStream.h \ >- Source/WebCore/mediastream/MediaStreamClient.h \ >- Source/WebCore/mediastream/MediaStreamController.cpp \ >- Source/WebCore/mediastream/MediaStreamController.h \ > Source/WebCore/mediastream/MediaStreamEvent.cpp \ > Source/WebCore/mediastream/MediaStreamEvent.h \ >- Source/WebCore/mediastream/MediaStreamFrameController.cpp \ >- Source/WebCore/mediastream/MediaStreamFrameController.h \ > Source/WebCore/mediastream/MediaStreamList.cpp \ > Source/WebCore/mediastream/MediaStreamList.h \ > Source/WebCore/mediastream/MediaStreamRegistry.cpp \ >@@ -2298,6 +2293,9 @@ webcore_sources += \ > Source/WebCore/mediastream/PeerConnection.cpp \ > Source/WebCore/mediastream/PeerConnection.h \ > Source/WebCore/mediastream/SignalingCallback.h \ >+ Source/WebCore/mediastream/UserMediaClient.h \ >+ Source/WebCore/mediastream/UserMediaRequest.cpp \ >+ Source/WebCore/mediastream/UserMediaRequest.h \ > Source/WebCore/notifications/NotificationCenter.cpp \ > Source/WebCore/notifications/NotificationCenter.h \ > Source/WebCore/notifications/NotificationContents.h \ >@@ -2318,7 +2316,6 @@ webcore_sources += \ > Source/WebCore/page/AdjustViewSizeOrNot.h \ > Source/WebCore/page/BarInfo.cpp \ > Source/WebCore/page/BarInfo.h \ >- Source/WebCore/page/CallbackTask.h \ > Source/WebCore/page/Chrome.cpp \ > Source/WebCore/page/Chrome.h \ > Source/WebCore/page/ChromeClient.h \ >diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi >index b5ccad0..f2f0723 100644 >--- a/Source/WebCore/WebCore.gypi >+++ b/Source/WebCore/WebCore.gypi >@@ -2905,11 +2905,6 @@ > 'mediastream/MediaStream.h', > 'mediastream/MediaStreamEvent.cpp', > 'mediastream/MediaStreamEvent.h', >- 'mediastream/MediaStreamClient.h', >- 'mediastream/MediaStreamController.cpp', >- 'mediastream/MediaStreamController.h', >- 'mediastream/MediaStreamFrameController.cpp', >- 'mediastream/MediaStreamFrameController.h', > 'mediastream/MediaStreamList.cpp', > 'mediastream/MediaStreamList.h', > 'mediastream/MediaStreamTrack.cpp', >@@ -2921,6 +2916,9 @@ > 'mediastream/PeerConnection.cpp', > 'mediastream/PeerConnection.h', > 'mediastream/SignalingCallback.h', >+ 'mediastream/UserMediaClient.h', >+ 'mediastream/UserMediaRequest.cpp', >+ 'mediastream/UserMediaRequest.h', > 'notifications/Notification.cpp', > 'notifications/Notification.h', > 'notifications/NotificationCenter.cpp', >@@ -2928,7 +2926,6 @@ > 'notifications/NotificationContents.h', > 'page/BarInfo.cpp', > 'page/BarInfo.h', >- 'page/CallbackTask.h', > 'page/Chrome.cpp', > 'page/Console.cpp', > 'page/ContentSecurityPolicy.cpp', >diff --git a/Source/WebCore/mediastream/MediaStreamClient.h b/Source/WebCore/mediastream/MediaStreamClient.h >deleted file mode 100644 >index af9095c..0000000 >--- a/Source/WebCore/mediastream/MediaStreamClient.h >+++ /dev/null >@@ -1,58 +0,0 @@ >-/* >- * Copyright (C) 2011 Google Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY >- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES >- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; >- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON >- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS >- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#ifndef MediaStreamClient_h >-#define MediaStreamClient_h >- >-#if ENABLE(MEDIA_STREAM) >- >-#include <wtf/Forward.h> >- >-namespace WebCore { >- >-class SecurityOrigin; >- >-enum GenerateStreamOptionFlag { >- GenerateStreamRequestAudio = 1, >- GenerateStreamRequestVideoFacingUser = 1 << 1, >- GenerateStreamRequestVideoFacingEnvironment = 1 << 2, >-}; >- >-typedef unsigned GenerateStreamOptionFlags; >- >-class MediaStreamClient { >-public: >- // MediaStream functions. >- virtual void mediaStreamDestroyed() = 0; >- virtual void generateStream(int requestId, GenerateStreamOptionFlags, PassRefPtr<SecurityOrigin>) = 0; >- >-protected: >- virtual ~MediaStreamClient() { } >-}; >- >-} // namespace WebCore >- >-#endif // ENABLE(MEDIA_STREAM) >- >-#endif // MediaStreamClient_h >diff --git a/Source/WebCore/mediastream/MediaStreamController.cpp b/Source/WebCore/mediastream/MediaStreamController.cpp >deleted file mode 100644 >index d4e308e..0000000 >--- a/Source/WebCore/mediastream/MediaStreamController.cpp >+++ /dev/null >@@ -1,123 +0,0 @@ >-/* >- * Copyright (C) 2011 Google Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY >- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES >- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; >- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON >- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS >- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "MediaStreamController.h" >- >-#if ENABLE(MEDIA_STREAM) >- >-#include "MediaStreamFrameController.h" >-#include "SecurityOrigin.h" >-#include <wtf/Vector.h> >- >-namespace WebCore { >- >-class MediaStreamController::Request { >-public: >- Request() >- : m_localId(0) >- , m_frameController(0) { } >- >- Request(int localId, MediaStreamFrameController* frameController) >- : m_localId(localId) >- , m_frameController(frameController) { } >- >- int localId() const { return m_localId; } >- MediaStreamFrameController* frameController() const { return m_frameController; } >- >-private: >- int m_localId; >- MediaStreamFrameController* m_frameController; >-}; >- >-MediaStreamController::MediaStreamController(MediaStreamClient* client) >- : m_client(client) >- , m_nextGlobalRequestId(1) >-{ >-} >- >-MediaStreamController::~MediaStreamController() >-{ >- if (m_client) >- m_client->mediaStreamDestroyed(); >-} >- >-bool MediaStreamController::isClientAvailable() const >-{ >- return m_client; >-} >- >-void MediaStreamController::unregisterFrameController(MediaStreamFrameController* frameController) >-{ >- ASSERT(frameController); >- >- // Done in two steps to avoid problems about iterators being invalidated while removing. >- Vector<int> frameRequests; >- for (RequestMap::iterator it = m_requests.begin(); it != m_requests.end(); ++it) >- if (it->second.frameController() == frameController) >- frameRequests.append(it->first); >- >- for (Vector<int>::iterator it = frameRequests.begin(); it != frameRequests.end(); ++it) >- m_requests.remove(*it); >-} >- >-int MediaStreamController::registerRequest(int localId, MediaStreamFrameController* frameController) >-{ >- ASSERT(localId > 0); >- ASSERT(frameController); >- m_requests.add(m_nextGlobalRequestId, Request(localId, frameController)); >- return m_nextGlobalRequestId++; >-} >- >-void MediaStreamController::generateStream(MediaStreamFrameController* frameController, int localId, GenerateStreamOptionFlags flags, PassRefPtr<SecurityOrigin> securityOrigin) >-{ >- ASSERT(m_client); >- int controllerRequestId = registerRequest(localId, frameController); >- m_client->generateStream(controllerRequestId, flags, securityOrigin); >-} >- >-void MediaStreamController::streamGenerated(int controllerRequestId, const MediaStreamSourceVector& sources) >-{ >- // Don't assert since the frame controller can have been destroyed while the request reply was coming back. >- if (m_requests.contains(controllerRequestId)) { >- const Request& request = m_requests.get(controllerRequestId); >- m_requests.remove(controllerRequestId); >- ASSERT(request.frameController()); >- request.frameController()->streamGenerated(request.localId(), sources); >- } >-} >- >-void MediaStreamController::streamGenerationFailed(int controllerRequestId, NavigatorUserMediaError::ErrorCode code) >-{ >- // Don't assert since the frame controller can have been destroyed while the request reply was coming back. >- if (m_requests.contains(controllerRequestId)) { >- const Request& request = m_requests.get(controllerRequestId); >- m_requests.remove(controllerRequestId); >- request.frameController()->streamGenerationFailed(request.localId(), code); >- } >-} >- >-} // namespace WebCore >- >-#endif // ENABLE(MEDIA_STREAM) >diff --git a/Source/WebCore/mediastream/MediaStreamController.h b/Source/WebCore/mediastream/MediaStreamController.h >deleted file mode 100644 >index 4893094..0000000 >--- a/Source/WebCore/mediastream/MediaStreamController.h >+++ /dev/null >@@ -1,74 +0,0 @@ >-/* >- * Copyright (C) 2011 Google Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY >- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES >- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; >- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON >- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS >- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#ifndef MediaStreamController_h >-#define MediaStreamController_h >- >-#if ENABLE(MEDIA_STREAM) >- >-#include "MediaStreamClient.h" >-#include "MediaStreamSource.h" >-#include "NavigatorUserMediaError.h" >-#include <wtf/Forward.h> >-#include <wtf/HashMap.h> >-#include <wtf/Noncopyable.h> >-#include <wtf/text/StringHash.h> >- >-namespace WebCore { >- >-class MediaStreamClient; >-class MediaStreamFrameController; >-class SecurityOrigin; >- >-class MediaStreamController { >- WTF_MAKE_NONCOPYABLE(MediaStreamController); >-public: >- MediaStreamController(MediaStreamClient*); >- virtual ~MediaStreamController(); >- >- bool isClientAvailable() const; >- void unregisterFrameController(MediaStreamFrameController*); >- >- void generateStream(MediaStreamFrameController*, int requestId, GenerateStreamOptionFlags, PassRefPtr<SecurityOrigin>); >- >- void streamGenerated(int requestId, const MediaStreamSourceVector& sources); >- void streamGenerationFailed(int requestId, NavigatorUserMediaError::ErrorCode); >- >-private: >- int registerRequest(int localRequestId, MediaStreamFrameController*); >- >- class Request; >- typedef HashMap<int, Request> RequestMap; >- >- RequestMap m_requests; >- >- MediaStreamClient* m_client; >- int m_nextGlobalRequestId; >-}; >- >-} // namespace WebCore >- >-#endif // ENABLE(MEDIA_STREAM) >- >-#endif // MediaStreamController_h >diff --git a/Source/WebCore/mediastream/MediaStreamFrameController.cpp b/Source/WebCore/mediastream/MediaStreamFrameController.cpp >deleted file mode 100644 >index dc757e4..0000000 >--- a/Source/WebCore/mediastream/MediaStreamFrameController.cpp >+++ /dev/null >@@ -1,283 +0,0 @@ >-/* >- * Copyright (C) 2011 Google Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY >- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES >- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; >- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON >- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS >- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "MediaStreamFrameController.h" >- >-#if ENABLE(MEDIA_STREAM) >- >-#include "DOMWindow.h" >-#include "Document.h" >-#include "ExceptionCode.h" >-#include "Frame.h" >-#include "LocalMediaStream.h" >-#include "MediaStreamController.h" >-#include "NavigatorUserMediaErrorCallback.h" >-#include "NavigatorUserMediaSuccessCallback.h" >-#include "Page.h" >-#include "SecurityOrigin.h" >-#include <wtf/RefCounted.h> >- >-namespace WebCore { >- >-class MediaStreamFrameController::Request : public RefCounted<Request> { >- WTF_MAKE_NONCOPYABLE(Request); >-public: >- virtual ~Request() { } >- >- ScriptExecutionContext* scriptExecutionContext() const { return m_scriptExecutionContext; } >- virtual bool isGenerateStreamRequest() const { return false; } >- >- virtual void abort() = 0; >- >-protected: >- Request(ScriptExecutionContext* scriptExecutionContext) >- : m_scriptExecutionContext(scriptExecutionContext) { } >- >-private: >- // This is guaranteed to have the lifetime of the Frame, and it's only used to make >- // the callback asynchronous. The original callback context is used in the call. >- ScriptExecutionContext* m_scriptExecutionContext; >-}; >- >-class MediaStreamFrameController::GenerateStreamRequest : public Request { >- WTF_MAKE_NONCOPYABLE(GenerateStreamRequest); >-public: >- static PassRefPtr<GenerateStreamRequest> create(ScriptExecutionContext* scriptExecutionContext, >- PassRefPtr<NavigatorUserMediaSuccessCallback> successCallback, >- PassRefPtr<NavigatorUserMediaErrorCallback> errorCallback) >- { >- return adoptRef(new GenerateStreamRequest(scriptExecutionContext, successCallback, errorCallback)); >- } >- >- virtual ~GenerateStreamRequest() { } >- >- virtual bool isGenerateStreamRequest() const { return true; } >- >- virtual void abort() >- { >- if (m_errorCallback) { >- RefPtr<NavigatorUserMediaError> error = NavigatorUserMediaError::create(NavigatorUserMediaError::PERMISSION_DENIED); >- // The callback itself is made with the JS callback's context, not with the frame's context. >- m_errorCallback->scheduleCallback(scriptExecutionContext(), error); >- } >- } >- >- PassRefPtr<NavigatorUserMediaSuccessCallback> successCallback() const { return m_successCallback; } >- PassRefPtr<NavigatorUserMediaErrorCallback> errorCallback() const { return m_errorCallback; } >- >-private: >- GenerateStreamRequest(ScriptExecutionContext* scriptExecutionContext, >- PassRefPtr<NavigatorUserMediaSuccessCallback> successCallback, >- PassRefPtr<NavigatorUserMediaErrorCallback> errorCallback) >- : Request(scriptExecutionContext) >- , m_successCallback(successCallback) >- , m_errorCallback(errorCallback) { } >- >- RefPtr<NavigatorUserMediaSuccessCallback> m_successCallback; >- RefPtr<NavigatorUserMediaErrorCallback> m_errorCallback; >-}; >- >-void MediaStreamFrameController::RequestMap::abort(int requestId) >-{ >- get(requestId)->abort(); >- remove(requestId); >-} >- >-void MediaStreamFrameController::RequestMap::abortAll() >-{ >- while (!isEmpty()) { >- begin()->second->abort(); >- remove(begin()); >- } >-} >- >-MediaStreamFrameController::MediaStreamFrameController(Frame* frame) >- : m_frame(frame) >- , m_isInDetachedState(false) >-{ >- if (!isClientAvailable()) >- enterDetachedState(); >-} >- >-MediaStreamFrameController::~MediaStreamFrameController() >-{ >-} >- >-SecurityOrigin* MediaStreamFrameController::securityOrigin() const >-{ >- return m_frame ? m_frame->existingDOMWindow()->securityOrigin() : 0; >-} >- >-ScriptExecutionContext* MediaStreamFrameController::scriptExecutionContext() const >-{ >- return m_frame ? m_frame->existingDOMWindow()->scriptExecutionContext() : 0; >-} >- >-MediaStreamController* MediaStreamFrameController::pageController() const >-{ >- return m_frame && m_frame->page() ? m_frame->page()->mediaStreamController() : 0; >-} >- >-void MediaStreamFrameController::enterDetachedState() >-{ >- if (m_isInDetachedState) { >- ASSERT(m_requests.isEmpty()); >- return; >- } >- >- m_requests.abortAll(); >- m_isInDetachedState = true; >-} >- >-bool MediaStreamFrameController::isClientAvailable() const >-{ >- if (m_isInDetachedState) >- return false; >- >- MediaStreamController* controller = pageController(); >- return controller && controller->isClientAvailable(); >-} >- >-// Called also when the frame is detached from the page, in which case the page controller will remain alive. >-void MediaStreamFrameController::disconnectPage() >-{ >- if (pageController()) >- pageController()->unregisterFrameController(this); >- >- enterDetachedState(); >-} >- >-// Called when the frame is being destroyed. Since the frame controller is owned by the frame it will die shortly after this. >-void MediaStreamFrameController::disconnectFrame() >-{ >- disconnectPage(); >- >- ASSERT(m_requests.isEmpty()); >- >- m_frame = 0; >-} >- >-void MediaStreamFrameController::transferToNewPage(Page*) >-{ >- // FIXME: In the future we should keep running the media stream services while transfering frames between pages. >- // However, until a proper way to do this is decided, we're shutting down services. >- disconnectPage(); >-} >- >-GenerateStreamOptionFlags MediaStreamFrameController::parseGenerateStreamOptions(const String& options) >-{ >- GenerateStreamOptionFlags flags = 0; >- Vector<String> optionList; >- options.split(',', optionList); >- >- for (Vector<String>::const_iterator option = optionList.begin(); option != optionList.end(); ++option) { >- Vector<String> suboptionList; >- option->split(' ', suboptionList); >- >- if (suboptionList.first() == "audio") >- flags |= GenerateStreamRequestAudio; >- else if (suboptionList.first() == "video") { >- bool videoSuboptions = false; >- Vector<String>::const_iterator suboption = suboptionList.begin(); >- for (++suboption; suboption != suboptionList.end(); ++suboption) >- if (*suboption == "user") { >- flags |= GenerateStreamRequestVideoFacingUser; >- videoSuboptions = true; >- } else if (*suboption == "environment") { >- flags |= GenerateStreamRequestVideoFacingEnvironment; >- videoSuboptions = true; >- } >- >- // Ask for all kind of cameras if no suboption was specified. >- if (!videoSuboptions) >- flags |= GenerateStreamRequestVideoFacingUser | GenerateStreamRequestVideoFacingEnvironment; >- } >- } >- >- return flags; >-} >- >-// Implements the getUserMedia method from http://www.whatwg.org/specs/web-apps/current-work/#dom-navigator-getusermedia. >-void MediaStreamFrameController::generateStream(const String& options, >- PassRefPtr<NavigatorUserMediaSuccessCallback> successCallback, >- PassRefPtr<NavigatorUserMediaErrorCallback> errorCallback, >- ExceptionCode& ec) >-{ >- ec = 0; >- if (!successCallback) >- return; >- >- GenerateStreamOptionFlags flags = parseGenerateStreamOptions(options); >- if (!flags) { >- ec = NOT_SUPPORTED_ERR; >- return; >- } >- >- int requestId = m_requests.getNextId(); >- m_requests.add(requestId, GenerateStreamRequest::create(scriptExecutionContext(), successCallback, errorCallback)); >- >- if (!isClientAvailable()) { >- // This makes sure to call the error callback if provided. >- m_requests.abort(requestId); >- return; >- } >- >- pageController()->generateStream(this, requestId, flags, securityOrigin()); >-} >- >-void MediaStreamFrameController::streamGenerated(int requestId, const MediaStreamSourceVector& sources) >-{ >- // Don't assert since the request can have been aborted as a result of embedder detachment. >- if (!m_requests.contains(requestId)) >- return; >- >- ASSERT(m_requests.get(requestId)->isGenerateStreamRequest()); >- >- RefPtr<GenerateStreamRequest> streamRequest = static_cast<GenerateStreamRequest*>(m_requests.get(requestId).get()); >- RefPtr<LocalMediaStream> generatedStream = LocalMediaStream::create(scriptExecutionContext(), sources); >- m_requests.remove(requestId); >- streamRequest->successCallback()->handleEvent(generatedStream.get()); >-} >- >-void MediaStreamFrameController::streamGenerationFailed(int requestId, NavigatorUserMediaError::ErrorCode code) >-{ >- // Don't assert since the request can have been aborted as a result of embedder detachment. >- if (!m_requests.contains(requestId)) >- return; >- >- ASSERT(m_requests.get(requestId)->isGenerateStreamRequest()); >- >- RefPtr<GenerateStreamRequest> streamRequest = static_cast<GenerateStreamRequest*>(m_requests.get(requestId).get()); >- m_requests.remove(requestId); >- >- if (streamRequest->errorCallback()) { >- RefPtr<NavigatorUserMediaError> error = NavigatorUserMediaError::create(code); >- streamRequest->errorCallback()->handleEvent(error.get()); >- } >-} >- >-} // namespace WebCore >- >-#endif // ENABLE(MEDIA_STREAM) >diff --git a/Source/WebCore/mediastream/MediaStreamFrameController.h b/Source/WebCore/mediastream/MediaStreamFrameController.h >deleted file mode 100644 >index 8c093a3..0000000 >--- a/Source/WebCore/mediastream/MediaStreamFrameController.h >+++ /dev/null >@@ -1,107 +0,0 @@ >-/* >- * Copyright (C) 2011 Google Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY >- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES >- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; >- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON >- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS >- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#ifndef MediaStreamFrameController_h >-#define MediaStreamFrameController_h >- >-#if ENABLE(MEDIA_STREAM) >- >-#include "MediaStreamClient.h" >-#include "MediaStreamSource.h" >-#include "NavigatorUserMediaError.h" >-#include <wtf/Forward.h> >-#include <wtf/HashMap.h> >-#include <wtf/Noncopyable.h> >-#include <wtf/text/StringHash.h> >- >-namespace WebCore { >- >-class Frame; >-class MediaStreamController; >-class NavigatorUserMediaErrorCallback; >-class NavigatorUserMediaSuccessCallback; >-class Page; >-class ScriptExecutionContext; >-class SecurityOrigin; >- >-typedef int ExceptionCode; >- >-class MediaStreamFrameController { >- WTF_MAKE_NONCOPYABLE(MediaStreamFrameController); >-public: >- MediaStreamFrameController(Frame*); >- virtual ~MediaStreamFrameController(); >- >- SecurityOrigin* securityOrigin() const; >- ScriptExecutionContext* scriptExecutionContext() const; >- >- bool isClientAvailable() const; >- void disconnectPage(); >- void disconnectFrame(); >- void transferToNewPage(Page*); >- >- static GenerateStreamOptionFlags parseGenerateStreamOptions(const String&); >- void generateStream(const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback>, PassRefPtr<NavigatorUserMediaErrorCallback>, ExceptionCode&); >- >- // --- Calls coming back from the controller. --- // >- >- void streamGenerated(int requestId, const MediaStreamSourceVector& sources); >- void streamGenerationFailed(int requestId, NavigatorUserMediaError::ErrorCode); >- >-private: >- class Request; >- class GenerateStreamRequest; >- >- class IdGenerator { >- WTF_MAKE_NONCOPYABLE(IdGenerator); >- public: >- IdGenerator() : m_id(0) { } >- int getNextId() { return ++m_id; } >- >- private: >- int m_id; >- }; >- >- class RequestMap : public IdGenerator, public HashMap<int, RefPtr<Request> > { >- public: >- void abort(int requestId); >- void abortAll(); >- }; >- >- // Detached from a page, and hence from a embedder client. >- void enterDetachedState(); >- >- MediaStreamController* pageController() const; >- >- RequestMap m_requests; >- >- Frame* m_frame; >- bool m_isInDetachedState; >-}; >- >-} // namespace WebCore >- >-#endif // ENABLE(MEDIA_STREAM) >- >-#endif // MediaStreamFrameController_h >diff --git a/Source/WebCore/mediastream/UserMediaClient.h b/Source/WebCore/mediastream/UserMediaClient.h >new file mode 100644 >index 0000000..760531f >--- /dev/null >+++ b/Source/WebCore/mediastream/UserMediaClient.h >@@ -0,0 +1,54 @@ >+/* >+ * Copyright (C) 2011 Ericsson AB. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer >+ * in the documentation and/or other materials provided with the >+ * distribution. >+ * 3. Neither the name of Ericsson nor the names of its contributors >+ * may be used to endorse or promote products derived from this >+ * software without specific prior written permission. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#ifndef UserMediaClient_h >+#define UserMediaClient_h >+ >+#if ENABLE(MEDIA_STREAM) >+ >+#include "UserMediaRequest.h" >+#include <wtf/text/WTFString.h> >+ >+namespace WebCore { >+ >+class UserMediaClient { >+public: >+ virtual void requestUserMedia(PassRefPtr<UserMediaRequest>, const MediaStreamSourceVector&) = 0; >+ virtual void cancelUserMediaRequest(UserMediaRequest*) = 0; >+ >+protected: >+ virtual ~UserMediaClient() { } >+}; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(MEDIA_STREAM) >+ >+#endif // UserMediaClient_h >diff --git a/Source/WebCore/mediastream/UserMediaRequest.cpp b/Source/WebCore/mediastream/UserMediaRequest.cpp >new file mode 100644 >index 0000000..c4cf870 >--- /dev/null >+++ b/Source/WebCore/mediastream/UserMediaRequest.cpp >@@ -0,0 +1,132 @@ >+/* >+ * Copyright (C) 2011 Ericsson AB. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer >+ * in the documentation and/or other materials provided with the >+ * distribution. >+ * 3. Neither the name of Ericsson nor the names of its contributors >+ * may be used to endorse or promote products derived from this >+ * software without specific prior written permission. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+ >+#if ENABLE(MEDIA_STREAM) >+ >+#include "UserMediaRequest.h" >+ >+#include "LocalMediaStream.h" >+#include "SpaceSplitString.h" >+#include "UserMediaClient.h" >+ >+namespace WebCore { >+ >+PassRefPtr<UserMediaRequest> UserMediaRequest::create(ScriptExecutionContext* context, UserMediaClient* client, const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback> successCallback, PassRefPtr<NavigatorUserMediaErrorCallback> errorCallback) >+{ >+ RefPtr<UserMediaRequest> request = adoptRef(new UserMediaRequest(context, client, options, successCallback, errorCallback)); >+ if (!request->audio() && !request->video()) >+ return 0; >+ >+ return request.release(); >+} >+ >+UserMediaRequest::UserMediaRequest(ScriptExecutionContext* context, UserMediaClient* client, const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback> successCallback, PassRefPtr<NavigatorUserMediaErrorCallback> errorCallback) >+ : ContextDestructionObserver(context) >+ , m_audio(false) >+ , m_video(false) >+ , m_cameraPreferenceUser(false) >+ , m_cameraPreferenceEnvironment(false) >+ , m_client(client) >+ , m_successCallback(successCallback) >+ , m_errorCallback(errorCallback) >+{ >+ parseOptions(options); >+} >+ >+UserMediaRequest::~UserMediaRequest() >+{ >+} >+ >+void UserMediaRequest::start() >+{ >+ // FIXME: query the platform for available media stream sources, see http://webkit.org/b/70895 >+} >+ >+void UserMediaRequest::mediaStreamSourcesQueryCompleted(const MediaStreamSourceVector& sources) >+{ >+ if (m_client) >+ m_client->requestUserMedia(this, sources); >+} >+ >+void UserMediaRequest::succeed(const MediaStreamSourceVector& sources) >+{ >+ if (!m_scriptExecutionContext) >+ return; >+ >+ RefPtr<LocalMediaStream> stream = LocalMediaStream::create(m_scriptExecutionContext, sources); >+ m_successCallback->handleEvent(stream.get()); >+} >+ >+void UserMediaRequest::fail() >+{ >+ if (!m_scriptExecutionContext) >+ return; >+ >+ if (m_errorCallback) { >+ RefPtr<NavigatorUserMediaError> error = NavigatorUserMediaError::create(NavigatorUserMediaError::PERMISSION_DENIED); >+ m_errorCallback->handleEvent(error.get()); >+ } >+} >+ >+void UserMediaRequest::contextDestroyed() >+{ >+ if (m_client) { >+ m_client->cancelUserMediaRequest(this); >+ m_client = 0; >+ } >+ >+ ContextDestructionObserver::contextDestroyed(); >+} >+ >+void UserMediaRequest::parseOptions(const String& options) >+{ >+ Vector<String> optionsList; >+ options.split(",", optionsList); >+ >+ for (size_t i = 0; i < optionsList.size(); ++i) { >+ SpaceSplitString subOptions(optionsList[i], false); >+ >+ if (subOptions[0] == "audio") >+ m_audio = true; >+ else if (subOptions[0] == "video") { >+ m_video = true; >+ if (subOptions.contains("user")) >+ m_cameraPreferenceUser = true; >+ if (subOptions.contains("environment")) >+ m_cameraPreferenceEnvironment = true; >+ } >+ } >+} >+ >+} // namespace WebCore >+ >+#endif // ENABLE(MEDIA_STREAM) >diff --git a/Source/WebCore/mediastream/UserMediaRequest.h b/Source/WebCore/mediastream/UserMediaRequest.h >new file mode 100644 >index 0000000..109bd47 >--- /dev/null >+++ b/Source/WebCore/mediastream/UserMediaRequest.h >@@ -0,0 +1,92 @@ >+/* >+ * Copyright (C) 2011 Ericsson AB. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer >+ * in the documentation and/or other materials provided with the >+ * distribution. >+ * 3. Neither the name of Ericsson nor the names of its contributors >+ * may be used to endorse or promote products derived from this >+ * software without specific prior written permission. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#ifndef UserMediaRequest_h >+#define UserMediaRequest_h >+ >+#if ENABLE(MEDIA_STREAM) >+ >+#include "ActiveDOMObject.h" >+#include "MediaStreamSource.h" >+#include "NavigatorUserMediaErrorCallback.h" >+#include "NavigatorUserMediaSuccessCallback.h" >+#include <wtf/PassRefPtr.h> >+#include <wtf/RefCounted.h> >+#include <wtf/text/WTFString.h> >+ >+namespace WebCore { >+ >+class UserMediaClient; >+ >+class UserMediaRequest : public RefCounted<UserMediaRequest>, public ContextDestructionObserver { >+public: >+ static PassRefPtr<UserMediaRequest> create(ScriptExecutionContext*, UserMediaClient*, const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback>, PassRefPtr<NavigatorUserMediaErrorCallback>); >+ ~UserMediaRequest(); >+ >+ bool audio() const { return m_audio; } >+ bool video() const { return m_video; } >+ >+ bool cameraPreferenceUser() const { return m_cameraPreferenceUser; } >+ bool cameraPreferenceEnvironment() const { return m_cameraPreferenceEnvironment; } >+ >+ NavigatorUserMediaSuccessCallback* successCallback() const { return m_successCallback.get(); } >+ NavigatorUserMediaErrorCallback* errorCallback() const { return m_errorCallback.get(); } >+ >+ void start(); >+ void mediaStreamSourcesQueryCompleted(const MediaStreamSourceVector&); >+ >+ void succeed(const MediaStreamSourceVector&); >+ void fail(); >+ >+ // ContextDestructionObserver >+ virtual void contextDestroyed(); >+ >+private: >+ UserMediaRequest(ScriptExecutionContext*, UserMediaClient*, const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback>, PassRefPtr<NavigatorUserMediaErrorCallback>); >+ >+ void parseOptions(const String& options); >+ >+ bool m_audio; >+ bool m_video; >+ >+ bool m_cameraPreferenceUser; >+ bool m_cameraPreferenceEnvironment; >+ >+ UserMediaClient* m_client; >+ >+ RefPtr<NavigatorUserMediaSuccessCallback> m_successCallback; >+ RefPtr<NavigatorUserMediaErrorCallback> m_errorCallback; >+}; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(MEDIA_STREAM) >+ >+#endif // UserMediaRequest_h >diff --git a/Source/WebCore/page/CallbackTask.h b/Source/WebCore/page/CallbackTask.h >deleted file mode 100644 >index ed00d31..0000000 >--- a/Source/WebCore/page/CallbackTask.h >+++ /dev/null >@@ -1,81 +0,0 @@ >-/* >- * Copyright (C) 2011 Google Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY >- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES >- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; >- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON >- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS >- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#ifndef CallbackTask_h >-#define CallbackTask_h >- >-#if ENABLE(MEDIA_STREAM) >- >-#include "ScriptExecutionContext.h" >-#include <wtf/Forward.h> >-#include <wtf/PassRefPtr.h> >-#include <wtf/RefPtr.h> >- >-namespace WebCore { >- >-// Helper template to schedule calls to callbacks using their own script execution context. >-// CallbackType is assumed to implement Scheduler and to be reference-counted. >-template <typename CallbackType, typename ArgumentType> >-class CallbackTask1 : public ScriptExecutionContext::Task { >-public: >- static PassOwnPtr<CallbackTask1> create(PassRefPtr<CallbackType> callback, PassRefPtr<ArgumentType> data) >- { >- return adoptPtr(new CallbackTask1(callback, data)); >- } >- >- virtual void performTask(ScriptExecutionContext*) >- { >- m_callback->handleEvent(m_data.get()); >- } >- >- class Scheduler { >- public: >- virtual ~Scheduler() { } >- >- bool scheduleCallback(ScriptExecutionContext* context, PassRefPtr<ArgumentType> data) >- { >- if (context) { >- context->postTask(CallbackTask1<CallbackType, ArgumentType>::create(static_cast<CallbackType*>(this), data)); >- return true; >- } >- return false; >- } >- }; >- >-private: >- CallbackTask1(PassRefPtr<CallbackType> callback, PassRefPtr<ArgumentType> data) >- : m_callback(callback) >- , m_data(data) >- { >- } >- >- RefPtr<CallbackType> m_callback; >- RefPtr<ArgumentType> m_data; >-}; >- >-} >- >-#endif // ENABLE(MEDIA_STREAM) >- >-#endif // CallbackTask_h >diff --git a/Source/WebCore/page/Frame.cpp b/Source/WebCore/page/Frame.cpp >index e353b49..83691ac 100644 >--- a/Source/WebCore/page/Frame.cpp >+++ b/Source/WebCore/page/Frame.cpp >@@ -111,10 +111,6 @@ > #include "SVGDocumentExtensions.h" > #endif > >-#if ENABLE(MEDIA_STREAM) >-#include "MediaStreamFrameController.h" >-#endif >- > #if USE(TILED_BACKING_STORE) > #include "TiledBackingStore.h" > #endif >@@ -169,9 +165,6 @@ inline Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoader > , m_inViewSourceMode(false) > , m_isDisconnected(false) > , m_excludeFromTextSearch(false) >-#if ENABLE(MEDIA_STREAM) >- , m_mediaStreamFrameController(RuntimeEnabledFeatures::mediaStreamEnabled() ? adoptPtr(new MediaStreamFrameController(this)) : PassOwnPtr<MediaStreamFrameController>()) >-#endif > { > ASSERT(page); > AtomicString::init(); >@@ -228,11 +221,6 @@ Frame::~Frame() > if (m_domWindow) > m_domWindow->disconnectFrame(); > >-#if ENABLE(MEDIA_STREAM) >- if (m_mediaStreamFrameController) >- m_mediaStreamFrameController->disconnectFrame(); >-#endif >- > HashSet<DOMWindow*>::iterator end = m_liveFormerWindows.end(); > for (HashSet<DOMWindow*>::iterator it = m_liveFormerWindows.begin(); it != end; ++it) > (*it)->disconnectFrame(); >@@ -698,11 +686,6 @@ void Frame::pageDestroyed() > m_domWindow->pageDestroyed(); > } > >-#if ENABLE(MEDIA_STREAM) >- if (m_mediaStreamFrameController) >- m_mediaStreamFrameController->disconnectPage(); >-#endif >- > // FIXME: It's unclear as to why this is called more than once, but it is, > // so page() could be NULL. > if (page() && page()->focusController()->focusedFrame() == this) >@@ -756,10 +739,6 @@ void Frame::transferChildFrameToNewDocument() > #endif > } > >-#if ENABLE(MEDIA_STREAM) >- if (m_mediaStreamFrameController) >- m_mediaStreamFrameController->transferToNewPage(newPage); >-#endif > m_page = newPage; > > if (newPage) >diff --git a/Source/WebCore/page/Frame.h b/Source/WebCore/page/Frame.h >index 9ce3aec..e4f5889 100644 >--- a/Source/WebCore/page/Frame.h >+++ b/Source/WebCore/page/Frame.h >@@ -65,7 +65,6 @@ namespace WebCore { > class Document; > class FrameView; > class HTMLTableCellElement; >- class MediaStreamFrameController; > class RegularExpression; > class RenderPart; > class TiledBackingStore; >@@ -201,10 +200,6 @@ namespace WebCore { > NSImage* imageFromRect(NSRect) const; > #endif > >-#if ENABLE(MEDIA_STREAM) >- MediaStreamFrameController* mediaStreamFrameController() const { return m_mediaStreamFrameController.get(); } >-#endif >- > // Should only be called on the main frame of a page. > void notifyChromeClientWheelEventHandlerCountChanged() const; > >@@ -266,9 +261,6 @@ namespace WebCore { > OwnPtr<TiledBackingStore> m_tiledBackingStore; > #endif > >-#if ENABLE(MEDIA_STREAM) >- OwnPtr<MediaStreamFrameController> m_mediaStreamFrameController; >-#endif > }; > > inline void Frame::init() >diff --git a/Source/WebCore/page/Navigator.cpp b/Source/WebCore/page/Navigator.cpp >index ccfbfb9..0a0756d 100644 >--- a/Source/WebCore/page/Navigator.cpp >+++ b/Source/WebCore/page/Navigator.cpp >@@ -46,9 +46,9 @@ > #include <wtf/StdLibExtras.h> > > #if ENABLE(MEDIA_STREAM) >-#include "MediaStreamFrameController.h" > #include "NavigatorUserMediaErrorCallback.h" > #include "NavigatorUserMediaSuccessCallback.h" >+#include "UserMediaRequest.h" > #endif > > namespace WebCore { >@@ -284,8 +284,27 @@ void Navigator::registerProtocolHandler(const String& scheme, const String& url, > #if ENABLE(MEDIA_STREAM) > void Navigator::webkitGetUserMedia(const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback> successCallback, PassRefPtr<NavigatorUserMediaErrorCallback> errorCallback, ExceptionCode& ec) > { >- if (m_frame && m_frame->mediaStreamFrameController()) >- m_frame->mediaStreamFrameController()->generateStream(options, successCallback, errorCallback, ec); >+ if (!successCallback) >+ return; >+ >+ if (!m_frame) >+ return; >+ >+ Page* page = m_frame->page(); >+ if (!page) >+ return; >+ >+ UserMediaClient* client = page->userMediaClient(); >+ if (!client) >+ return; >+ >+ RefPtr<UserMediaRequest> request = UserMediaRequest::create(m_frame->document(), client, options, successCallback, errorCallback); >+ if (!request) { >+ ec = NOT_SUPPORTED_ERR; >+ return; >+ } >+ >+ request->start(); > } > #endif > >diff --git a/Source/WebCore/page/NavigatorUserMediaErrorCallback.h b/Source/WebCore/page/NavigatorUserMediaErrorCallback.h >index 1539709..dd3c8b3 100644 >--- a/Source/WebCore/page/NavigatorUserMediaErrorCallback.h >+++ b/Source/WebCore/page/NavigatorUserMediaErrorCallback.h >@@ -27,14 +27,12 @@ > > #if ENABLE(MEDIA_STREAM) > >-#include "CallbackTask.h" > #include "NavigatorUserMediaError.h" > #include <wtf/RefCounted.h> > > namespace WebCore { > >-class NavigatorUserMediaErrorCallback : public RefCounted<NavigatorUserMediaErrorCallback>, >- public CallbackTask1<NavigatorUserMediaErrorCallback, NavigatorUserMediaError>::Scheduler { >+class NavigatorUserMediaErrorCallback : public RefCounted<NavigatorUserMediaErrorCallback> { > public: > virtual ~NavigatorUserMediaErrorCallback() { } > virtual bool handleEvent(NavigatorUserMediaError*) = 0; >diff --git a/Source/WebCore/page/Page.cpp b/Source/WebCore/page/Page.cpp >index 8695591..a588a30 100644 >--- a/Source/WebCore/page/Page.cpp >+++ b/Source/WebCore/page/Page.cpp >@@ -79,11 +79,6 @@ > #include "GeolocationController.h" > #endif > >-#if ENABLE(MEDIA_STREAM) >-#include "MediaStreamClient.h" >-#include "MediaStreamController.h" >-#endif >- > namespace WebCore { > > static HashSet<Page*>* allPages; >@@ -137,12 +132,12 @@ Page::Page(PageClients& pageClients) > , m_deviceMotionController(RuntimeEnabledFeatures::deviceMotionEnabled() ? adoptPtr(new DeviceMotionController(pageClients.deviceMotionClient)) : nullptr) > , m_deviceOrientationController(RuntimeEnabledFeatures::deviceOrientationEnabled() ? adoptPtr(new DeviceOrientationController(this, pageClients.deviceOrientationClient)) : nullptr) > #endif >-#if ENABLE(MEDIA_STREAM) >- , m_mediaStreamController(RuntimeEnabledFeatures::mediaStreamEnabled() ? adoptPtr(new MediaStreamController(pageClients.mediaStreamClient)) : PassOwnPtr<MediaStreamController>()) >-#endif > #if ENABLE(INPUT_SPEECH) > , m_speechInputClient(pageClients.speechInputClient) > #endif >+#if ENABLE(MEDIA_STREAM) >+ , m_userMediaClient(pageClients.userMediaClient) >+#endif > , m_settings(adoptPtr(new Settings(this))) > , m_progress(adoptPtr(new ProgressTracker)) > , m_backForwardController(adoptPtr(new BackForwardController(this, pageClients.backForwardClient))) >@@ -1042,7 +1037,7 @@ Page::PageClients::PageClients() > , deviceMotionClient(0) > , deviceOrientationClient(0) > , speechInputClient(0) >- , mediaStreamClient(0) >+ , userMediaClient(0) > { > } > >diff --git a/Source/WebCore/page/Page.h b/Source/WebCore/page/Page.h >index 4a7448d..025e104 100644 >--- a/Source/WebCore/page/Page.h >+++ b/Source/WebCore/page/Page.h >@@ -71,8 +71,6 @@ namespace WebCore { > class InspectorClient; > class InspectorController; > class MediaCanStartListener; >- class MediaStreamClient; >- class MediaStreamController; > class Node; > class PageGroup; > class PluginData; >@@ -84,6 +82,7 @@ namespace WebCore { > class Settings; > class SpeechInput; > class SpeechInputClient; >+ class UserMediaClient; > class StorageNamespace; > #if ENABLE(NOTIFICATIONS) > class NotificationPresenter; >@@ -118,7 +117,7 @@ namespace WebCore { > DeviceOrientationClient* deviceOrientationClient; > RefPtr<BackForwardList> backForwardClient; > SpeechInputClient* speechInputClient; >- MediaStreamClient* mediaStreamClient; >+ UserMediaClient* userMediaClient; > }; > > Page(PageClients&); >@@ -184,12 +183,12 @@ namespace WebCore { > DeviceMotionController* deviceMotionController() const { return m_deviceMotionController.get(); } > DeviceOrientationController* deviceOrientationController() const { return m_deviceOrientationController.get(); } > #endif >-#if ENABLE(MEDIA_STREAM) >- MediaStreamController* mediaStreamController() const { return m_mediaStreamController.get(); } >-#endif > #if ENABLE(INPUT_SPEECH) > SpeechInput* speechInput(); > #endif >+#if ENABLE(MEDIA_STREAM) >+ UserMediaClient* userMediaClient() const { return m_userMediaClient; } >+#endif > Settings* settings() const { return m_settings.get(); } > ProgressTracker* progress() const { return m_progress.get(); } > BackForwardController* backForward() const { return m_backForwardController.get(); } >@@ -364,13 +363,13 @@ namespace WebCore { > OwnPtr<DeviceMotionController> m_deviceMotionController; > OwnPtr<DeviceOrientationController> m_deviceOrientationController; > #endif >-#if ENABLE(MEDIA_STREAM) >- OwnPtr<MediaStreamController> m_mediaStreamController; >-#endif > #if ENABLE(INPUT_SPEECH) > SpeechInputClient* m_speechInputClient; > OwnPtr<SpeechInput> m_speechInput; > #endif >+#if ENABLE(MEDIA_STREAM) >+ UserMediaClient* m_userMediaClient; >+#endif > OwnPtr<Settings> m_settings; > OwnPtr<ProgressTracker> m_progress; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
abarth
:
review+
webkit.review.bot
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 70897
:
113144
|
114178
|
114476
|
114706
|
115412
|
115493