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

Changeset 245936 in webkit


Ignore:
Timestamp:
May 30, 2019, 5:33:38 PM (7 years ago)
Author:
Alan Coon
Message:

Apply patch. rdar://problem/51056572

Location:
branches/safari-607-branch
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-607-branch/Source/WebKit/Shared/API/Cocoa/RemoteObjectRegistry.h

    r233713 r245936  
    2424 */
    2525
    26 #ifndef RemoteObjectRegistry_h
    27 #define RemoteObjectRegistry_h
     26#pragma once
    2827
    2928#include "MessageReceiver.h"
    3029#include "ProcessThrottler.h"
    3130#include <wtf/Function.h>
     31#include <wtf/WeakObjCPtr.h>
     32#include <wtf/WeakPtr.h>
    3233
    3334OBJC_CLASS _WKRemoteObjectRegistry;
     
    4445class WebPageProxy;
    4546
    46 class RemoteObjectRegistry final : public IPC::MessageReceiver {
     47class RemoteObjectRegistry final : public CanMakeWeakPtr<RemoteObjectRegistry>, public IPC::MessageReceiver {
    4748public:
    4849    RemoteObjectRegistry(_WKRemoteObjectRegistry *, WebPage&);
     
    5556    void sendUnusedReply(uint64_t replyID);
    5657
     58    void close();
     59   
    5760private:
    5861    // IPC::MessageReceiver
     
    6467    void releaseUnusedReplyBlock(uint64_t replyID);
    6568
    66     _WKRemoteObjectRegistry *m_remoteObjectRegistry;
     69    WeakObjCPtr<_WKRemoteObjectRegistry> m_remoteObjectRegistry;
    6770    IPC::MessageSender& m_messageSender;
    68     WTF::Function<ProcessThrottler::BackgroundActivityToken()> m_takeBackgroundActivityToken;
     71    Function<ProcessThrottler::BackgroundActivityToken()> m_takeBackgroundActivityToken;
    6972    HashMap<uint64_t, ProcessThrottler::BackgroundActivityToken> m_pendingReplies;
     73    bool m_isRegisteredAsMessageReceiver { false };
     74    uint64_t m_messageReceiverID { 0 };
    7075};
    7176
    7277} // namespace WebKit
    73 
    74 #endif // RemoteObjectRegistry_h
  • branches/safari-607-branch/Source/WebKit/Shared/API/Cocoa/RemoteObjectRegistry.mm

    r233713 r245936  
    3333#import "UserData.h"
    3434#import "WebPage.h"
     35#import "WebProcess.h"
    3536#import "WebPageProxy.h"
    3637#import "WebProcessProxy.h"
     
    4344    , m_messageSender(page)
    4445    , m_takeBackgroundActivityToken([] { return ProcessThrottler::BackgroundActivityToken(); })
     46    , m_isRegisteredAsMessageReceiver(true)
     47    , m_messageReceiverID(page.pageID())
    4548{
     49    WebProcess::singleton().addMessageReceiver(Messages::RemoteObjectRegistry::messageReceiverName(), m_messageReceiverID, *this);
     50    page.setRemoteObjectRegistry(*this);
    4651}
    4752
     
    5661RemoteObjectRegistry::~RemoteObjectRegistry()
    5762{
     63    close();
    5864}
    5965
     66    void RemoteObjectRegistry::close()
     67    {
     68        if (m_isRegisteredAsMessageReceiver) {
     69            WebProcess::singleton().removeMessageReceiver(Messages::RemoteObjectRegistry::messageReceiverName(), m_messageReceiverID);
     70            m_isRegisteredAsMessageReceiver = false;
     71        }
     72    }
     73   
    6074void RemoteObjectRegistry::sendInvocation(const RemoteObjectInvocation& invocation)
    6175{
  • branches/safari-607-branch/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectRegistry.mm

    r235828 r245936  
    3939#import "WKRemoteObjectCoder.h"
    4040#import "WKSharedAPICast.h"
     41#import "WebPage.h"
    4142#import "_WKRemoteObjectInterface.h"
    4243#import <objc/runtime.h>
  • branches/safari-607-branch/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm

    r242021 r245936  
    361361- (void)dealloc
    362362{
    363     if (_remoteObjectRegistry) {
    364         WebKit::WebProcess::singleton().removeMessageReceiver(Messages::RemoteObjectRegistry::messageReceiverName(), _page->pageID());
     363    if (_remoteObjectRegistry)
    365364        [_remoteObjectRegistry _invalidate];
    366     }
    367365
    368366    _page->~WebPage();
     
    427425- (_WKRemoteObjectRegistry *)_remoteObjectRegistry
    428426{
    429     if (!_remoteObjectRegistry) {
     427    if (!_remoteObjectRegistry)
    430428        _remoteObjectRegistry = adoptNS([[_WKRemoteObjectRegistry alloc] _initWithWebPage:*_page]);
    431         WebKit::WebProcess::singleton().addMessageReceiver(Messages::RemoteObjectRegistry::messageReceiverName(), _page->pageID(), [_remoteObjectRegistry remoteObjectRegistry]);
    432     }
    433429
    434430    return _remoteObjectRegistry.get();
  • branches/safari-607-branch/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm

    r241888 r245936  
    3030#import "LoadParameters.h"
    3131#import "PluginView.h"
     32#import "RemoteObjectRegistry.h"
    3233#import "WebPageProxyMessages.h"
    3334#import <WebCore/DictionaryLookup.h>
     
    186187}
    187188
     189void WebPage::setRemoteObjectRegistry(RemoteObjectRegistry& registry)
     190{
     191    m_remoteObjectRegistry = makeWeakPtr(registry);
     192}
     193
    188194} // namespace WebKit
    189195
  • branches/safari-607-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r245355 r245936  
    245245#include "PlaybackSessionManager.h"
    246246#include "RemoteLayerTreeTransaction.h"
     247#include "RemoteObjectRegistry.h"
     248#include "RemoteObjectRegistryMessages.h"
    247249#include "TouchBarMenuData.h"
    248250#include "TouchBarMenuItemData.h"
     
    12951297
    12961298    auto& webProcess = WebProcess::singleton();
     1299    if (m_remoteObjectRegistry)
     1300        m_remoteObjectRegistry->close();
    12971301#if ENABLE(ASYNC_SCROLLING)
    12981302    if (m_useAsyncScrolling)
  • branches/safari-607-branch/Source/WebKit/WebProcess/WebPage/WebPage.h

    r242858 r245936  
    205205class PageBanner;
    206206class PluginView;
     207    class RemoteObjectRegistry;
    207208class RemoteWebInspectorUI;
    208209class UserMediaPermissionRequestManager;
     
    11361137    void didReceiveWebPageMessage(IPC::Connection&, IPC::Decoder&);
    11371138
     1139    void setRemoteObjectRegistry(RemoteObjectRegistry&);
    11381140private:
    11391141    WebPage(uint64_t pageID, WebPageCreationParameters&&);
     
    18051807    bool m_isSuspended { false };
    18061808    bool m_needsFontAttributes { false };
     1809#if PLATFORM(COCOA)
     1810    WeakPtr<RemoteObjectRegistry> m_remoteObjectRegistry;
     1811#endif
    18071812};
    18081813
  • branches/safari-607-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/BundleRetainPagePlugIn.mm

    r241313 r245936  
    2929
    3030#import <WebKit/WKWebProcessPlugIn.h>
     31#import <WebKit/WKWebProcessPluginBrowserContextControllerPrivate.h>
    3132#import <wtf/RetainPtr.h>
    3233
     
    3940{
    4041    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.5*NSEC_PER_SEC), dispatch_get_main_queue(), [retainedPage = retainPtr(browserContextController)] { });
     42   
     43    // Instantiate a _WKRemoteObjectRegistry to test that its existence does not conflict with the existence
     44    // of the _WKRemoteObjectRegistry from the other WebPage that will be in this process.
     45    [browserContextController _remoteObjectRegistry];
    4146}
    4247
Note: See TracChangeset for help on using the changeset viewer.