RESOLVED WONTFIX43394
[Chromium] Full screen media player interface between WebMediaPlayer and WebWidgetClient
https://bugs.webkit.org/show_bug.cgi?id=43394
Summary [Chromium] Full screen media player interface between WebMediaPlayer and WebW...
Bo Liu
Reported 2010-08-02 17:18:01 PDT
Add class WebFullscreenMediaPlayer that interfaces between WebMediaPlayer and WebWidgetClient. Add methods for WebMediaPlayer to set the WebMediaPlayerClient. WebFullscreenMediaPlayer inherits from WebWidget (interface used by WebWidgetClient) and WebMediaPlayerClient (interface used by WebMediaPlayer). WebFullscreenMediaPlayer shortcuts the invalidate/paint cycle. This patches depends on this chromium patch (http://codereview.chromium.org/3055009/show). Will upload corresponding chromium patch.
Attachments
Patch (16.73 KB, patch)
2010-08-02 17:19 PDT, Bo Liu
no flags
Patch (16.74 KB, patch)
2010-08-03 11:34 PDT, Bo Liu
no flags
Patch (24.09 KB, patch)
2010-08-03 16:57 PDT, Bo Liu
no flags
Patch (24.21 KB, patch)
2010-08-17 15:13 PDT, Bo Liu
no flags
Patch (23.97 KB, patch)
2010-10-21 17:48 PDT, Andrew Scherkus
abarth: review-
Bo Liu
Comment 1 2010-08-02 17:19:24 PDT
Bo Liu
Comment 2 2010-08-02 17:31:28 PDT
Corresponding chromium patch: http://codereview.chromium.org/3026043
WebKit Review Bot
Comment 3 2010-08-02 17:42:49 PDT
David Levin
Comment 4 2010-08-03 11:26:35 PDT
Comment on attachment 63281 [details] Patch Drive by comment. > diff --git a/WebKit/chromium/public/WebFullscreenMediaPlayer.h b/WebKit/chromium/public/WebFullscreenMediaPlayer.h > + WebFullscreenMediaPlayer(WebWidgetClient* webWidgetClient); The parameter name "webWidgetClient" shouldn't be here.
David Levin
Comment 5 2010-08-03 11:27:39 PDT
Adding Darin Fisher since this involves the chromium public api.
Bo Liu
Comment 6 2010-08-03 11:34:11 PDT
WebKit Review Bot
Comment 7 2010-08-03 11:46:07 PDT
Darin Fisher (:fishd, Google)
Comment 8 2010-08-03 12:34:26 PDT
Comment on attachment 63358 [details] Patch WebKit/chromium/public/WebMediaPlayer.h:84 + virtual WebMediaPlayerClient* GetClient() const = 0; use webkit style here. this should be client() and setClient(), but i have to ask: why do you need the client to be accessible like this, and why do you need it to be mutable? we have so far tried to avoid exposing clients like this. what problem are you trying to solve? WebKit/chromium/public/WebPopupType.h:40 + WebPopupTypeFullscreenMediaPlayer, why does this popup type need to be media player specific? in the future, we may have other needs for a fullscreen popup, and i think the code you are adding could be used for that too. so i would drop the MediaPlayer suffix. WebKit/chromium/public/WebViewClient.h:91 + virtual WebWidget* createFullscreenWindow(WebPopupType) { return 0; } i don't see why you need to pass WebPopupType to this method. but instead of removing it, perhaps it would be better to combine this function with the createPopupMenu(WebPopupType) method from above into a single: virtual WebWidget* createPopup(WebPopupType); then, deprecate the createPopupMenu(WebPopupType) method. WebKit/chromium/public/WebFullscreenMediaPlayer.h:53 + class WebFullscreenMediaPlayer : public WebWidget, implementation classes like this should go in chromium/src. what you should do in this case is make WebFullscreenMediaPlayer be an interface with a static create function (see WebPopupMenu.h). in chromium/src, you can have an implementation of WebFullscreenMediaPlayer.
Bo Liu
Comment 9 2010-08-03 12:56:50 PDT
Get/SetClient is used to replace the client in order to paint into full screen. Is the general design of replacing the client for full screen okay, or should WebMediaPlayer have methods like enterFullscreen(WebMediaPlayerFullscreenClient*) and exitFullscreen? Will get the other issues fixed.
Andrew Scherkus
Comment 10 2010-08-03 13:10:05 PDT
yeah the idea is to swap the client so the fullscreen RenderWidget can intercept the events bubbled up from the WebMediaPlayer (repaints, etc..)
Darin Fisher (:fishd, Google)
Comment 11 2010-08-03 13:55:48 PDT
(In reply to comment #9) > Get/SetClient is used to replace the client in order to paint into full screen. Can the client be a parameter to WebFullscreenMediaPlayer upon construction? > Is the general design of replacing the client for full screen okay, or should WebMediaPlayer have methods like enterFullscreen(WebMediaPlayerFullscreenClient*) and exitFullscreen? I don't follow this suggestion. In general, it is better for clients to be immutable and specified at object construction time.
Darin Fisher (:fishd, Google)
Comment 12 2010-08-03 13:56:48 PDT
do you need to intercept all client methods? or if it is only a subset of methods, should you define a WebFullscreenMediaPlayerClient interface?
Bo Liu
Comment 13 2010-08-03 14:06:43 PDT
(In reply to comment #12) > do you need to intercept all client methods? or if it is only a subset of methods, should you define a WebFullscreenMediaPlayerClient interface? Right now only the repaint call is intercepted. All other WebMediaPlayerClient calls are forwarded to the original client. However, there is no media control UI in full screen yet. The other calls will probably be needed intercepted as well when the controls are in place.
Bo Liu
Comment 14 2010-08-03 14:35:40 PDT
> WebKit/chromium/public/WebPopupType.h:40 > + WebPopupTypeFullscreenMediaPlayer, > why does this popup type need to be media player specific? in the future, > we may have other needs for a fullscreen popup, and i think the code you > are adding could be used for that too. so i would drop the MediaPlayer > suffix. > > WebKit/chromium/public/WebViewClient.h:91 > + virtual WebWidget* createFullscreenWindow(WebPopupType) { return 0; } > i don't see why you need to pass WebPopupType to this method. > > but instead of removing it, perhaps it would be better to combine > this function with the createPopupMenu(WebPopupType) method from > above into a single: > > virtual WebWidget* createPopup(WebPopupType); > > then, deprecate the createPopupMenu(WebPopupType) method. I thought about creating a generic full screen pop up type, and it might not work very well. Every WebPopupType match to one concrete sublcass of WebWidget. Then WebViewClient::createPopup will return a WebWidget* based on the pop up type passed in. If there is only a generic full screen type, it can only return a generic full screen subclass of WebWidget. Then the WebWidget will somehow need to be customized for full screen video, probably by introducing another interface. Is it possible for future uses of full screen to add new pop up types?
Bo Liu
Comment 15 2010-08-03 16:57:35 PDT
WebKit Review Bot
Comment 16 2010-08-03 17:45:16 PDT
Bo Liu
Comment 17 2010-08-17 15:13:09 PDT
Created attachment 64644 [details] Patch Fix handling keyboard inputs
WebKit Review Bot
Comment 18 2010-08-17 17:49:39 PDT
Andrew Scherkus
Comment 19 2010-08-18 12:41:38 PDT
so I don't see anything glaringly wrong with this patch -- overall makes sense however I'm not a WebKit reviewer so fishd should take another glance
Andrew Scherkus
Comment 20 2010-10-21 17:48:57 PDT
Andrew Scherkus
Comment 21 2010-10-21 17:59:55 PDT
I'm picking up boliu's leftover fullscreen patches. The general design was to try to reuse as much as the RenderWidget IPC codepath as possible. So we have a popup type (WebPopupTypeFullscreenMediaPlayer) and an implementation of it (WebFullscreenMediaPlayerClientImpl) The general idea is to swap the RenderWidget on WebMediaPlayerImpl so that WebMediaPlayerImpl starts receiving commands from the full screen widget (i.e., seeking, pause, volume, paint) and responds with events. I'm not sure if this is still the right approach so I'm open to ideas!
WebKit Review Bot
Comment 22 2010-10-23 21:53:47 PDT
Adam Barth
Comment 23 2011-01-12 16:57:59 PST
Comment on attachment 71515 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=71515&action=review I'm worried that this patch introduces memory safety issues. It might well be fine, but I'm not sure it's correct. > WebKit/chromium/src/ChromeClientImpl.cpp:836 > + fullscreenClient->exitFullscreen(); When does the client get deleted? > WebKit/chromium/src/WebFullscreenMediaPlayerClientImpl.cpp:43 > +namespace WebKit { Missing blank line after this line. > WebKit/chromium/src/WebFullscreenMediaPlayerClientImpl.cpp:46 > + return new WebFullscreenMediaPlayerClientImpl(client); Is this normal memory management for the Chromium API? In WebCore, we'd use something like a PassOwnPtr. > WebKit/chromium/src/WebFullscreenMediaPlayerClientImpl.cpp:84 > + delete this; I see. This seems like a dangerous pattern for memory management, but maybe it's the norm? > WebKit/chromium/src/WebFullscreenMediaPlayerClientImpl.cpp:94 > + // Called when first created. Can this be called multiple times? I don't really understand this comment. > WebKit/chromium/src/WebFullscreenMediaPlayerClientImpl.cpp:118 > + switch (static_cast<const WebKeyboardEvent&>(event).windowsKeyCode) { Bad indent. > WebKit/chromium/src/WebFullscreenMediaPlayerClientImpl.cpp:121 > + m_mediaElement->play(m_mediaElement->processingUserGesture()); Why are we asking the media element if its processing a user gesture? Whether we're processing a user gesture is static state. > WebKit/chromium/src/WebFullscreenMediaPlayerClientImpl.h:103 > + // Weak pointer to WebWidgetClient. It's not technically a weak pointer, right? There's no notification of when the client destructs itself. > WebKit/chromium/src/WebFullscreenMediaPlayerClientImpl.h:109 > + // Pointer to the corresponding media element is saved > + // for properly exiting full screen as a result of user > + // action. > + WebCore::HTMLMediaElement* m_mediaElement; We don't need to hold a reference to the element here? What if it gets removed from the DOM and deallocated?
Andrew Scherkus
Comment 24 2011-01-12 17:13:31 PST
holy smokes I hope you didn't spend too much time reviewing this adam! I think this patch (and possibly associated ones) will be made obsolete due to recent "real" fullscreen support
Adam Barth
Comment 25 2011-01-12 18:40:35 PST
(In reply to comment #24) > holy smokes I hope you didn't spend too much time reviewing this adam! No problem. I'm just trying to clear out the backlog of seemingly forgotten review requests. > I think this patch (and possibly associated ones) will be made obsolete due to recent "real" fullscreen support It would be helpful if you could mark them obsolete in the bug tracker so they don't show up in http://webkit.org/pending-review. Glad to hear we're getting real fullscreen support. :)
Note You need to log in before you can comment on or make changes to this bug.