https://bugs.webkit.org/show_bug.cgi?id=79050
Reviewed by Adam Barth.
Source/WebCore:
Added UserMediaController which implements PageSupplement. This
controller mediates WebCore-to-client communication and lifecycle
management. Then pushed UserMediaController out as a
PageSupplement module.
No new tests. No behavior change.
* WebCore.gypi:
* GNUmakefile.list.am:
* mediastream/NavigatorMediaStream.cpp:
(WebCore::NavigatorMediaStream::webkitGetUserMedia):
* mediastream/UserMediaClient.h:
(WebCore):
* mediastream/UserMediaController.cpp: Added.
(WebCore):
(WebCore::UserMediaController::supplementName):
(WebCore::UserMediaController::UserMediaController):
(WebCore::UserMediaController::~UserMediaController):
(WebCore::UserMediaController::create):
(WebCore::provideUserMediaTo):
* mediastream/UserMediaController.h: Added.
(WebCore):
(UserMediaController):
(WebCore::UserMediaController::client):
(WebCore::UserMediaController::from):
(WebCore::UserMediaController::requestUserMedia):
(WebCore::UserMediaController::cancelUserMediaRequest):
* mediastream/UserMediaRequest.cpp:
(WebCore::UserMediaRequest::create):
(WebCore::UserMediaRequest::UserMediaRequest):
(WebCore::UserMediaRequest::didCompleteQuery):
(WebCore::UserMediaRequest::contextDestroyed):
* mediastream/UserMediaRequest.h:
(WebCore):
(UserMediaRequest):
* page/Page.cpp:
(WebCore::Page::Page):
(WebCore::Page::~Page):
(WebCore::Page::PageClients::PageClients):
* page/Page.h:
(WebCore):
(PageClients):
(Page):
Source/WebKit/chromium:
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::WebViewImpl):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108437
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-02-20 MORITA Hajime <morrita@google.com>
+
+ MEDIA_STREAM should be implemented as a PageSupplement.
+ https://bugs.webkit.org/show_bug.cgi?id=79050
+
+ Reviewed by Adam Barth.
+
+ Added UserMediaController which implements PageSupplement. This
+ controller mediates WebCore-to-client communication and lifecycle
+ management. Then pushed UserMediaController out as a
+ PageSupplement module.
+
+ No new tests. No behavior change.
+
+ * WebCore.gypi:
+ * GNUmakefile.list.am:
+ * mediastream/NavigatorMediaStream.cpp:
+ (WebCore::NavigatorMediaStream::webkitGetUserMedia):
+ * mediastream/UserMediaClient.h:
+ (WebCore):
+ * mediastream/UserMediaController.cpp: Added.
+ (WebCore):
+ (WebCore::UserMediaController::supplementName):
+ (WebCore::UserMediaController::UserMediaController):
+ (WebCore::UserMediaController::~UserMediaController):
+ (WebCore::UserMediaController::create):
+ (WebCore::provideUserMediaTo):
+ * mediastream/UserMediaController.h: Added.
+ (WebCore):
+ (UserMediaController):
+ (WebCore::UserMediaController::client):
+ (WebCore::UserMediaController::from):
+ (WebCore::UserMediaController::requestUserMedia):
+ (WebCore::UserMediaController::cancelUserMediaRequest):
+ * mediastream/UserMediaRequest.cpp:
+ (WebCore::UserMediaRequest::create):
+ (WebCore::UserMediaRequest::UserMediaRequest):
+ (WebCore::UserMediaRequest::didCompleteQuery):
+ (WebCore::UserMediaRequest::contextDestroyed):
+ * mediastream/UserMediaRequest.h:
+ (WebCore):
+ (UserMediaRequest):
+ * page/Page.cpp:
+ (WebCore::Page::Page):
+ (WebCore::Page::~Page):
+ (WebCore::Page::PageClients::PageClients):
+ * page/Page.h:
+ (WebCore):
+ (PageClients):
+ (Page):
+
2012-02-21 James Robinson <jamesr@chromium.org>
Node::isContentEditable should only update styles, not layout
Source/WebCore/mediastream/PeerConnection.h \
Source/WebCore/mediastream/SignalingCallback.h \
Source/WebCore/mediastream/UserMediaClient.h \
+ Source/WebCore/mediastream/UserMediaController.h \
+ Source/WebCore/mediastream/UserMediaController.cpp \
Source/WebCore/mediastream/UserMediaRequest.cpp \
Source/WebCore/mediastream/UserMediaRequest.h \
Source/WebCore/notifications/NotificationCenter.cpp \
'mediastream/PeerConnection.h',
'mediastream/SignalingCallback.h',
'mediastream/UserMediaClient.h',
+ 'mediastream/UserMediaController.h',
+ 'mediastream/UserMediaController.cpp',
'mediastream/UserMediaRequest.cpp',
'mediastream/UserMediaRequest.h',
'notifications/Notification.cpp',
#include "NavigatorUserMediaErrorCallback.h"
#include "NavigatorUserMediaSuccessCallback.h"
#include "Page.h"
+#include "UserMediaController.h"
#include "UserMediaRequest.h"
namespace WebCore {
if (!successCallback)
return;
- Frame* frame = navigator->frame();
- if (!frame)
- return;
-
- Page* page = frame->page();
- if (!page)
+ UserMediaController* userMedia = UserMediaController::from(navigator->frame());
+ if (!userMedia) {
+ ec = NOT_SUPPORTED_ERR;
return;
+ }
- RefPtr<UserMediaRequest> request = UserMediaRequest::create(frame->document(), page->userMediaClient(), options, successCallback, errorCallback);
+ RefPtr<UserMediaRequest> request = UserMediaRequest::create(navigator->frame()->document(), userMedia, options, successCallback, errorCallback);
if (!request) {
ec = NOT_SUPPORTED_ERR;
return;
namespace WebCore {
+class Page;
+
class UserMediaClient {
public:
virtual void pageDestroyed() = 0;
virtual ~UserMediaClient() { }
};
+void provideUserMediaTo(Page*, UserMediaClient*);
+
} // namespace WebCore
#endif // ENABLE(MEDIA_STREAM)
--- /dev/null
+/*
+ * Copyright (C) 2012 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 "UserMediaController.h"
+
+#if ENABLE(MEDIA_STREAM)
+
+namespace WebCore {
+
+const AtomicString& UserMediaController::supplementName()
+{
+ DEFINE_STATIC_LOCAL(AtomicString, name, ("userMediaController"));
+ return name;
+}
+
+UserMediaController::UserMediaController(UserMediaClient* client)
+ : m_client(client)
+{
+}
+
+UserMediaController::~UserMediaController()
+{
+ m_client->pageDestroyed();
+}
+
+PassOwnPtr<UserMediaController> UserMediaController::create(UserMediaClient* client)
+{
+ return adoptPtr(new UserMediaController(client));
+}
+
+void provideUserMediaTo(Page* page, UserMediaClient* client)
+{
+ PageSupplement::provideTo(page, UserMediaController::supplementName(), UserMediaController::create(client));
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
--- /dev/null
+/*
+ * Copyright (C) 2012 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 UserMediaController_h
+#define UserMediaController_h
+
+#if ENABLE(MEDIA_STREAM)
+
+#include "PageSupplement.h"
+#include "UserMediaClient.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace WebCore {
+
+class Frame;
+class Page;
+
+class UserMediaController : public PageSupplement {
+public:
+ ~UserMediaController();
+
+ UserMediaClient* client() const { return m_client; }
+ void requestUserMedia(PassRefPtr<UserMediaRequest>, const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources);
+ void cancelUserMediaRequest(UserMediaRequest*);
+
+ static PassOwnPtr<UserMediaController> create(UserMediaClient*);
+ static const AtomicString& supplementName();
+ static UserMediaController* from(Frame* frame) { return static_cast<UserMediaController*>(PageSupplement::from(frame, supplementName())); }
+ static UserMediaController* from(Page* page) { return static_cast<UserMediaController*>(PageSupplement::from(page, supplementName())); }
+
+protected:
+ UserMediaController(UserMediaClient*);
+
+private:
+ UserMediaClient* m_client;
+};
+
+inline void UserMediaController::requestUserMedia(PassRefPtr<UserMediaRequest> request, const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources)
+{
+ m_client->requestUserMedia(request, audioSources, videoSources);
+}
+
+inline void UserMediaController::cancelUserMediaRequest(UserMediaRequest* request)
+{
+ m_client->cancelUserMediaRequest(request);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
+
+#endif // UserMediaController_h
#include "LocalMediaStream.h"
#include "SpaceSplitString.h"
-#include "UserMediaClient.h"
+#include "UserMediaController.h"
namespace WebCore {
-PassRefPtr<UserMediaRequest> UserMediaRequest::create(ScriptExecutionContext* context, UserMediaClient* client, const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback> successCallback, PassRefPtr<NavigatorUserMediaErrorCallback> errorCallback)
+PassRefPtr<UserMediaRequest> UserMediaRequest::create(ScriptExecutionContext* context, UserMediaController* controller, const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback> successCallback, PassRefPtr<NavigatorUserMediaErrorCallback> errorCallback)
{
- RefPtr<UserMediaRequest> request = adoptRef(new UserMediaRequest(context, client, options, successCallback, errorCallback));
+ RefPtr<UserMediaRequest> request = adoptRef(new UserMediaRequest(context, controller, 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)
+UserMediaRequest::UserMediaRequest(ScriptExecutionContext* context, UserMediaController* controller, 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_controller(controller)
, m_successCallback(successCallback)
, m_errorCallback(errorCallback)
{
void UserMediaRequest::didCompleteQuery(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources)
{
- if (m_client)
- m_client->requestUserMedia(this, audioSources, videoSources);
+ if (m_controller)
+ m_controller->requestUserMedia(this, audioSources, videoSources);
}
void UserMediaRequest::succeed(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources)
void UserMediaRequest::contextDestroyed()
{
- if (m_client) {
- m_client->cancelUserMediaRequest(this);
- m_client = 0;
+ if (m_controller) {
+ m_controller->cancelUserMediaRequest(this);
+ m_controller = 0;
}
ContextDestructionObserver::contextDestroyed();
namespace WebCore {
-class UserMediaClient;
+class UserMediaController;
class UserMediaRequest : public MediaStreamSourcesQueryClient, public ContextDestructionObserver {
public:
- static PassRefPtr<UserMediaRequest> create(ScriptExecutionContext*, UserMediaClient*, const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback>, PassRefPtr<NavigatorUserMediaErrorCallback>);
+ static PassRefPtr<UserMediaRequest> create(ScriptExecutionContext*, UserMediaController*, const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback>, PassRefPtr<NavigatorUserMediaErrorCallback>);
~UserMediaRequest();
NavigatorUserMediaSuccessCallback* successCallback() const { return m_successCallback.get(); }
virtual void contextDestroyed();
private:
- UserMediaRequest(ScriptExecutionContext*, UserMediaClient*, const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback>, PassRefPtr<NavigatorUserMediaErrorCallback>);
+ UserMediaRequest(ScriptExecutionContext*, UserMediaController*, const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback>, PassRefPtr<NavigatorUserMediaErrorCallback>);
void parseOptions(const String& options);
bool m_cameraPreferenceUser;
bool m_cameraPreferenceEnvironment;
- UserMediaClient* m_client;
+ UserMediaController* m_controller;
RefPtr<NavigatorUserMediaSuccessCallback> m_successCallback;
RefPtr<NavigatorUserMediaErrorCallback> m_errorCallback;
#include "GeolocationController.h"
#endif
-#if ENABLE(MEDIA_STREAM)
-#include "UserMediaClient.h"
-#endif
-
namespace WebCore {
static HashSet<Page*>* allPages;
#if ENABLE(INPUT_SPEECH)
, m_speechInputClient(pageClients.speechInputClient)
#endif
-#if ENABLE(MEDIA_STREAM)
- , m_userMediaClient(pageClients.userMediaClient)
-#endif
, m_settings(Settings::create(this))
, m_progress(ProgressTracker::create())
, m_backForwardController(BackForwardController::create(this, pageClients.backForwardClient))
m_inspectorController->inspectedPageDestroyed();
#endif
-#if ENABLE(MEDIA_STREAM)
- if (m_userMediaClient)
- m_userMediaClient->pageDestroyed();
-#endif
-
if (m_scrollingCoordinator)
m_scrollingCoordinator->pageDestroyed();
, geolocationClient(0)
, speechInputClient(0)
, notificationClient(0)
- , userMediaClient(0)
{
}
class Settings;
class SpeechInput;
class SpeechInputClient;
- class UserMediaClient;
class StorageNamespace;
#if ENABLE(NOTIFICATIONS)
class NotificationPresenter;
RefPtr<BackForwardList> backForwardClient;
SpeechInputClient* speechInputClient;
NotificationPresenter* notificationClient;
- UserMediaClient* userMediaClient;
};
Page(PageClients&);
#if ENABLE(INPUT_SPEECH)
SpeechInput* speechInput();
#endif
-#if ENABLE(MEDIA_STREAM)
- UserMediaClient* userMediaClient() const { return m_userMediaClient; }
-#endif
ScrollingCoordinator* scrollingCoordinator();
Settings* settings() const { return m_settings.get(); }
SpeechInputClient* m_speechInputClient;
OwnPtr<SpeechInput> m_speechInput;
#endif
-#if ENABLE(MEDIA_STREAM)
- UserMediaClient* m_userMediaClient;
-#endif
RefPtr<ScrollingCoordinator> m_scrollingCoordinator;
OwnPtr<Settings> m_settings;
+2012-02-20 MORITA Hajime <morrita@google.com>
+
+ MEDIA_STREAM should be implemented as a PageSupplement.
+ https://bugs.webkit.org/show_bug.cgi?id=79050
+
+ Reviewed by Adam Barth.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+
2012-02-21 Dana Jansens <danakj@chromium.org>
[chromium] Painting a layer clears opaque rect in untouched tiles
pageClients.notificationClient = notificationPresenterImpl();
#endif
pageClients.backForwardClient = BackForwardListChromium::create(this);
-#if ENABLE(MEDIA_STREAM)
- pageClients.userMediaClient = &m_userMediaClientImpl;
-#endif
m_page = adoptPtr(new Page(pageClients));
+#if ENABLE(MEDIA_STREAM)
+ provideUserMediaTo(m_page.get(), &m_userMediaClientImpl);
+#endif
provideDeviceOrientationTo(m_page.get(), m_deviceOrientationClientProxy.get());
m_geolocationClientProxy->setController(m_page->geolocationController());