Changeset 231980 in webkit


Ignore:
Timestamp:
May 18, 2018 1:20:35 PM (6 years ago)
Author:
Brent Fulgham
Message:

Convert ProcessPrivilege assertions to regular debug-only assertions
https://bugs.webkit.org/show_bug.cgi?id=185775
<rdar://problem/40372286>

Reviewed by Geoffrey Garen.

In Bug 184322 I added a number of RELEASE_ASSERT checks that certain
UI-only calls were not being made in the WebContent process.

Measurements have shown that these RELEASE_ASSERTs have regressed performance
by around 1% on some benchmarks, so we should convert them to normal asserts.

This patch changes the RELEASE_ASSERTs into ASSERTs.

Source/WebCore:

  • platform/mac/PasteboardMac.mm:

(WebCore::Pasteboard::setDragImage):

  • platform/mac/PlatformScreenMac.mm:

(WebCore::displayID):
(WebCore::firstScreen):
(WebCore::window):
(WebCore::screen):
(WebCore::getScreenProperties):
(WebCore::screenIsMonochrome):

Source/WebKit:

  • UIProcess/Cocoa/WebProcessPoolCocoa.mm:

(WebKit::WebProcessPool::platformInitializeWebProcess):

  • UIProcess/Cocoa/WebViewImpl.mm:

(WebKit::WebViewImpl::WebViewImpl):
(WebKit::WebViewImpl::becomeFirstResponder):
(WebKit::WebViewImpl::pluginFocusOrWindowFocusChanged):
(WebKit::WebViewImpl::validateUserInterfaceItem):
(WebKit::WebViewImpl::startSpeaking):
(WebKit::WebViewImpl::stopSpeaking):
(WebKit::applicationFlagsForDrag):
(WebKit::WebViewImpl::doneWithKeyEvent):

  • UIProcess/Gamepad/mac/UIGamepadProviderMac.mm:

(WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput):

  • UIProcess/Plugins/mac/PluginProcessProxyMac.mm:

(WebKit::PluginProcessProxy::enterFullscreen):
(WebKit::PluginProcessProxy::beginModal):
(WebKit::PluginProcessProxy::endModal):

  • UIProcess/mac/DisplayLink.cpp:

(WebKit::DisplayLink::DisplayLink):
(WebKit::DisplayLink::~DisplayLink):

  • UIProcess/mac/WebPageProxyMac.mm:

(WebKit::WebPageProxy::getIsSpeaking):
(WebKit::WebPageProxy::speak):
(WebKit::WebPageProxy::stopSpeaking):
(WebKit::WebPageProxy::startDisplayLink):

  • UIProcess/mac/WebPopupMenuProxyMac.mm:

(WebKit::WebPopupMenuProxyMac::showPopupMenu):

Location:
trunk/Source
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r231979 r231980  
     12018-05-18  Brent Fulgham  <bfulgham@apple.com>
     2
     3        Convert ProcessPrivilege assertions to regular debug-only assertions
     4        https://bugs.webkit.org/show_bug.cgi?id=185775
     5        <rdar://problem/40372286>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        In Bug 184322 I added a number of RELEASE_ASSERT checks that certain
     10        UI-only calls were not being made in the WebContent process.
     11
     12        Measurements have shown that these RELEASE_ASSERTs have regressed performance
     13        by around 1% on some benchmarks, so we should convert them to normal asserts.
     14
     15        This patch changes the RELEASE_ASSERTs into ASSERTs.
     16
     17        * platform/mac/PasteboardMac.mm:
     18        (WebCore::Pasteboard::setDragImage):
     19        * platform/mac/PlatformScreenMac.mm:
     20        (WebCore::displayID):
     21        (WebCore::firstScreen):
     22        (WebCore::window):
     23        (WebCore::screen):
     24        (WebCore::getScreenProperties):
     25        (WebCore::screenIsMonochrome):
     26
    1272018-05-18  Eric Carlson  <eric.carlson@apple.com>
    228
  • trunk/Source/WebCore/platform/mac/PasteboardMac.mm

    r231276 r231980  
    677677    // NSRunLoop, and not the NSApplication run loop.
    678678    if ([NSApp isRunning]) {
    679         RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     679        ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    680680        NSEvent* event = [NSEvent mouseEventWithType:NSEventTypeMouseMoved location:NSZeroPoint
    681681            modifierFlags:0 timestamp:0 windowNumber:0 context:nil eventNumber:0 clickCount:0 pressure:0];
  • trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm

    r231937 r231980  
    4949static PlatformDisplayID displayID(NSScreen *screen)
    5050{
    51     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     51    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    5252    return [[[screen deviceDescription] objectForKey:@"NSScreenNumber"] intValue];
    5353}
     
    7272static NSScreen *firstScreen()
    7373{
    74     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     74    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    7575    NSArray *screens = [NSScreen screens];
    7676    if (![screens count])
     
    8181static NSWindow *window(Widget* widget)
    8282{
    83     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     83    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    8484    if (!widget)
    8585        return nil;
     
    8989static NSScreen *screen(Widget* widget)
    9090{
    91     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     91    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    9292    // If the widget is in a window, use that, otherwise use the display ID from the host window.
    9393    // First case is for when the NSWindow is in the same process, second case for when it's not.
     
    111111std::pair<PlatformDisplayID, HashMap<PlatformDisplayID, ScreenProperties>> getScreenProperties()
    112112{
    113     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     113    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    114114
    115115    HashMap<PlatformDisplayID, ScreenProperties> screenProperties;
     
    172172
    173173    // This is a system-wide accessibility setting, same on all screens.
    174     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     174    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    175175    return CGDisplayUsesForceToGray();
    176176}
     
    247247NSScreen *screen(NSWindow *window)
    248248{
    249     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     249    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    250250    return [window screen] ?: firstScreen();
    251251}
     
    253253NSScreen *screen(PlatformDisplayID displayID)
    254254{
    255     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     255    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    256256    for (NSScreen *screen in [NSScreen screens]) {
    257257        if (WebCore::displayID(screen) == displayID)
  • trunk/Source/WebKit/ChangeLog

    r231979 r231980  
     12018-05-18  Brent Fulgham  <bfulgham@apple.com>
     2
     3        Convert ProcessPrivilege assertions to regular debug-only assertions
     4        https://bugs.webkit.org/show_bug.cgi?id=185775
     5        <rdar://problem/40372286>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        In Bug 184322 I added a number of RELEASE_ASSERT checks that certain
     10        UI-only calls were not being made in the WebContent process.
     11
     12        Measurements have shown that these RELEASE_ASSERTs have regressed performance
     13        by around 1% on some benchmarks, so we should convert them to normal asserts.
     14
     15        This patch changes the RELEASE_ASSERTs into ASSERTs.
     16
     17        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
     18        (WebKit::WebProcessPool::platformInitializeWebProcess):
     19        * UIProcess/Cocoa/WebViewImpl.mm:
     20        (WebKit::WebViewImpl::WebViewImpl):
     21        (WebKit::WebViewImpl::becomeFirstResponder):
     22        (WebKit::WebViewImpl::pluginFocusOrWindowFocusChanged):
     23        (WebKit::WebViewImpl::validateUserInterfaceItem):
     24        (WebKit::WebViewImpl::startSpeaking):
     25        (WebKit::WebViewImpl::stopSpeaking):
     26        (WebKit::applicationFlagsForDrag):
     27        (WebKit::WebViewImpl::doneWithKeyEvent):
     28        * UIProcess/Gamepad/mac/UIGamepadProviderMac.mm:
     29        (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput):
     30        * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
     31        (WebKit::PluginProcessProxy::enterFullscreen):
     32        (WebKit::PluginProcessProxy::beginModal):
     33        (WebKit::PluginProcessProxy::endModal):
     34        * UIProcess/mac/DisplayLink.cpp:
     35        (WebKit::DisplayLink::DisplayLink):
     36        (WebKit::DisplayLink::~DisplayLink):
     37        * UIProcess/mac/WebPageProxyMac.mm:
     38        (WebKit::WebPageProxy::getIsSpeaking):
     39        (WebKit::WebPageProxy::speak):
     40        (WebKit::WebPageProxy::stopSpeaking):
     41        (WebKit::WebPageProxy::startDisplayLink):
     42        * UIProcess/mac/WebPopupMenuProxyMac.mm:
     43        (WebKit::WebPopupMenuProxyMac::showPopupMenu):
     44
    1452018-05-18  Eric Carlson  <eric.carlson@apple.com>
    246
  • trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm

    r231770 r231980  
    181181#pragma clang diagnostic push
    182182#pragma clang diagnostic ignored "-Wdeprecated-declarations"
    183     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     183    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    184184    parameters.accessibilityEnhancedUserInterfaceEnabled = [[NSApp accessibilityAttributeValue:@"AXEnhancedUserInterface"] boolValue];
    185185#pragma clang diagnostic pop
  • trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm

    r231371 r231980  
    12961296    static_cast<PageClientImpl&>(*m_pageClient).setImpl(*this);
    12971297
    1298     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     1298    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    12991299    [NSApp registerServicesMenuSendTypes:PasteboardTypes::forSelection() returnTypes:PasteboardTypes::forEditing()];
    13001300
     
    14301430bool WebViewImpl::becomeFirstResponder()
    14311431{
    1432     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     1432    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    14331433    // If we just became first responder again, there is no need to do anything,
    14341434    // since resignFirstResponder has correctly detected this situation.
     
    23872387void WebViewImpl::pluginFocusOrWindowFocusChanged(bool pluginHasFocusAndWindowHasFocus, uint64_t pluginComplexTextInputIdentifier)
    23882388{
    2389     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     2389    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    23902390    BOOL inputSourceChanged = m_pluginComplexTextInputIdentifier;
    23912391
     
    26972697bool WebViewImpl::validateUserInterfaceItem(id <NSValidatedUserInterfaceItem> item)
    26982698{
    2699     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     2699    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    27002700    SEL action = [item action];
    27012701
     
    28192819void WebViewImpl::startSpeaking()
    28202820{
    2821     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     2821    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    28222822    m_page->getSelectionOrContentsAsString([](const String& string, WebKit::CallbackBase::Error error) {
    28232823        if (error != WebKit::CallbackBase::Error::None)
     
    28322832void WebViewImpl::stopSpeaking(id sender)
    28332833{
    2834     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     2834    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    28352835    [NSApp stopSpeaking:sender];
    28362836}
     
    36403640static WebCore::DragApplicationFlags applicationFlagsForDrag(NSView *view, id <NSDraggingInfo> draggingInfo)
    36413641{
    3642     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     3642    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    36433643    uint32_t flags = 0;
    36443644    if ([NSApp modalWindow])
     
    42534253void WebViewImpl::doneWithKeyEvent(NSEvent *event, bool eventWasHandled)
    42544254{
    4255     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     4255    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    42564256    if ([event type] != NSEventTypeKeyDown)
    42574257        return;
  • trunk/Source/WebKit/UIProcess/Gamepad/mac/UIGamepadProviderMac.mm

    r230468 r231980  
    3939WebPageProxy* UIGamepadProvider::platformWebPageProxyForGamepadInput()
    4040{
    41     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     41    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    4242    auto responder = [[NSApp keyWindow] firstResponder];
    4343
  • trunk/Source/WebKit/UIProcess/Plugins/mac/PluginProcessProxyMac.mm

    r231771 r231980  
    133133void PluginProcessProxy::enterFullscreen()
    134134{
    135     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     135    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    136136    // Get the current presentation options.
    137137    m_preFullscreenAppPresentationOptions = [NSApp presentationOptions];
     
    194194    ASSERT(!m_placeholderWindow);
    195195    ASSERT(!m_activationObserver);
    196     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     196    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    197197
    198198    m_placeholderWindow = adoptNS([[WKPlaceholderModalWindow alloc] initWithContentRect:NSMakeRect(0, 0, 1, 1) styleMask:NSWindowStyleMaskBorderless backing:NSBackingStoreBuffered defer:YES]);
     
    216216    ASSERT(m_placeholderWindow);
    217217    ASSERT(m_activationObserver);
    218     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     218    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    219219
    220220    [[NSNotificationCenter defaultCenter] removeObserver:m_activationObserver.get()];
  • trunk/Source/WebKit/UIProcess/mac/DisplayLink.cpp

    r231818 r231980  
    3838DisplayLink::DisplayLink(WebCore::PlatformDisplayID displayID, WebPageProxy& webPageProxy)
    3939{
    40     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     40    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    4141    CVReturn error = CVDisplayLinkCreateWithCGDisplay(displayID, &m_displayLink);
    4242    if (error) {
     
    5858DisplayLink::~DisplayLink()
    5959{
    60     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     60    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    6161    ASSERT(m_displayLink);
    6262    if (!m_displayLink)
  • trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm

    r231510 r231980  
    134134void WebPageProxy::getIsSpeaking(bool& isSpeaking)
    135135{
    136     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     136    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    137137    isSpeaking = [NSApp isSpeaking];
    138138}
     
    140140void WebPageProxy::speak(const String& string)
    141141{
    142     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     142    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    143143    [NSApp speakString:nsStringFromWebCoreString(string)];
    144144}
     
    146146void WebPageProxy::stopSpeaking()
    147147{
    148     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     148    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    149149    [NSApp stopSpeaking:nil];
    150150}
     
    685685void WebPageProxy::startDisplayLink(unsigned observerID)
    686686{
    687     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     687    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    688688    if (!m_displayLink) {
    689689        uint32_t displayID = [[[[platformWindow() screen] deviceDescription] objectForKey:@"NSScreenNumber"] intValue];
  • trunk/Source/WebKit/UIProcess/mac/WebPopupMenuProxyMac.mm

    r230468 r231980  
    100100void WebPopupMenuProxyMac::showPopupMenu(const IntRect& rect, TextDirection textDirection, double pageScaleFactor, const Vector<WebPopupItem>& items, const PlatformPopupMenuData& data, int32_t selectedIndex)
    101101{
    102     RELEASE_ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     102    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
    103103    NSFont *font;
    104104    if (data.fontInfo.fontAttributeDictionary) {
Note: See TracChangeset for help on using the changeset viewer.