Changeset 246302 in webkit


Ignore:
Timestamp:
Jun 10, 2019 6:14:23 PM (5 years ago)
Author:
Fujii Hironori
Message:

[WinCairo][MediaFoundation] Remove the unused video window
https://bugs.webkit.org/show_bug.cgi?id=198523

Reviewed by Don Olmstead.

Remove the video window which had been unused since Bug 150941.

No behavior change.

  • platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:

(WebCore::MediaPlayerPrivateMediaFoundation::MediaPlayerPrivateMediaFoundation):
(WebCore::MediaPlayerPrivateMediaFoundation::~MediaPlayerPrivateMediaFoundation):
(WebCore::MediaPlayerPrivateMediaFoundation::setSize):
(WebCore::MediaPlayerPrivateMediaFoundation::paint):
(WebCore::MediaPlayerPrivateMediaFoundation::hostWindow):
(WebCore::MediaPlayerPrivateMediaFoundation::createOutputNode):
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::setVideoWindow):
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::setDestinationRect):
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::createVideoSamples):
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::presentSample):
(WebCore::MediaPlayerPrivateMediaFoundation::VideoViewWndProc): Deleted.
(WebCore::MediaPlayerPrivateMediaFoundation::registerVideoWindowClass): Deleted.
(WebCore::MediaPlayerPrivateMediaFoundation::createVideoWindow): Deleted.
(WebCore::MediaPlayerPrivateMediaFoundation::destroyVideoWindow): Deleted.
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::presentSwapChain): Deleted.
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::updateDestRect): Deleted.

  • platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r246301 r246302  
     12019-06-10  Fujii Hironori  <Hironori.Fujii@sony.com>
     2
     3        [WinCairo][MediaFoundation] Remove the unused video window
     4        https://bugs.webkit.org/show_bug.cgi?id=198523
     5
     6        Reviewed by Don Olmstead.
     7
     8        Remove the video window which had been unused since Bug 150941.
     9
     10        No behavior change.
     11
     12        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
     13        (WebCore::MediaPlayerPrivateMediaFoundation::MediaPlayerPrivateMediaFoundation):
     14        (WebCore::MediaPlayerPrivateMediaFoundation::~MediaPlayerPrivateMediaFoundation):
     15        (WebCore::MediaPlayerPrivateMediaFoundation::setSize):
     16        (WebCore::MediaPlayerPrivateMediaFoundation::paint):
     17        (WebCore::MediaPlayerPrivateMediaFoundation::hostWindow):
     18        (WebCore::MediaPlayerPrivateMediaFoundation::createOutputNode):
     19        (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::setVideoWindow):
     20        (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::setDestinationRect):
     21        (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::createVideoSamples):
     22        (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::presentSample):
     23        (WebCore::MediaPlayerPrivateMediaFoundation::VideoViewWndProc): Deleted.
     24        (WebCore::MediaPlayerPrivateMediaFoundation::registerVideoWindowClass): Deleted.
     25        (WebCore::MediaPlayerPrivateMediaFoundation::createVideoWindow): Deleted.
     26        (WebCore::MediaPlayerPrivateMediaFoundation::destroyVideoWindow): Deleted.
     27        (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::presentSwapChain): Deleted.
     28        (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::updateDestRect): Deleted.
     29        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
     30
    1312019-06-10  Simon Fraser  <simon.fraser@apple.com>
    232
  • trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp

    r245846 r246302  
    9393    , m_preparingToPlay(false)
    9494    , m_volume(1.0)
    95     , m_hwndVideo(nullptr)
    9695    , m_networkState(MediaPlayer::Empty)
    9796    , m_readyState(MediaPlayer::HaveNothing)
    9897{
    9998    createSession();
    100     createVideoWindow();
    10199}
    102100
     
    104102{
    105103    notifyDeleted();
    106     destroyVideoWindow();
    107104    endSession();
    108105}
     
    360357        return;
    361358
    362     IntPoint positionInWindow(m_lastPaintRect.location());
    363 
    364359    FrameView* view = nullptr;
    365360    float deviceScaleFactor = 1.0f;
     
    369364    }
    370365
    371     LayoutPoint scrollPosition;
    372     if (view) {
    373         scrollPosition = view->scrollPositionForFixedPosition();
    374         positionInWindow = view->convertToContainingWindow(IntPoint(m_lastPaintRect.location()));
    375     }
    376 
    377     positionInWindow.move(-scrollPosition.x().toInt(), -scrollPosition.y().toInt());
    378 
    379     int x = positionInWindow.x() * deviceScaleFactor;
    380     int y = positionInWindow.y() * deviceScaleFactor;
    381366    int w = m_size.width() * deviceScaleFactor;
    382367    int h = m_size.height() * deviceScaleFactor;
    383368
    384     if (m_hwndVideo)
    385         ::MoveWindow(m_hwndVideo, x, y, w, h, FALSE);
    386 
    387369    RECT rc = { 0, 0, w, h };
    388370    videoDisplay->SetVideoPosition(nullptr, &rc);
     
    393375    if (context.paintingDisabled() || !m_player->visible())
    394376        return;
    395 
    396     m_lastPaintRect = rect;
    397377
    398378    if (m_presenter)
     
    646626}
    647627
    648 LRESULT CALLBACK MediaPlayerPrivateMediaFoundation::VideoViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
    649 {
    650     return DefWindowProc(hWnd, message, wParam, lParam);
    651 }
    652 
    653 LPCWSTR MediaPlayerPrivateMediaFoundation::registerVideoWindowClass()
    654 {
    655     const LPCWSTR kVideoWindowClassName = L"WebVideoWindowClass";
    656 
    657     static bool haveRegisteredWindowClass = false;
    658     if (haveRegisteredWindowClass)
    659         return kVideoWindowClassName;
    660 
    661     haveRegisteredWindowClass = true;
    662 
    663     WNDCLASSEX wcex;
    664 
    665     wcex.cbSize = sizeof(WNDCLASSEX);
    666 
    667     wcex.style = CS_DBLCLKS;
    668     wcex.lpfnWndProc = VideoViewWndProc;
    669     wcex.cbClsExtra = 0;
    670     wcex.cbWndExtra = 0;
    671     wcex.hInstance = nullptr;
    672     wcex.hIcon = nullptr;
    673     wcex.hCursor = ::LoadCursor(0, IDC_ARROW);
    674     wcex.hbrBackground = nullptr;
    675     wcex.lpszMenuName = nullptr;
    676     wcex.lpszClassName = kVideoWindowClassName;
    677     wcex.hIconSm = nullptr;
    678 
    679     if (RegisterClassEx(&wcex))
    680         return kVideoWindowClassName;
    681 
    682     return nullptr;
    683 }
    684 
    685 void MediaPlayerPrivateMediaFoundation::createVideoWindow()
    686 {
    687     HWND hWndParent = nullptr;
    688     FrameView* view = nullptr;
    689     if (!m_player || !m_player->cachedResourceLoader() || !m_player->cachedResourceLoader()->document())
    690         return;
    691     view = m_player->cachedResourceLoader()->document()->view();
    692     if (!view || !view->hostWindow())
    693         return;
    694     hWndParent = view->hostWindow()->platformPageClient();
    695 
    696     m_hwndVideo = CreateWindowEx(WS_EX_NOACTIVATE | WS_EX_TRANSPARENT, registerVideoWindowClass(), 0, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
    697         0, 0, 0, 0, hWndParent, 0, 0, 0);
    698 }
    699 
    700 void MediaPlayerPrivateMediaFoundation::destroyVideoWindow()
    701 {
    702     if (m_hwndVideo) {
    703         DestroyWindow(m_hwndVideo);
    704         m_hwndVideo = nullptr;
    705     }
     628HWND MediaPlayerPrivateMediaFoundation::hostWindow()
     629{
     630    if (m_player && m_player->cachedResourceLoader() && !m_player->cachedResourceLoader()->document()) {
     631        auto* view = m_player->cachedResourceLoader()->document()->view();
     632        if (view && view->hostWindow() && view->hostWindow()->platformPageClient())
     633            return view->hostWindow()->platformPageClient();
     634    }
     635    return GetDesktopWindow();
    706636}
    707637
     
    785715
    786716        m_presenter = new CustomVideoPresenter(this);
    787         m_presenter->SetVideoWindow(m_hwndVideo);
     717        m_presenter->SetVideoWindow(hostWindow());
    788718        if (FAILED(rendererActivate->SetUnknown(MF_ACTIVATE_CUSTOM_VIDEO_PRESENTER_ACTIVATE, static_cast<IMFActivate*>(m_presenter.get()))))
    789719            return false;
     
    27492679        LockHolder locker(m_lock);
    27502680        m_hwnd = hwnd;
    2751         updateDestRect();
    27522681    }
    27532682
     
    27632692
    27642693    m_destRect = rcDest;
    2765     updateDestRect();
    27662694
    27672695    return S_OK;
     
    27932721        return hr;
    27942722    }
    2795 
    2796     updateDestRect();
    27972723
    27982724    static const int presenterBufferCount = 3;
     
    29032829        }
    29042830
    2905         // Since we want to draw to the GraphicsContext provided in the paint method,
    2906         // and not draw directly to the window, we skip presenting the swap chain:
    2907 
    2908         // COMPtr<IDirect3DSwapChain9> swapChain;
    2909         // hr = surface->GetContainer(__uuidof(IDirect3DSwapChain9), (LPVOID*)&swapChain));
    2910         // hr = presentSwapChain(swapChain, surface));
    2911 
    29122831        // Keep the last surface for repaints.
    29132832        m_surfaceRepaint = surface;
     
    30752994}
    30762995
    3077 HRESULT MediaPlayerPrivateMediaFoundation::Direct3DPresenter::presentSwapChain(IDirect3DSwapChain9* swapChain, IDirect3DSurface9* surface)
    3078 {
    3079     if (!m_hwnd)
    3080         return MF_E_INVALIDREQUEST;
    3081 
    3082     return swapChain->Present(nullptr, &m_destRect, m_hwnd, nullptr, 0);
    3083 }
    3084 
    30852996HRESULT MediaPlayerPrivateMediaFoundation::Direct3DPresenter::getSwapChainPresentParameters(IMFMediaType* type, D3DPRESENT_PARAMETERS* presentParams)
    30862997{
     
    31233034}
    31243035
    3125 HRESULT MediaPlayerPrivateMediaFoundation::Direct3DPresenter::updateDestRect()
    3126 {
    3127     if (!m_hwnd)
    3128         return S_FALSE;
    3129 
    3130     RECT rcView;
    3131     if (!GetClientRect(m_hwnd, &rcView))
    3132         return E_FAIL;
    3133 
    3134     // Clip to the client area of the window.
    3135     if (m_destRect.right > rcView.right)
    3136         m_destRect.right = rcView.right;
    3137 
    3138     if (m_destRect.bottom > rcView.bottom)
    3139         m_destRect.bottom = rcView.bottom;
    3140 
    3141     return S_OK;
    3142 }
    3143 
    31443036} // namespace WebCore
    31453037
  • trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h

    r245846 r246302  
    111111    bool m_preparingToPlay;
    112112    float m_volume;
    113     HWND m_hwndVideo;
    114113    MediaPlayer::NetworkState m_networkState;
    115114    MediaPlayer::ReadyState m_readyState;
    116     FloatRect m_lastPaintRect;
    117115
    118116    class MediaPlayerListener;
     
    152150    void onSessionEnded();
    153151
    154     LPCWSTR registerVideoWindowClass();
    155     void createVideoWindow();
    156     void destroyVideoWindow();
    157 
     152    HWND hostWindow();
    158153    void invalidateFrameView();
    159154
     
    162157    void setNaturalSize(const FloatSize&);
    163158    void notifyDeleted();
    164 
    165     static LRESULT CALLBACK VideoViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
    166159
    167160    bool setAllChannelVolumes(float);
     
    300293        HRESULT createD3DDevice();
    301294        HRESULT createD3DSample(IDirect3DSwapChain9*, COMPtr<IMFSample>& videoSample);
    302         HRESULT updateDestRect();
    303 
    304         HRESULT presentSwapChain(IDirect3DSwapChain9*, IDirect3DSurface9*);
    305295
    306296        UINT m_deviceResetToken { 0 };
Note: See TracChangeset for help on using the changeset viewer.