Bug 59466

Summary: Incorrect OwnPtr usage in MediaPlayer
Product: WebKit Reporter: Adrienne Walker <enne>
Component: MediaAssignee: Patrick R. Gansterer <paroga>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, commit-queue, dglazkov, enne, gustavo, paroga, scherkus, vrk, webkit.review.bot, xan.lopez
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Adrienne Walker 2011-04-26 10:21:38 PDT
As part of the work to remove the LOOSE_OWN_PTR #define in OwnPtr.h, I was looking at Source/WebCore/platform/graphics/MediaPlayer* and saw this:

    OwnPtr<MediaPlayerPrivateInterface*> m_private;

It seems to be an error to me to store a raw pointer in an OwnPtr and that this really was intended to be OwnPtr<MediaPlayerPrivateInterface>.  

I don't know if it's possible, but it'd also probably be nice to change the CreateMediaEnginePlayer interface to return a PassOwnPtr<MediaPlayerPrivateInterface> too.
Comment 1 Patrick R. Gansterer 2011-05-11 16:45:50 PDT
Created attachment 93213 [details]
Patch
Comment 2 Adam Barth 2011-05-11 16:53:27 PDT
Comment on attachment 93213 [details]
Patch

Fantastic.  Thanks!
Comment 3 WebKit Review Bot 2011-05-11 17:07:13 PDT
Comment on attachment 93213 [details]
Patch

Attachment 93213 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/8690451
Comment 4 Adrienne Walker 2011-05-11 17:23:34 PDT
In retrospect, I was confused about OwnPtr<T*> which turns out to be exactly equivalent to OwnPtr<T> thanks to template magic.  Its only sin is that it's stylistically confusing.

The only bit of this patch that really needs to be there is to just remove the LOOSE_OWN_PTR #define and fix the few lines that break because of it.  Changing the CreateMediaEnginePlayer interface is probably not necessary.
Comment 5 Patrick R. Gansterer 2011-05-11 17:25:36 PDT
(In reply to comment #4)
> The only bit of this patch that really needs to be there is to just remove the LOOSE_OWN_PTR #define and fix the few lines that break because of it.  Changing the CreateMediaEnginePlayer interface is probably not necessary.
adoptPtr should be done directly when calling new, so we need to change CreateMediaEnginePlayer too.
Comment 6 Patrick R. Gansterer 2011-05-11 18:00:39 PDT
Created attachment 93227 [details]
Patch
Comment 7 WebKit Review Bot 2011-05-11 19:42:57 PDT
Comment on attachment 93227 [details]
Patch

Attachment 93227 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/8685589
Comment 8 Gustavo Noronha (kov) 2011-05-12 11:08:47 PDT
Comment on attachment 93227 [details]
Patch

Attachment 93227 [details] did not pass gtk-ews (gtk):
Output: http://queues.webkit.org/results/8688764
Comment 9 Patrick R. Gansterer 2011-05-12 15:16:26 PDT
Created attachment 93355 [details]
Patch
Comment 10 WebKit Commit Bot 2011-05-13 00:36:34 PDT
The commit-queue encountered the following flaky tests while processing attachment 93355 [details]:

inspector/debugger/debugger-scripts.html bug 59921 (authors: pfeldman@chromium.org and podivilov@chromium.org)
The commit-queue is continuing to process your patch.
Comment 11 WebKit Commit Bot 2011-05-13 00:38:01 PDT
Comment on attachment 93355 [details]
Patch

Clearing flags on attachment: 93355

Committed r86418: <http://trac.webkit.org/changeset/86418>
Comment 12 WebKit Commit Bot 2011-05-13 00:38:07 PDT
All reviewed patches have been landed.  Closing bug.