⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 267599 in webkit


Ignore:
Timestamp:
Sep 25, 2020, 3:09:29 PM (6 years ago)
Author:
Peng Liu
Message:

Replace the usages of (IPC::Attachment fencePort) with IPC::MachPort
https://bugs.webkit.org/show_bug.cgi?id=207683

Reviewed by Daniel Bates.

No new tests, no functional change.

  • UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:

(WebKit::VideoFullscreenManagerProxy::setVideoLayerFrame): Replace the
IPC::Attachment argument with a MachSendRight.

  • WebProcess/cocoa/VideoFullscreenManager.h:
  • WebProcess/cocoa/VideoFullscreenManager.messages.in:
  • WebProcess/cocoa/VideoFullscreenManager.mm:

(WebKit::VideoFullscreenManager::setVideoLayerFrameFenced):
r232451 adds a check for mach port disposition, which is not necessary now.
Because ArgumentCoder<MachSendRight>::decode() provides the check.

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::setTopContentInset): Replace the IPC::Attachment
argument with a MachSendRight.

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::setTopContentInsetFenced): Ditto.
r232451 adds a check for mach port disposition, which is not necessary now.
Because ArgumentCoder<MachSendRight>::decode() provides the check.

  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/WebPage.messages.in:
Location:
trunk/Source/WebKit
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r267597 r267599  
     12020-09-25  Peng Liu  <peng.liu6@apple.com>
     2
     3        Replace the usages of (IPC::Attachment fencePort) with IPC::MachPort
     4        https://bugs.webkit.org/show_bug.cgi?id=207683
     5
     6        Reviewed by Daniel Bates.
     7
     8        No new tests, no functional change.
     9
     10        * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
     11        (WebKit::VideoFullscreenManagerProxy::setVideoLayerFrame): Replace the
     12        IPC::Attachment argument with a MachSendRight.
     13        * WebProcess/cocoa/VideoFullscreenManager.h:
     14        * WebProcess/cocoa/VideoFullscreenManager.messages.in:
     15        * WebProcess/cocoa/VideoFullscreenManager.mm:
     16        (WebKit::VideoFullscreenManager::setVideoLayerFrameFenced):
     17        r232451 adds a check for mach port disposition, which is not necessary now.
     18        Because ArgumentCoder<MachSendRight>::decode() provides the check.
     19
     20        * UIProcess/WebPageProxy.cpp:
     21        (WebKit::WebPageProxy::setTopContentInset): Replace the IPC::Attachment
     22        argument with a MachSendRight.
     23        * WebProcess/WebPage/WebPage.cpp:
     24        (WebKit::WebPage::setTopContentInsetFenced): Ditto.
     25        r232451 adds a check for mach port disposition, which is not necessary now.
     26        Because ArgumentCoder<MachSendRight>::decode() provides the check.
     27        * WebProcess/WebPage/WebPage.h:
     28        * WebProcess/WebPage/WebPage.messages.in:
     29
    1302020-09-25  Wenson Hsieh  <wenson_hsieh@apple.com>
    231
  • trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.mm

    r267053 r267599  
    789789void VideoFullscreenManagerProxy::setVideoLayerFrame(PlaybackSessionContextIdentifier contextId, WebCore::FloatRect frame)
    790790{
    791     @autoreleasepool {
    792 #if PLATFORM(IOS_FAMILY)
    793         mach_port_name_t fencePort = [UIWindow _synchronizeDrawingAcrossProcesses];
    794 #else
    795         MachSendRight fenceSendRight;
    796         if (DrawingAreaProxy* drawingArea = m_page->drawingArea())
    797             fenceSendRight = drawingArea->createFence();
    798         mach_port_name_t fencePort = fenceSendRight.leakSendRight();
    799 #endif
    800 
    801         m_page->send(Messages::VideoFullscreenManager::SetVideoLayerFrameFenced(contextId, frame, IPC::Attachment(fencePort, MACH_MSG_TYPE_MOVE_SEND)));
    802     }
     791#if PLATFORM(IOS_FAMILY)
     792    auto fenceSendRight = MachSendRight::adopt([UIWindow _synchronizeDrawingAcrossProcesses]);
     793#else
     794    MachSendRight fenceSendRight;
     795    if (DrawingAreaProxy* drawingArea = m_page->drawingArea())
     796        fenceSendRight = drawingArea->createFence();
     797#endif
     798
     799    m_page->send(Messages::VideoFullscreenManager::SetVideoLayerFrameFenced(contextId, frame, fenceSendRight));
    803800}
    804801
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r267516 r267599  
    18221822        return;
    18231823#if PLATFORM(COCOA)
    1824     MachSendRight fence = m_drawingArea->createFence();
    1825 
    1826     auto fenceAttachment = IPC::Attachment(fence.leakSendRight(), MACH_MSG_TYPE_MOVE_SEND);
    1827     send(Messages::WebPage::SetTopContentInsetFenced(contentInset, fenceAttachment));
     1824    send(Messages::WebPage::SetTopContentInsetFenced(contentInset, m_drawingArea->createFence()));
    18281825#else
    18291826    send(Messages::WebPage::SetTopContentInset(contentInset));
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r267516 r267599  
    31743174
    31753175#if PLATFORM(COCOA)
    3176 void WebPage::setTopContentInsetFenced(float contentInset, IPC::Attachment fencePort)
    3177 {
    3178     if (fencePort.disposition() != MACH_MSG_TYPE_MOVE_SEND) {
    3179         LOG(Layers, "WebPage::setTopContentInsetFenced(%g, fencePort) Received an invalid fence port: %d, disposition: %d", contentInset, fencePort.port(), fencePort.disposition());
    3180         return;
    3181     }
    3182 
    3183     m_drawingArea->addFence(MachSendRight::create(fencePort.port()));
    3184 
     3176void WebPage::setTopContentInsetFenced(float contentInset, const WTF::MachSendRight& machSendRight)
     3177{
     3178    m_drawingArea->addFence(machSendRight);
    31853179    setTopContentInset(contentInset);
    3186 
    3187     deallocateSendRightSafely(fencePort.port());
    31883180}
    31893181#endif
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r266829 r267599  
    15321532
    15331533#if PLATFORM(COCOA)
    1534     void setTopContentInsetFenced(float, IPC::Attachment);
     1534    void setTopContentInsetFenced(float, const WTF::MachSendRight&);
    15351535#endif
    15361536    void setTopContentInset(float);
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in

    r266654 r267599  
    3535
    3636#if PLATFORM(COCOA)
    37     SetTopContentInsetFenced(float contentInset, IPC::Attachment fencePort)
     37    SetTopContentInsetFenced(float contentInset, MachSendRight machSendRight)
    3838#endif
    3939    SetTopContentInset(float contentInset)
  • trunk/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.h

    r266728 r267599  
    4141
    4242namespace IPC {
    43 class Attachment;
    4443class Connection;
    4544class Decoder;
    4645class MessageReceiver;
     46}
     47
     48namespace WTF {
     49class MachSendRight;
    4750}
    4851
     
    152155    void didEnterFullscreen(PlaybackSessionContextIdentifier, Optional<WebCore::FloatSize>);
    153156    void didCleanupFullscreen(PlaybackSessionContextIdentifier);
    154     void setVideoLayerFrameFenced(PlaybackSessionContextIdentifier, WebCore::FloatRect bounds, IPC::Attachment fencePort);
     157    void setVideoLayerFrameFenced(PlaybackSessionContextIdentifier, WebCore::FloatRect bounds, const WTF::MachSendRight&);
    155158    void setVideoLayerGravityEnum(PlaybackSessionContextIdentifier, unsigned gravity);
    156159    void fullscreenModeChanged(PlaybackSessionContextIdentifier, WebCore::HTMLMediaElementEnums::VideoFullscreenMode);
  • trunk/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.messages.in

    r266728 r267599  
    3232    DidEnterFullscreen(WebKit::PlaybackSessionContextIdentifier contextId, Optional<WebCore::FloatSize> size)
    3333    DidCleanupFullscreen(WebKit::PlaybackSessionContextIdentifier contextId)
    34     SetVideoLayerFrameFenced(WebKit::PlaybackSessionContextIdentifier contextId, WebCore::FloatRect bounds, IPC::Attachment fencePort)
     34    SetVideoLayerFrameFenced(WebKit::PlaybackSessionContextIdentifier contextId, WebCore::FloatRect bounds, MachSendRight machSendRight)
    3535    SetVideoLayerGravityEnum(WebKit::PlaybackSessionContextIdentifier contextId, unsigned gravity)
    3636    FullscreenModeChanged(WebKit::PlaybackSessionContextIdentifier contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode)
  • trunk/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm

    r266728 r267599  
    544544}
    545545   
    546 void VideoFullscreenManager::setVideoLayerFrameFenced(PlaybackSessionContextIdentifier contextId, WebCore::FloatRect bounds, IPC::Attachment fencePort)
     546void VideoFullscreenManager::setVideoLayerFrameFenced(PlaybackSessionContextIdentifier contextId, WebCore::FloatRect bounds, const WTF::MachSendRight& machSendRight)
    547547{
    548548    LOG(Fullscreen, "VideoFullscreenManager::setVideoLayerFrameFenced(%p, %x)", this, contextId);
    549 
    550     if (fencePort.disposition() != MACH_MSG_TYPE_MOVE_SEND) {
    551         LOG(Fullscreen, "VideoFullscreenManager::setVideoLayerFrameFenced(%p, %x) Received an invalid fence port: %d, disposition: %d", this, contextId, fencePort.port(), fencePort.disposition());
    552         return;
    553     }
    554549
    555550    auto [model, interface] = ensureModelAndInterface(contextId);
     
    561556   
    562557    if (auto* context = interface->layerHostingContext())
    563         context->setFencePort(fencePort.port());
     558        context->setFencePort(machSendRight.sendRight());
    564559    model->setVideoLayerFrame(bounds);
    565     deallocateSendRightSafely(fencePort.port());
    566560}
    567561
Note: See TracChangeset for help on using the changeset viewer.